diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index d53db30..7e16799 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -9,9 +9,10 @@ class PostsController < ApplicationController # :params => params, # :pois_returned => @posts.size # ) + @layer = Layer.find(params[:layer_id]) layar_response = { - :layer => 'hyparlocal', + :layer => @layer.layar_name, :hotspots => @posts.collect { |p| post_to_poi(p) }, :errorCode => 0, # OK :errorString => "OK", diff --git a/app/models/layer.rb b/app/models/layer.rb index 86d2ff0..6807b9d 100644 --- a/app/models/layer.rb +++ b/app/models/layer.rb @@ -1,4 +1,9 @@ class Layer < ActiveRecord::Base attr_accessible :name has_and_belongs_to_many :feeds + + # Unique name for Layar layer + def layar_name + "apollo" + self.name.strip.downcase.gsub(/[^a-z0-9]/, '') + end end diff --git a/app/views/layers/show.html.haml b/app/views/layers/show.html.haml index 22aa2dc..08f76e1 100644 --- a/app/views/layers/show.html.haml +++ b/app/views/layers/show.html.haml @@ -5,7 +5,9 @@ %p API URL: = "#{request.protocol}#{request.host_with_port}/posts/near.layar?layer_id=#{@layer.id}" - + %br + Layar layer name: + = @layer.layar_name %h2 Feeds