LafayetteCollegeLibraries/spot

View on GitHub
app/views/hyrax/collections/show.html.erb

Summary

Maintainability
Test Coverage
<% provide :page_title, construct_page_title(@presenter.title) %>
<div class="hyc-container" itemscope itemtype="http://schema.org/CollectionPage">
  <div class="row hyc-header">
    <div class="col-md-12">
      <header class="hyc-banner" style="background-image:url(<%= collection_banner_file_path(@presenter) %>)">
        <div class="hyc-title">
          <h1><%= @presenter.title.first %></h1>
          <%= @presenter.permission_badge unless @presenter.public? %>
        </div>
      </header>
    </div>

    <% if can?(:manage, @presenter.solr_document) %>
      <%= render 'show_actions', presenter: @presenter %>
    <% end %>
  </div>

  <div class="row hyc-body">
    <div class="col-md-10 hyc-description">
      <%= render 'collection_description', presenter: @presenter %>

      <% if @presenter.collection_type_is_nestable? && @presenter.total_parent_collections > 0 %>
          <div class="hyc-blacklight hyc-bl-title">
            <h2>
              <%= t('.parent_collection_header') %> (<%= @presenter.total_parent_collections %>)
            </h2>
          </div>
          <div class="hyc-blacklight hyc-bl-results">
            <%= render 'show_parent_collections', presenter: @presenter %>
          </div>
      <% end %>

      <% unless has_collection_search_parameters? %>
        <div class="collection-metadata">
          <%= render 'show_descriptions', presenter: @presenter %>
        </div>
      <% end %>
    </div>

    <% unless @presenter.logo_record.blank? %>
    <div class="col-md-2">
      <% logo = @presenter.logo_record.first %>
      <% image_html = image_tag(logo[:file_location], class: 'img-responsive', alt: logo[:alttext]) %>
      <% if logo[:linkurl].present? %>
        <%= link_to(logo[:linkurl]) { image_html } %>
      <% else %>
        <%= image_html %>
      <% end %>
      </div>
    <% end %>
  </div>

  <!-- Search results label -->
  <% if @members_count > 0 || @presenter.subcollection_count > 0 %>
    <div class="hyc-blacklight hyc-bl-title">
      <h2>
        <% if has_collection_search_parameters? %>
            <%= t('hyrax.dashboard.collections.show.search_results') %>
        <% end %>
      </h2>
    </div>
  <% end %>

  <!-- Search bar -->
  <div class="hyc-blacklight hyc-bl-search hyc-body row">
    <div class="col-sm-8">
      <%= render 'search_form', presenter: @presenter, url: hyrax.collection_path(@presenter.id) %>
    </div>
  </div>

  <!-- Subcollections -->
  <% if @presenter.collection_type_is_nestable? && @subcollection_count > 0 %>
      <div class="hyc-blacklight hyc-bl-title">
        <h4><%= t('.subcollection_count') %> (<%= @subcollection_count %>)</h4>
      </div>
      <div class="hyc-blacklight hyc-bl-results">
        <%= render 'subcollection_list', collection: @subcollection_docs %>
      </div>
  <% end %>

  <!-- Works -->
  <% if @members_count > 0 %>
      <div class="hyc-blacklight hyc-bl-title">
        <h4><%= t('.works_in_collection') %> (<%= @members_count %>)</h4>
      </div>

      <div class="hyc-blacklight hyc-bl-sort">
        <%= render 'sort_and_per_page', collection: @presenter %>
      </div>

      <div class="hyc-blacklight hyc-bl-results">
        <%= render_document_index @member_docs %>
      </div>

      <div class="hyc-blacklight hyc-bl-pager">
        <%= render 'paginate' %>
      </div>
  <% end # if @members_count > 0 %>
</div>