denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyCMS/app/views/shinycms/discussions/index.html.erb

Summary

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

<section>
  <header>
    <h2>
      <%= t( '.recently_active' ) %>
    </h2>
  </header>

  <table>
    <% @recent_comment_counts.each do |discussion_id, recent_count| %>
    <% discussion = @active_discussions.find( discussion_id ) %>
    <tr>
      <td>
        <%= link_to discussion.resource.title, discussion.resource.path %>
      </td>
      <td>
        <%= t( 'shinycms.discussions.n_recent_comments', count: recent_count ) %>
      </td>
      <td>
        (<%= t( 'shinycms.discussions.n_total', count: discussion.comments.visible.count ) %>)
      </td>
      <td>
        <%= discussion.resource.class.readable_name.titlecase %>
      </td>
    </tr>
    <% end %>
  </table>

  <% if @active_discussions.blank? %>
    <p>
      <%= t( 'shinycms.empty_list', items: 'recently-active discussions' ) %>
    </p>
  <% end %>
</section>