| @@ -1,9 +1,16 @@ | |||||
| module PostsHelper | module PostsHelper | ||||
| def post_to_poi(post, subscription) | def post_to_poi(post, subscription) | ||||
| # http://layar.com/documentation/browser/api/getpois-response/ | # http://layar.com/documentation/browser/api/getpois-response/ | ||||
| if subscription.layer.icon_url.blank? | |||||
| image_url = "%s%s/assets/layar-icons/tal-logo-100.png" % [ request.protocol, request.env['HTTP_HOST'] ] | |||||
| else | |||||
| image_url = subscription.layer.icon_url | |||||
| end | |||||
| res = { | res = { | ||||
| :id => post.id, | :id => post.id, | ||||
| :imageURL => "%s%s/assets/layar-icons/tal-logo-100.png" % [ request.protocol, request.env['HTTP_HOST'] ], | |||||
| :imageURL => image_url, | |||||
| :anchor => { | :anchor => { | ||||
| :geolocation => { | :geolocation => { | ||||
| :lat => post.lat, | :lat => post.lat, | ||||
| @@ -2,7 +2,7 @@ class Layer < ActiveRecord::Base | |||||
| has_many :subscriptions | has_many :subscriptions | ||||
| has_many :feeds, :through => :subscriptions, :uniq => true | has_many :feeds, :through => :subscriptions, :uniq => true | ||||
| attr_accessible :name | |||||
| attr_accessible :name, :icon_url | |||||
| # Unique name for Layar layer | # Unique name for Layar layer | ||||
| def layar_name | def layar_name | ||||
| @@ -8,6 +8,13 @@ | |||||
| .field | .field | ||||
| = f.label :name | = f.label :name | ||||
| %br | |||||
| = f.text_field :name | = f.text_field :name | ||||
| %br | |||||
| .field | |||||
| = f.label "Icon URL (optional)" | |||||
| %br | |||||
| = f.text_field :icon_url, :size => 60 | |||||
| %br | |||||
| .actions | .actions | ||||
| = f.submit 'Save' | = f.submit 'Save' | ||||
| @@ -0,0 +1,5 @@ | |||||
| class AddIconUrlToLayers < ActiveRecord::Migration | |||||
| def change | |||||
| add_column :layers, :icon_url, :string | |||||
| end | |||||
| end | |||||
| @@ -11,7 +11,7 @@ | |||||
| # | # | ||||
| # It's strongly recommended to check this file into your version control system. | # It's strongly recommended to check this file into your version control system. | ||||
| ActiveRecord::Schema.define(:version => 20130417153542) do | |||||
| ActiveRecord::Schema.define(:version => 20130424113732) do | |||||
| create_table "delayed_jobs", :force => true do |t| | create_table "delayed_jobs", :force => true do |t| | ||||
| t.integer "priority", :default => 0 | t.integer "priority", :default => 0 | ||||
| @@ -45,6 +45,7 @@ ActiveRecord::Schema.define(:version => 20130417153542) do | |||||
| t.string "name" | t.string "name" | ||||
| t.datetime "created_at", :null => false | t.datetime "created_at", :null => false | ||||
| t.datetime "updated_at", :null => false | t.datetime "updated_at", :null => false | ||||
| t.string "icon_url" | |||||
| end | end | ||||
| create_table "posts", :force => true do |t| | create_table "posts", :force => true do |t| | ||||