show.html.erb 1.22 KB
<div class="page-header">
  <h1><%= @reading_group.name %></h1>
</div>

<p>
  <strong><%= ReadingGroup.human_attribute_name('description') %></strong>
  <%= @reading_group.description %>
</p>

<hr />

<h2><%= Reading.model_name.human(count: 2) %></h2>

<% if reading_groups_owner? @reading_group.id %>
  <%= link_to t_action(:new, Reading), new_reading_group_reading_path(@reading_group,), class: 'btn btn-primary' %>
<% end %>

<table class="table table-hover">
  <thead>
    <tr>
      <th><%= Reading.human_attribute_name('label') %></th>
      <th><%= Reading.human_attribute_name('grade') %></th>
      <th><%= Reading.human_attribute_name('color') %></th>
    </tr>
  </thead>

  <tbody>
    <% reading_group_readings = @reading_group.readings %>
    <% if reading_group_readings.size == 0 %>
      <%= render partial: 'no_readings' %>
    <% else %>
      <%= render partial: 'reading', collection: reading_group_readings, as: :reading %>
    <% end %>
  </tbody>
</table>

<hr />

<p>
  <% if reading_groups_owner? @reading_group.id %>
    <%= link_to t('destroy'), reading_group_path(@reading_group.id), method: :delete, data: { confirm: t('sure_destroy', model: ReadingGroup.model_name.human) }, class: 'btn btn-danger' %>
  <% end %>
</p>