noesya/osuny

View on GitHub
app/views/admin/university/organizations/show.html.erb

Summary

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

<div class="row">
  <div class="col-lg-3">
  <%= osuny_panel t('university.organization.logo') do %>
    <% if @l10n.logo.attached? %>
      <div>
        <%= osuny_label University::Organization::Localization.human_attribute_name('logo') %><br>
        <%= kamifusen_tag @l10n.logo, class: 'img-fluid img-fill bg-light img-thumbnail p-5 mb-3' %>
      </div>
    <% end %>
    <% if @l10n.logo_on_dark_background.attached? %>
      <div>
        <%= osuny_label University::Organization::Localization.human_attribute_name('logo_on_dark_background') %><br>
        <%= kamifusen_tag @l10n.logo_on_dark_background, class: 'img-fluid img-fill bg-dark img-thumbnail p-5' %>
      </div>
    <% end %>
  <% end if @l10n.logo.attached? || @l10n.logo_on_dark_background.attached? %>

  <%= osuny_panel t('metadata') do %>
    <%= osuny_property_show_text @l10n, :slug, hide_blank: true %>
    <%= osuny_property_show_boolean @organization, :active %>
  <% end %>

  <% if @organization.categories.any? %>
    <%= osuny_panel University::Organization.human_attribute_name('categories'), small: true do %>
      <ul class="list-unstyled">
        <% @organization.categories.ordered.each do |category| %>
          <li>
            <%= osuny_link_localized_if can?(:read, category),
                                        category,
                                        [:admin, category] %>
          </li>
        <% end %>
      </ul>
    <% end %>
  <% end %>

  <%= render 'admin/application/l10n/widget', about: @organization, l10n: @l10n %>

  <%= render 'admin/application/meta_description/show', about: @l10n %>
  </div>
  <div class="offset-lg-1 col-lg-8">
    <%= render 'admin/application/summary/show', about: @l10n %>

    <%= osuny_panel University::Organization.human_attribute_name('text') do %>
      <%= @l10n.text.to_s.html_safe %>
    <% end if strip_tags(@l10n.text.to_s).present? %>

    <%= osuny_panel University::Organization.human_attribute_name('physical') do %>
      <%= osuny_property_show_text @l10n, :address_name, hide_blank: true %>
      <%= osuny_property_show_text @organization, :address, hide_blank: true %>
      <%= osuny_property_show_text @l10n, :address_additional, hide_blank: true %>
      <%= osuny_property_show_text @organization, :zipcode, hide_blank: true %>
      <%= osuny_property_show_text @organization, :city, hide_blank: true %>
      <% if @organization.country.present? %>
        <div class="col-md-4">
          <%= osuny_label University::Organization.human_attribute_name('country') %>
        </div>
        <div class="col-md-8">
          <p><%= @organization.country_name %></p>
        </div>
      <% end %>
      <% if @organization.geolocated? %>
        <div class="col-md-4">
          <%= osuny_label University::Organization.human_attribute_name('geolocation') %>
        </div>
        <div class="col-md-8">
          <p><%= @organization.geo_point.to_s %></p>
        </div>
      <% end %>

    <% end %>
    <%= osuny_panel University::Organization.human_attribute_name('digital') do %>
      <div class="row pure__row--small">
        <%= osuny_property_show_url @l10n, :url, hide_blank: true %>
        <%= osuny_property_show_text @organization, :phone, hide_blank: true %>
        <%= osuny_property_show_text @organization, :email, hide_blank: true %>
        <%= osuny_property_show_text @l10n, :linkedin, hide_blank: true %>
        <%= osuny_property_show_text @l10n, :twitter, hide_blank: true %>
        <%= osuny_property_show_text @l10n, :mastodon, hide_blank: true %>
      </div>
    <% end %>

    <%= osuny_panel University::Organization.human_attribute_name('legal') do %>
      <div class="row pure__row--small">
        <%= osuny_property_show_text @l10n, :long_name, hide_blank: true %>
        <div class="col-md-4">
          <%= osuny_label University::Organization.human_attribute_name('kind') %>
        </div>
        <div class="col-md-8">
          <p><%= @organization.kind_i18n %></p>
        </div>
        <%= osuny_property_show_text @organization, :siren, hide_blank: true %>
      </div>
    <% end %>
  </div>
</div>

<%= render 'admin/communication/contents/editor', about: @l10n %>

<%= osuny_panel t('university.organization.employees') do %>
  <div class="row g-2 mb-3">
    <% @organization.experiences.ordered.each do |experience| %>
      <%
        person = experience.person
        path = admin_university_person_path(person)
      %>
      <div>
        <div class="<%= osuny_card_classes(horizontal: true) %>">
          <%= osuny_thumbnail_localized person %>
          <div class="card-body">
            <%= osuny_link_localized person, path %>
          </div>
          <div class="card-footer small text-muted">
            <%= "#{experience.from_year} - #{experience.to_year.present? ? experience.to_year : t('today')}" %>
          </div>
        </div>
      </div>
    <% end %>
  </div>
<% end if @organization.experiences.any? %>

<%= render 'admin/application/connections/list', about: @organization %>

<% content_for :action_bar_left do %>
  <%= destroy_link @organization %>
  <%= static_link static_admin_university_organization_path(@organization) %>
<% end %>

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