osunyorg/admin

View on GitHub
app/views/server/universities/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @university %>
<% content_for :title_right do %>
  <%= link_to @university.url, @university.url, target: :_blank %>
<% end %>

<div class="row">
  <div class="col-xl-6">
    <div class="table-responsive">
      <table class="<%= table_classes %>">
        <% ['private', 'is_really_a_university'].each do |attribute| %>
          <tr>
            <td><%= University.human_attribute_name(attribute) %></td>
            <td class="text-end"><%= t(@university.public_send attribute) %></td>
          </tr>
        <% end %>
        <tr>
          <td><%= Language.model_name.human(count: @university.languages.count) %></td>
          <td class="text-end"><%= @university.languages.ordered.join(', ') %></td>
        </tr>
        <tr>
          <td><%= t('server_admin.universities.users_count') %></td>
          <td class="text-end"><%= link_to @university.users.not_server_admin.count, "#{@university.url}/admin/users", target: :_blank %></td>
        </tr>

        <% unless @university.contribution_amount.to_i.zero? %>
          <tr class="<%= @university.invoice_proximity.blank? ? '' : "table-#{@university.invoice_proximity}" %>">
            <td><%= University.human_attribute_name('invoice_date') %></td>
            <td class="text-end"><%= l(@university.invoice_date, format: "%d %B") if @university.invoice_date %></td>
          </tr>
          <tr class="<%= @university.invoice_proximity.blank? ? '' : "table-#{@university.invoice_proximity}" %>">
            <td><%= University.human_attribute_name('contribution_amount') %></td>
            <td class="text-end"><%= number_to_currency @university.contribution_amount, precision: 0, locale: :fr %></td>
          </tr>
        <% end %>
      </table>
    </div>
  </div>
  <div class="col-xl-6">
    <div class="table-responsive">
      <table class="<%= table_classes %>">
        <% ['address', 'zipcode', 'city', 'country'].each do |attribute| %>
          <tr>
            <td><%= University.human_attribute_name(attribute) %></td>
            <td class="text-end"><%= @university.public_send attribute %></td>
          </tr>
        <% end %>
      </table>
    </div>
  </div>
</div>

<h2 class="mt-5 h3"><%= Communication::Website.model_name.human(count: @websites.total_count) %></h2>
<%= render 'server/websites/list', websites: @websites %>
<%= paginate @websites %>

<% content_for :action_bar_right do %>
  <%= link_to t('edit'), edit_server_university_path(@university), class: button_classes %>
<% end %>