Skip to content

Commit

Permalink
#57: WIP rendern der Collections in beiden Varianten
Browse files Browse the repository at this point in the history
  • Loading branch information
nbennke committed Dec 17, 2024
1 parent 0da4f42 commit 0be18d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/views/responsibilities/_result_list_by_group.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% @responsibilities.each do |responsibility| %>
<% @responsibilities.each do |responsibility| -%>
<tr>
<td><%= responsibility.category.kind_name %></td>
<td><%= responsibility.category %></td>
Expand Down
25 changes: 7 additions & 18 deletions app/views/responsibilities/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
<h1><%= Responsibility.model_name.human count: 2 %></h1>

<%= render partial: 'simple_text_filter' %>
<%= order_by_group? ? (paginate @responsibilities) : (paginate @categories) %>
<%= paginate %>

<table class="table">
<thead>
<tr>
<th>
<%= order_link MainCategory.human_attribute_name(:kind), :responsibilities, :kind %>
</th>
<th>
<%= order_link Category.model_name.human(count: 1), :responsibilities, :category %>
</th>
<th>
<%= order_link Group.model_name.human(count: 1), :responsibilities, :group %>
<% unless order_by_group? %><span class="float-end"><%= t :actions %></span><% end %>
</th>
<% if order_by_group? %><th><%= t :actions %></th><% end %>
<th><%= order_link MainCategory.human_attribute_name(:kind), :responsibilities, :kind %></th>
<th><%= order_link Category.model_name.human(count: 1), :responsibilities, :category %></th>
<th><%= order_link Group.model_name.human(count: 1), :responsibilities, :group %></th>
<th class="action"><%= t :actions %></th>
</tr>
</thead>
<tbody>
<% if order_by_group? %>
<%= render partial: 'result_list_by_group' %>
<% else %>
<%= render partial: 'result_list_by_category' %>
<% end %>
<%= render partial: order_by_group? ? 'result_list_by_group' : 'result_list_by_category' %>
</tbody>
</table>

<%= order_by_group? ? (paginate @responsibilities) : (paginate @categories) %>
<%= paginate %>

<% content_for :footer do %>
<div class="float-end">
Expand Down

0 comments on commit 0be18d6

Please sign in to comment.