<% if Thread.current[:post] = @post = Post.where(:permalink => params[:id]).site(@agency.id).first @title = @post.title unless @description = @post.summary @description = @post.content ? @post.content[0..128] : @post.title end @breadcrumbs = @post.breadcrumbs @place = @post.place if @post.place.permalink != 'anywhere' @places = Place.where('id <> ?', @post.place.id).within(100, :origin => [@place.lat, @place.lng]).limit(10) @in_country = [@place.id] if @places.length > 0 @places.each do |p| @in_country << p.id end end @experiences = Post.site(@agency.id).language(I18n.locale).where(:place_id => @in_country, :kind => VENDOR).order('created_at DESC') end @related = @post.related @categories = Category.where(['id IN (SELECT category_id FROM posts WHERE kind=? AND id IN (SELECT post_id FROM agency_posts WHERE agency_id=?) GROUP BY category_id)', BLOG, @agency.id]).order('title') @places = Place.where(['permalink <> ? AND id IN (SELECT place_id FROM posts WHERE kind=? AND id IN (SELECT post_id FROM agency_posts WHERE agency_id=?) GROUP BY place_id)', 'anywhere', BLOG, @agency.id]).order('title').limit(20) %>
<% if @post.summary && @post.summary.strip.length > 0 %> <%= simple_format(wiki_content(@post.summary, @post)) %> <% end %> <% photos = @post.attachments %> <% if photos && photos.length > 0 && a = photos.first %>
<% if a && a._type == 'video' %>
<%= raw a.html %>
<% elsif a && a._type == 'photo' %>
<%= @post.title %>
<%= @post.title %>
<% end %> <% if photos && photos.length > 1 %> <% if photos && photos.length > 0 %>
<% image_count = -1 %> <% photos.each do |a| %>
<%= image_tag(a.size(:thumb) , :title => a.title, :alt => a.title, :itemprop => 'image') %>
<% end %>
<% end %> <% end %>
<% end %> <% if @post.content_format && @post.content_format == 'html' %> <%= raw(@post.content) %> <% else %> <%= wiki_content(@post.content) %> <% end %>
<%= render_page('share_block2') %>
<%= render_page('ad_horizontal_blog') %> <%= render_page('all_agencies_blog_product_horizontal') %> <%= render_page('more_rewards_ad_zone_blog_product_horizontal') %> <% @related = Post.where('posts.id <> ?', @post.id).site(@agency.id).language(I18n.locale).where(:kind => INDEXABLE_POSTS).tag_search(@post.tags).all %> <% if @related && @related.length > 0 %> <% end %> <%= render_page('comment_form') %>
<% if @categories && @categories.length > 0 %>

<%= t('Things we blog about')%>

<% end %> <% if @places && @places.length > 0 %>

<%= t('Places we have blogged about')%>


<%= render_page('ad_side_blog') %> <%= render_page('all_agencies_blog_product_side') %> <%= render_page('more_rewards_ad_zone_blog_product_side') %>
<% end %>
<%= render_page('tat_subscribe_form') %>
<% else %>

Blog post not found

<% end %>