noesya/osuny

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

Summary

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

<div class="row">

  <div class="col-xxl-4">
    <%= osuny_panel t('metadata') do %>
      <%= osuny_label Education::School.human_attribute_name('address') %>
      <p>
        <%= @school.address %><br>
        <%= @school.zipcode %> <%= @school.city %>
        <% if @school.country.present? %>
          <br><%= @school.country_name %>
        <% end %>
      </p>
      <% if @school.phone.present? %>
        <%= osuny_label Education::School.human_attribute_name('phone') %>
        <p><%= @school.phone %></p>
      <% end %>
      <% if @l10n.url.present? %>
        <%= osuny_label Education::School::Localization.human_attribute_name('url') %>
        <p><%= link_to @l10n.url, @l10n.url, target: :_blank %></p>
      <% end %>
    <% end %>
  </div>
  <% if @l10n.logo.attached? %>
    <div class="col-xxl-4">
      <%= osuny_panel Education::School::Localization.human_attribute_name('logo') do %>
        <%= image_tag @l10n.logo, class: 'img-fluid' %>
      <% end %>
    </div>
  <% end %>

  <% if @school.locations.any? %>
    <div class="col-xxl-4">
      <%= osuny_panel Education::School.human_attribute_name('locations') do %>
        <ul class="list-unstyled">
          <% @school.locations.ordered(current_language).each do |location| %>
            <li><%= osuny_link_localized_if can?(:read, location), location, [:admin, location] %></li>
          <% end %>
        </ul>
      <% end %>
    </div>
  <% end %>

  <% if @school.websites.any? %>
    <div class="col-xxl-4">
      <%= osuny_panel Education::School.human_attribute_name('websites') do %>
        <ul class="list-unstyled">
          <% @school.websites.each do |website| %>
            <li><%= osuny_link_localized website, [:admin, website] %></li>
          <% end %>
        </ul>
      <% end %>
    </div>
  <% end %>

</div>

<%
action = ''
action += link_to t('education.schools.manage_roles'),
                  admin_education_school_roles_path(school_id: @school.id),
                  class: button_classes if can?(:update, University::Role)
%>
<%= osuny_panel Education::School.human_attribute_name('roles'), action: action do %>
  <% if @roles.any? %>
    <%= render 'admin/education/schools/roles/list', roles: @roles %>
  <% end %>
<% end %>

<% if @programs.any? %>
  <%= osuny_panel Education::School.human_attribute_name('programs') do %>
    <%= render 'admin/education/programs/list', programs: @programs %>
    <div>
      <%= @school.alumni.count %>
      <%= University::Person::Alumnus.model_name.human(count: 2).downcase %>
    </div>
  <% end %>
<% end %>

<% content_for :action_bar_left do %>
  <%= destroy_link @school %>
  <%= static_link static_admin_education_school_path(@school) %>
<% end %>

<% content_for :action_bar_right do %>
  <%= edit_link @school %>
<% end %>