emory-libraries/dlp-selfdeposit

View on GitHub
app/views/hyrax/my/works/index.html.erb

Summary

Maintainability
Test Coverage
<%# Hyrax v5.0.1 Override - stops turbolinks when new Publication is clicked %>

<% provide :page_title, t("hyrax.admin.sidebar.works") %>

<% provide :head do %>
  <%= rss_feed_link_tag route_set: hyrax %>
  <%= atom_feed_link_tag route_set: hyrax %>
<% end %>

<script>
//<![CDATA[

  <%= render partial: 'scripts', formats: [:js] %>

//]]>
</script>

<% provide :page_header do %>
  <h1><span class="fa fa-file" aria-hidden="true"></span> <%= t("hyrax.admin.sidebar.works") %></h1>
  <% if current_ability.can_create_any_work? %>
    <div class="float-right">
      <% if @create_work_presenter.many? %>
        <% if Flipflop.batch_upload? %>
          <%= link_to(
                t(:'helpers.action.batch.new'),
                '#',
                data: { behavior: "select-work", toggle: 'modal', target: "#worktypes-to-create", 'create-type' => 'batch' },
                class: 'btn btn-primary'
              ) %>
        <% end %>
        <%= link_to(
              t(:'helpers.action.work.new'),
              '#',
              data: { behavior: "select-work", toggle: 'modal', target: "#worktypes-to-create", 'create-type' => 'single' },
              id: 'add-new-work-button',
              class: 'btn btn-primary'
            ) %>
      <% else # simple link to the first work type %>
        <% if Flipflop.batch_upload? %>
          <%= link_to(
              t(:'helpers.action.batch.new'),
              hyrax.new_batch_upload_path(payload_concern: @create_work_presenter.first_model),
              class: 'btn btn-primary'
              ) %>
        <% end %>
        <%= link_to(
              t(:'helpers.action.work.new'),
              new_polymorphic_path([main_app, @create_work_presenter.first_model]),
              id: 'add-new-work-button',
              class: 'btn btn-primary',
              data: { turbolinks: false }
            ) %>
      <% end %>
    </div>
  <% end %>
<% end %>

<div class="row">
  <div class="col-md-12">
    <div class="<%= 'tabs' if current_page?(hyrax.dashboard_works_path(locale: nil)) || @managed_works_count > 0 %>">
      <%= render 'tabs' if current_page?(hyrax.dashboard_works_path(locale: nil)) || @managed_works_count > 0 %>
      <div class="card">
        <div class="card-header">
          <% if current_page?(hyrax.my_works_path(locale: nil)) %>
            <span class="count-display"><%= I18n.t('hyrax.my.count.works.you_own', total_count: @response.total_count).html_safe %></span>
          <% elsif current_page?(hyrax.dashboard_works_path(locale: nil)) && !current_ability.admin? %>
            <span class="count-display"><%= I18n.t('hyrax.my.count.works.you_manage', total_count: @response.total_count).html_safe %></span>
          <% else %>
            <span class="count-display"><%= I18n.t('hyrax.my.count.works.in_repo', total_count: @response.total_count).html_safe %></span>
          <% end %>
        </div>
        <div class="card-body">
          <%= render 'search_header' %>
          <h2 class="sr-only"><%= t('hyrax.my.count.works.works_listing') %></h2>
          <%= render 'document_list' %>

          <%= render 'results_pagination' %>
        </div>
      </div>
    </div>
  </div>
</div>



<%= render '/shared/select_work_type_modal', create_work_presenter: @create_work_presenter if @create_work_presenter.many? %>