[phase-10]modified terms index with category grouping
This commit is contained in:
parent
c63ac32052
commit
088b2fa081
28
app/views/glossary_terms/_index_in_category.html.erb
Normal file
28
app/views/glossary_terms/_index_in_category.html.erb
Normal file
@ -0,0 +1,28 @@
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th><%=l :field_name %></th>
|
||||
<th><%=l :field_category %></th>
|
||||
<th><%=l :field_description %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% terms.each do |term| %>
|
||||
<tr>
|
||||
<td class="id">
|
||||
<%= term.id %>
|
||||
</td>
|
||||
<td class="name">
|
||||
<%= link_to term.name, [@project, term] %>
|
||||
</td>
|
||||
<td class="roles">
|
||||
<%= term.category.try!(:name) %>
|
||||
</td>
|
||||
<td class="description">
|
||||
<%= term.description %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -8,31 +8,15 @@
|
||||
|
||||
<%= render partial: 'sidebar' %>
|
||||
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th><%=l :field_name %></th>
|
||||
<th><%=l :field_category %></th>
|
||||
<th><%=l :field_description %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @glossary_terms.each do |term| %>
|
||||
<tr>
|
||||
<td class="id">
|
||||
<%= term.id %>
|
||||
</td>
|
||||
<td class="name">
|
||||
<%= link_to term.name, [@project, term] %>
|
||||
</td>
|
||||
<td class="roles">
|
||||
<%= term.category.try!(:name) %>
|
||||
</td>
|
||||
<td class="description">
|
||||
<%= term.description %>
|
||||
</td>
|
||||
</tr>
|
||||
<% categorized_terms = @glossary_terms.reject { |t| t.category_id.nil? } %>
|
||||
<% uncategorized_terms = @glossary_terms.where(category_id: nil) %>
|
||||
|
||||
<% categorized_terms.group_by(&:category).each do |category, terms| %>
|
||||
<h3><%= category.name %></h3>
|
||||
<%= render partial: 'index_in_category', locals: {terms: terms} %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3><%=l :label_not_categorized %></h3>
|
||||
<%= render 'index_in_category', terms: uncategorized_terms %>
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@ en:
|
||||
|
||||
label_view: View
|
||||
label_glossary_index: index
|
||||
label_not_categorized: Not categorized
|
||||
|
||||
index_en: |
|
||||
A B C D E F
|
||||
|
@ -11,6 +11,7 @@ ja:
|
||||
|
||||
label_view: 表示
|
||||
label_glossary_index: 索引
|
||||
label_not_categorized: 未分類
|
||||
|
||||
permission_view_glossary: 用語集の閲覧
|
||||
permission_manage_glossary: 用語集の管理
|
||||
|
Loading…
Reference in New Issue
Block a user