denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyBlog/app/views/shiny_blog/blog/year.html.erb

Summary

Maintainability
Test Coverage
<% @page_title = "Blog posts in #{params[:year]}"  %>

<% current_month = '' %>
<% @posts.each do |post| %>
  <% unless post.posted_at.month == current_month %>
  <% current_month = post.posted_at.month %>
  <h2>
    <%= I18n.t('date.month_names')[current_month] %>
  </h2>
  <% end %>

  <section>
    <% if feature_enabled?( :comments ) && post.discussion&.show_on_site? %>
    <span class="float-right" style="margin-top: 2.5em;">
      <%= link_to t( 'shinycms.discussions.n_comments', count: post.discussion.comments.visible.count ), post.path( anchor: 'comments' ) %>
    </span>
    <% end %>

    <%= render partial: 'blog/index/post_header', locals: { post: post } %>
  </section>
<% end %>

<% if @posts.size == 0 %>
<p>
  <%= t( 'shinycms.empty_list', items: 'blog posts' ) %>
</p>
<% end %>

<% @sidebar_position = 'right' %>
<%= render partial: 'right_sidebar_join' %>
<%= render partial: 'sidebar' %>