浏览代码

JSON output for Layar custom icons per feed

master
Adrian Short 11 年前
父节点
当前提交
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


正在加载...
取消
保存