denny/ShinyCMS-ruby

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

Summary

Maintainability
Test Coverage
<% @page_title = t( '.title' ) %>

<%= render partial: 'blog/index/page_title' %>

<% @posts.each do |post| %>
<section class="post">
  <%= render partial: 'blog/index/post_header', locals: { post: post } %>

  <% teaser = post.teaser( paragraphs: 3 ) %>
  <%= sanitize teaser %>

  <% read_more = post.body.length > ( teaser.length + 10 ) ? 'read_more' : 'view_post' # 10 is an arbitrary fudge factor for extra newlines etc %>
  <%= render partial: 'blog/index/post_footer', locals:  { post: post, read_more: read_more } %>
</section>
<% end %>

<%= render partial: 'includes/newer_older_pager', locals: { pagy: @pagy } %>

<% if @posts.blank? %>
<p>
  <%= t( 'shinycms.empty_list', items: t( 'shinycms.models.names.shiny_blog_post' ).pluralize ) %>
</p>
<% end %>

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