Просмотр исходного кода

JSON output for Layar custom icons per feed

master
Adrian Short 11 лет назад
Родитель
Сommit
2a2843948c
2 измененных файлов: 11 добавлений и 5 удалений
  1. +1
    -1
      app/controllers/posts_controller.rb
  2. +10
    -4
      app/helpers/posts_helper.rb

+ 1
- 1
app/controllers/posts_controller.rb Просмотреть файл

@@ -13,7 +13,7 @@ class PostsController < ApplicationController

layar_response = {
:layer => @layer.layar_name,
:hotspots => @posts.collect { |p| post_to_poi(p) },
:hotspots => @posts.collect { |p| post_to_poi(p, Subscription.where(:feed_id => p.feed_id, :layer_id => @layer.id).first) },
:errorCode => 0, # OK
:errorString => "OK",
:radius => params[:radius].to_f


+ 10
- 4
app/helpers/posts_helper.rb Просмотреть файл

@@ -1,8 +1,8 @@
module PostsHelper
def post_to_poi(post)
def post_to_poi(post, subscription)
# http://layar.com/documentation/browser/api/getpois-response/
{
:id => post._id,
:id => post.id,
:imageURL => "%s%s/assets/layar-icons/tal-logo-100.png" % [ request.protocol, request.env['HTTP_HOST'] ],
:anchor => {
:geolocation => {
@@ -23,8 +23,14 @@ module PostsHelper
:contentType => "text/html",
:method => "GET",
:activityType => 1
}
]
},
],
:object => {
:contentType => "image/vnd.layar.generic",
:url => subscription.icon_url,
:reducedURL => subscription.icon_url,
:size => 120
}
}
end


Загрузка…
Отмена
Сохранить