UNC-Libraries/hy-c

View on GitHub
app/views/hyrax/base/_items.html.erb

Summary

Maintainability
Test Coverage
<%# [hyc-override] Overriding to hide withdrawn files %>
<% if current_user&.admin? || (@presenter.respond_to?('workflow') && !@presenter.workflow.in_workflow_state?(['withdrawn', 'pending deletion']) ) %>
  <%  array_of_ids = presenter.list_of_item_ids_to_display %>
  <%  members = presenter.member_presenters_for(array_of_ids) %>
  <% if members.present? %>
    <table class="table table-striped related-files">
      <thead>
      <tr>
        <th><%= t('.thumbnail') %></th>
        <th><%= t('.title') %></th>
        <th><%= t('.date_uploaded') %></th>
        <th><%= t('.visibility') %></th>
        <th><%= t('.actions') %></th>
      </tr>
      </thead>
      <tbody>
      <%= render partial: 'member', collection: members %>
      </tbody>
    </table>
    <div class="row">
      <% if presenter.total_pages > 1 %>
        <div class="row record-padding col-md-9">
          <%= paginate array_of_ids, outer_window: 2, theme: 'blacklight', param_name: :page, route_set: main_app %>
        </div><!-- /pager -->
      <% end %>
    </div>
    <%# [hyc-override] Overriding to show different warning for art works %>
  <% elsif params.key?('controller') && params[:controller] == 'hyrax/artworks' && (can? :edit, presenter.id) %>
    <div class="alert alert-warning" role="alert"><%= t('.empty_artwork', type: presenter.human_readable_type) %></div>
  <% elsif can? :edit, presenter.id %>
    <div class="alert alert-warning" role="alert"><%= t('.empty', type: presenter.human_readable_type) %></div>
  <% else %>
    <div class="alert alert-warning" role="alert"><%= t('.unauthorized', type: presenter.human_readable_type) %></div>
  <% end %>
<% end %>