<% @breadcrumbs = [] #- Get blog data @posts = Post.site(@agency.id).language(I18n.locale).where(:kind => BLOG) #- Filter by category if params[:category] && @category = Category.find_by_permalink(params[:category]) @posts = @posts.where(:category_id => @category) @breadcrumbs << "#{I18n.t('Blog')}" end #- Filter by place if params[:place] && @place = Place.find_by_permalink(params[:place]) @posts = @posts.where(:place_id => @place.id) @breadcrumbs << "#{I18n.t('Blog')}" end #--------- LEISURE TAG, we hard code this!!! -------------# @posts = @posts.tag_search('corporate') @categories = Category.where(['id IN (SELECT category_id FROM posts WHERE tags ~* ? AND kind=? AND id IN (SELECT post_id FROM agency_posts WHERE agency_id=?) GROUP BY category_id)', 'corporate', BLOG, @agency.id]).order('title') @places = Place.where(['permalink <> ? AND id IN (SELECT place_id FROM posts WHERE tags ~* ? AND kind=? AND id IN (SELECT post_id FROM agency_posts WHERE agency_id=?) GROUP BY place_id)', 'anywhere', 'corporate', BLOG, @agency.id]).order('title').limit(20) #- Grab the rest of posts now @posts = @posts.order('created_at desc').paginate(:per_page => 10, :page => params[:page]) #- Meta @title = @agency.name + "'s " + I18n.t(' Blog') @description = I18n.t('Travel Tips for Smart Travelers from ') + @agency.name @breadcrumbs << I18n.t('The Travel Blog') %>
<% if @posts && @posts.length > 0 %> <% @posts.each do |post| %>

<%= post.title %>

<%= tagline_for_post(post) %>
<% if a = post.attachments.first %>
<% if a && a._type == 'video' %>
<%= raw a.html %>
<% elsif a && a._type == 'photo' %>
<%= post.title %>
<%= post.title %>
<% end %>
<% end %> <% if !a && post.summary %>

<%= wiki_content(post.summary, post) %>

<% if post.content %> <%= t('read more')%> <% end %> <% end %>
<% end %> <% end %> <% if @posts and @posts.length > 0 %>
<% end %>
<% if @categories && @categories.length > 0 %>

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

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

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

<% end %>
<%= render_page('tat_subscribe_form_corporate') %>