noesya/osuny

View on GitHub
app/views/admin/administration/qualiopi/evaluations/_list.html.erb

Summary

Maintainability
Test Coverage
<div class="table-responsive">
  <table class="<%= table_classes(with_actions: false) %> mt-5">
    <thead>
      <tr>
        <th><%= Education::Program.model_name.human %></th>
        <% checks.each do |check| %>
          <th><%= Education::Program.human_attribute_name(check) %></th>
        <% end %>
      </tr>
    </thead>
    <tbody>
      <% 
      programs.each do |program| 
        l10n = program.localization_for(current_language)
        %>
        <tr>
          <td>
            <% if program.ancestors.any? %>
              <small>
                <% program.ancestors.each do |program| %>
                  <%= program.to_s_in(current_language) %> /
                <% end %>
              </small><br>
            <% end %>
            <%= osuny_link_localized program, [:admin, program] %>
          </td>
          <% checks.each do |check| %>
            <%
            method = l10n.respond_to?("best_#{check}")  ? "best_#{check}"
                                                        : "#{check}"
            value = l10n.public_send(method)
            valid = value.present?
            %>
            <td>
              <% if valid %>
                <span class="<%= Icon::CHECK_OK %> text-success"></span>
              <% else %>
                <span class="<%= Icon::CHECK_KO %> text-danger"></span>
              <% end %>
            </td>
          <% end %>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>