noesya/osuny

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

Summary

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

<div class="row">
  <div class="col-lg-8">
    <div class="row">
      <div class="col-lg-6">
        <% if @program.diploma.present? %>
          <%= osuny_label Education::Program.human_attribute_name('diploma') %>
          <p><%= osuny_link_localized @program.diploma, [:admin, @program.diploma] %></p>
        <% end %>
        <% if @program.parent %>
          <%= osuny_label Education::Program.human_attribute_name('parent') %>
          <p><%= osuny_link_localized @program.parent, [:admin, @program.parent] %></p>
        <% end %>
        <% if @program.schools.any? %>
          <%= osuny_label Education::Program.human_attribute_name('schools') %>
          <ul class="list-unstyled mb-4">
            <% @program.schools.ordered(current_language).each do |school| %>
              <li><%= osuny_link_localized school, [:admin, school] %></li>
            <% end %>
          </ul>
        <% end %>
        <% if @program.locations.any? %>
          <%= osuny_label Education::Program.human_attribute_name('locations') %>
          <ul class="list-unstyled mb-4">
            <% @program.locations.ordered(current_language).each do |location| %>
              <li><%= osuny_link_localized_if can?(:read, location), location, [:admin, location] %></li>
            <% end %>
          </ul>
        <% end %>
        <% if @program.categories.any? %>
          <%= osuny_label Education::Program::Category.model_name.human(count: 2) %>
          <ul class="list-unstyled mb-4">
            <% @program.categories.each do |category| %>
              <li><%= osuny_link_localized_if can?(:read, category), category, [:admin, category] %></li>
            <% end %>
          </ul>
        <% end %>
        <%= osuny_label t('education.program.registration_scheme') %>
        <table class="table">
          <tbody>
            <tr>
              <th><%= Education::Program.human_attribute_name('initial') %></th>
              <td class="text-end"><%= t @program.initial %></td>
            </tr>
            <tr>
              <th><%= Education::Program.human_attribute_name('continuing') %></th>
              <td class="text-end"><%= t @program.continuing %></td>
            </tr>
            <tr>
              <th><%= Education::Program.human_attribute_name('apprenticeship') %></th>
              <td class="text-end"><%= t @program.apprenticeship %></td>
            </tr>
            <tr>
              <th><%= Education::Program.human_attribute_name('capacity') %></th>
              <td class="text-end"><%= @program.capacity %></td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="col-lg-6">
        <%= render 'admin/application/summary/show', about: @l10n, small: true %>
        <% if @l10n.short_name.present? %>
          <%= osuny_label Education::Program::Localization.human_attribute_name('short_name') %>
          <p><%= @l10n.short_name %></p>
        <% end %>
        <% if @l10n.downloadable_summary.attached? %>
          <%= osuny_label Education::Program::Localization.human_attribute_name('downloadable_summary') %>
          <p><%= link_to "#{@l10n.downloadable_summary.filename} (#{ number_to_human_size @l10n.downloadable_summary.blob.byte_size })",
                          url_for(@l10n.downloadable_summary),
                          target: :_blank %></p>
        <% end %>
        <% if @l10n.duration.present? %>
          <%= osuny_label Education::Program::Localization.human_attribute_name('duration') %>
          <p><%= @l10n.duration %></p>
        <% end %>
        <% if @program.children.any? %>
          <%= osuny_label Education::Program.model_name.human(count: 2) %>
          <ul class="list-unstyled">
            <% @program.children.each do |child| %>
              <li><%= osuny_link_localized child, [:admin, child] %></li>
            <% end %>
          </ul>
        <% end %>
        <div class="mb-4">
          <%= osuny_label t('metadata') %>
          <p><%= Education::Program::Localization.human_attribute_name(@l10n.published ? 'is_published' : 'is_draft') %></p>
        </div>
        <%= render 'admin/application/meta_description/show', about: @l10n %>
        <%= render 'admin/application/property/text', object: @l10n, property: :presentation %>
        <%= render 'admin/application/property/text', object: @l10n, property: :objectives %>
      </div>
    </div>
  </div>
  <div class="offset-lg-1 col-lg-3">
    <% if @l10n.logo.attached? %>
      <%= osuny_label Education::Program::Localization.human_attribute_name('logo') %>
      <div class="mb-5">
        <%= kamifusen_tag @l10n.logo, class: 'img-fluid svg-fluid' %>
      </div>
    <% end %>
    <%= render 'admin/application/featured_image/show', about: @l10n, small: true %>
  </div>
</div>

<%= osuny_separator %>

<%= render 'admin/application/a11y/widget', about: @l10n, horizontal: true %>
<%= render 'admin/communication/contents/editor', about: @l10n %>

<%= osuny_separator %>

<div class="education_program_nav_in_summary">
  <div class="row mb-4">
    <div class="col-lg-4">
      <p class="small text-muted">
        <%= t('admin.education.programs.submenu') %>
      </p>
    </div>
    <div class="col-lg-8 small">
      <%= render_navigation context: 'navigation/admin/education/program',
                            renderer: :list  %>
    </div>
  </div>
</div>

<% content_for :action_bar_left do %>
  <%= destroy_link @program %>
  <%= static_link static_admin_education_program_path(@program) %>
<% end %>

<% content_for :action_bar_right do %>
  <%= preview_link %>
  <%= edit_link @program %>
<% end %>