popolo-project/popolo-engine

View on GitHub
app/views/popolo/organizations/show.html.erb

Summary

Maintainability
Test Coverage
<nav>
  <ol class="breadcrumb">
    <li><%= link_to Popolo::Organization.model_name.human(count: Float::INFINITY), organizations_path %></li>
    <% @organization.ancestors.each do |ancestor| %>
      <li><%= link_to ancestor, ancestor %></li>
    <% end %>
    <li class="active"><%= @organization %></li>
  </ol>
</nav>

<section>
  <header class="page-header">
    <div class="media">
      <div class="pull-left">
        <% if @organization.image %>
          <div class="media-object popolo-circle" style="background-image: url(<%= @organization.image %>)">
          </div>
        <% end %>
      </div>
      <div class="media-body">
        <h1 class="media-heading">
          <%= @organization %>
        </h1>
      </div>
    </div>
  </header>

  <dl>
    <% if @organization.classification? %>
      <dt><%= Popolo::Organization.human_attribute_name(:classification) %></dt>
      <dd><%=t @organization.classification, count: 1, scope: [:popolo, :organizations, :classifications], default: @organization.classification %></dd>
    <% end %>
    <% if @organization.founding_date? %>
      <dt><%= Popolo::Organization.human_attribute_name(:founding_date) %></dt>
      <dd><%=l @organization.founding_date %></dd>
    <% end %>
    <% if @organization.dissolution_date? %>
      <dt><%= Popolo::Organization.human_attribute_name(:dissolution_date) %></dt>
      <dd><%=l @organization.dissolution_date %></dd>
    <% end %>
  </dl>

  <aside>
    <% unless @organization.contact_details.empty? %>
      <section>
        <header>
          <h2><%= Popolo::ContactDetail.model_name.human(count: @organization.contact_details.size) %></h2>
        </header>
        <dl class="dl-horizontal">
          <%= render @organization.contact_details %>
        </dl>
      </section>
    <% end %>
    <% unless @organization.other_names.empty? %>
      <section>
        <header>
          <h2><%= Popolo::OtherName.model_name.human(count: @organization.other_names.size) %></h2>
        </header>
        <ul>
          <%= render @organization.other_names %>
        </ul>
      </section>
    <% end %>
    <% unless @organization.identifiers.empty? %>
      <section>
        <header>
          <h2><%= Popolo::Identifier.model_name.human(count: @organization.identifiers.size) %></h2>
        </header>
        <dl class="dl-horizontal">
          <%= render @organization.identifiers %>
        </dl>
      </section>
    <% end %>
    <% unless @organization.links.empty? %>
      <section>
        <header>
          <h2><%= Popolo::Link.model_name.human(count: @organization.links.size) %></h2>
        </header>
        <ul>
          <%= render @organization.links %>
        </ul>
      </section>
    <% end %>
    <% unless @organization.sources.empty? %>
      <section>
        <header>
          <h2><%=t 'popolo/source', count: @organization.sources.size, scope: [:popolo]  %></h2>
        </header>
        <ul>
          <%= render @organization.sources %>
        </ul>
      </section>
    <% end %>
  </aside>

  <aside>
    <% unless @organization.memberships.empty? %>
      <section>
        <header>
          <h2>
            <%= Popolo::Membership.model_name.human(count: @organization.memberships.size) %>
          </h2>
        </header>
        <ol>
          <% @organization.memberships.each do |membership| %>
            <li>
              <%= link_to membership.to_s(format: :person), membership %>
            </li>
          <% end %>
        </ol>
      </section>
    <% end %>
    <% unless @organization.posts.empty? %>
      <section>
        <header>
          <h2>
            <%= Popolo::Post.model_name.human(count: @organization.posts.size) %>
          </h2>
        </header>
        <ol>
          <% @organization.posts.each do |post| %>
            <li>
              <%= link_to post, post %>
            </li>
          <% end %>
        </ol>
      </section>
    <% end %>
    <% unless @organization.children.empty? %>
      <section>
        <header>
          <h2>
            <%= Popolo::Organization.model_name.human(count: @organization.children.size) %>
          </h2>
        </header>
        <ol>
          <% @organization.children.each do |organization| %>
            <li>
              <%= link_to organization, organization %>
            </li>
          <% end %>
        </ol>
      </section>
    <% end %>
  </aside>
</section>