show.html.erb
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<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>