noesya/osuny

View on GitHub
app/views/admin/education/programs/roles/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @l10n %>

<% if @involvements.any? %>
  <div class="table-responsive">
    <table class="<%= table_classes %>">
      <thead>
        <tr>
          <% if can? :reorder, University::Person::Involvement %>
            <th width="20" class="ps-0">&nbsp;</th>
          <% end %>
          <th class="ps-0"><%= University::Person.model_name.human %></th>
          <th></th>
        </tr>
      </thead>
      <tbody data-sortable data-sort-url="<%= reorder_admin_education_program_role_people_path(@role, { program_id: @program.id }) %>">
        <% @involvements.each do |involvement| %>
          <tr data-id="<%= involvement.id %>">
            <% if can? :reorder, University::Person::Involvement %>
              <td><i class="<%= Icon::DRAG %> handle"></i></td>
            <% end %>
            <td class="ps-0">
              <%= osuny_link_localized_if can?(:read, involvement.person),
                                          involvement.person,
                                          [:admin, involvement.person] %>
            </td>
            <td class="text-end pe-0">
              <%= link_to t('remove'),
                          admin_education_program_role_person_path(involvement, { program_id: @program.id, role_id: @role.id }),
                          method: :delete,
                          data: { confirm: t('please_confirm') },
                          class: button_classes_danger if can?(:destroy, involvement) %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
</div>
<% end %>


<% content_for :action_bar_right do %>
  <%= link_to t('edit'),
              edit_admin_education_program_role_path(@role, { program_id: @program.id }),
              class: button_classes if can?(:update, @role) %>
<% end %>