noesya/osuny

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

Summary

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

<% if @involvements.any? %>
  <p><%= "#{@involvements.count} #{Education::Program.model_name.human(count: @involvements.count).downcase}" %></p>
  <div class="row g-2 mb-3">
    <% @involvements.each do |involvement| %>
      <%
        program = involvement.target
        involvement_l10n = involvement.best_localization_for(current_language)
      %>
      <div>
        <div class="<%= osuny_card_classes(horizontal: true) %>">
          <%= osuny_thumbnail_localized program %>
          <div class="card-body">
            <%= osuny_link_localized program, [:admin, program] %>
          </div>
          <div class="card-footer">
            <span class="me-4 <%= 'text-muted fst-italic' if involvement_l10n.language_id != current_language.id %>"><%= involvement_l10n.description %></span>
            <%= link_to t('quit'),
                        admin_education_program_teacher_path(involvement, { program_id: program.id }),
                        method: :delete,
                        data: { confirm: t('please_confirm') },
                        class: button_classes_danger if can?(:destroy, involvement) %>
          </div>
        </div>
      </div>
    <% end %>
  </div>
<% else %>
  <p><%= t('admin.education.programs.teacher.no_teaching') %></p>
<% end %>

<div class="mt-5 small">
  <p><%= t('admin.education.programs.teacher.show_person_html') %></p>
  <%= link_to t('show'), admin_university_person_path(@teacher), class: 'action' %>
</div>

<% content_for :action_bar_left do %>
  <%= static_link static_admin_education_teacher_path(@teacher) %>
<% end %>

<% content_for :action_bar_right do %>
  <%= link_to t('education.manage_programs'), edit_admin_education_teacher_path(@teacher), class: button_classes if can?(:update, @teacher) %>
<% end %>