<% if @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('comment_form') %>
<% @related = Post.where('posts.id <> ?', @post.id).site(@agency.id).language(I18n.locale).where(:kind => BLOG).tag_search(@post.tags).limit(10).all %> <% if @related && @related.length > 0 %>

<%= t('RELATED POSTS')%>

<% elsif @related = Post.where('posts.id <> ?', @post.id).where(:category_id => @post.category_id).site(@agency.id).language(I18n.locale).where(:kind => BLOG).limit(10).all %> <% if @related && @related.length > 0 %>

<%= t('RELATED POSTS') %>

<% end %> <% end %>
<%= render_page('tat_subscribe_form') %>
<% else %>

Blog post not found

<% end %>