LafayetteCollegeLibraries/spot

View on GitHub
app/views/hyrax/dashboard/collections/_show_actions.html.erb

Summary

Maintainability
Test Coverage
<h2 class="sr-only"><%= t('hyrax.collection.actions.header') %></h2>
<% if presenter.collection_featurable? %>
  <%= link_to 'Feature',
              main_app.featured_collection_path(presenter, format: :json),
              data: { behavior: 'feature' },
              class: presenter.display_unfeature_link? ? 'btn btn-default collapse' : 'btn btn-default' %>

  <%= link_to 'Unfeature',
              main_app.featured_collection_path(presenter, format: :json),
              data: { behavior: 'unfeature' },
              class: presenter.display_feature_link? ? 'btn btn-default collapse' : 'btn btn-default' %>
<% end %>

<% if can? :edit, presenter.solr_document %>
    <%= link_to t('hyrax.collection.actions.edit.label'),
                hyrax.edit_dashboard_collection_path(presenter),
                title: t('hyrax.collection.actions.edit.desc'),
                class: 'btn btn-primary' %>
<% end %>

<% if presenter.collection_type_is_nestable? && presenter.user_can_nest_collection? %>
<!-- The user should have deposit access to the parent and read access to the child (the collection we are already showing, so no test is necessary). -->
    <%= button_tag '',
                  class: 'btn btn-primary add-to-collection',
                  title: t("hyrax.collection.actions.nested_subcollection.desc"),
                  type: 'button',
                  data: { nestable: presenter.collection_type_is_nestable?,
                          hasaccess: true } do %>
                  <%= t('hyrax.collection.actions.nested_subcollection.button_label') %>
                <% end %>
<% end %>

<% if can? :destroy, presenter.solr_document %>
    <%= link_to t('hyrax.collection.actions.delete.label'),
                hyrax.dashboard_collection_path(presenter),
                title: t('hyrax.collection.actions.delete.desc'),
                class: 'btn btn-danger',
                data: { confirm: t('hyrax.collection.actions.delete.confirmation'),
                        method: :delete } %>
<% end %>