|
1 | | -- if params[:exercise_id].nil? |
| 1 | +- if @exercise.nil? |
2 | 2 | h1 = ProgrammingGroup.model_name.human(count: :other) |
3 | 3 | = render(layout: 'shared/form_filters') do |f| |
4 | 4 | .col-auto |
|
12 | 12 | = f.label(:programming_group_memberships_user_of_InternalUser_type_id_eq, ProgrammingGroup.human_attribute_name('internal_user_id'), class: 'visually-hidden form-label') |
13 | 13 | = f.search_field(:programming_group_memberships_user_of_InternalUser_type_id_eq, class: 'form-control', placeholder: ProgrammingGroup.human_attribute_name('internal_user_id')) |
14 | 14 | - else |
15 | | - h1 = "#{ProgrammingGroup.model_name.human(count: :other)} for Exercise '#{@exercise.title}'" |
| 15 | + h1 = t('.for', model: ProgrammingGroup.model_name.human(count: :other), exercise: @exercise.title) |
16 | 16 |
|
17 | 17 | .table-responsive |
18 | 18 | table.table.mt-4 class=(@programming_groups.present? ? 'sortable' : '') |
19 | 19 | thead |
20 | 20 | tr |
21 | 21 | th.sortable_nosort = sort_link(@search, :id, ProgrammingGroup.human_attribute_name('name')) |
22 | | - - if params[:exercise_id].blank? |
| 22 | + - if @exercise.nil? |
23 | 23 | th.sorttable_nosort = sort_link(@search, :exercise_id, ProgrammingGroup.human_attribute_name('exercise')) |
24 | 24 | th = ProgrammingGroup.human_attribute_name('member') |
25 | 25 | th = ProgrammingGroup.human_attribute_name('member_count') |
26 | 26 | th.sorttable_nosort = sort_link(@search, :created_at, t('shared.created_at')) |
27 | 27 | th colspan=3 = t('shared.actions') |
28 | 28 | tbody |
29 | | - - if params[:exercise_id].nil? |
30 | | - - filtered_programming_groups = @programming_groups |
31 | | - - else |
32 | | - - filtered_programming_groups = @programming_groups.where(exercise_id: params[:exercise_id]) |
33 | | - - filtered_programming_groups.each do |programming_group| |
| 29 | + - @programming_groups.each do |programming_group| |
34 | 30 | tr |
35 | 31 | td = link_to_if(policy(programming_group).show?, programming_group.displayname, programming_group) |
36 | | - - if params[:exercise_id].blank? |
| 32 | + - if @exercise.nil? |
37 | 33 | td = link_to_if(policy(programming_group.exercise).show?, programming_group.exercise.title, programming_group.exercise, 'data-turbolinks': 'false') |
38 | 34 | td == programming_group.users.map {|user| link_to_if(policy(user).show?, user.name, user) }.join(', ') |
39 | 35 | td = programming_group.users.size |
40 | 36 | td = l(programming_group.created_at, format: :short) |
41 | | - td = link_to(t('shared.show'), programming_group) if policy(programming_group).show? |
42 | | - td = link_to(t('shared.edit'), edit_programming_group_path(programming_group)) if policy(programming_group).edit? |
43 | | - td = link_to(t('shared.destroy'), programming_group, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(programming_group).destroy? |
| 37 | + td = link_to(t('shared.show'), [@exercise, programming_group]) if policy(programming_group).show? |
| 38 | + td = link_to(t('shared.edit'), polymorphic_path([@exercise, programming_group], action: :edit)) if policy(programming_group).edit? |
| 39 | + td = link_to(t('shared.destroy'), [@exercise, programming_group], data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(programming_group).destroy? |
44 | 40 | = render('shared/pagination', collection: @programming_groups) |
0 commit comments