From 0cb288826556dfba21852beba9fe7acfe8a4d04f Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Thu, 11 Apr 2013 15:36:11 +0100 Subject: [PATCH] Only output icon object if icon_url isn't blank --- app/helpers/posts_helper.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 79f3b1e..7c7944d 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -1,7 +1,7 @@ module PostsHelper def post_to_poi(post, subscription) # http://layar.com/documentation/browser/api/getpois-response/ - { + res = { :id => post.id, :imageURL => "%s%s/assets/layar-icons/tal-logo-100.png" % [ request.protocol, request.env['HTTP_HOST'] ], :anchor => { @@ -24,14 +24,18 @@ module PostsHelper :method => "GET", :activityType => 1 }, - ], - :object => { + ] + } + + unless subscription.icon_url.blank? + res[:object] = { :contentType => "image/vnd.layar.generic", :url => subscription.icon_url, :reducedURL => subscription.icon_url, :size => 120 } - } + end + res end def decode_entities(s)