UNC-Libraries/hy-c

View on GitHub
app/views/hyrax/my/_work_action_menu.html.erb

Summary

Maintainability
Test Coverage
<%# [hyc-override] https://github.com/samvera/hyrax/tree/hyrax-v4.0.0/app/views/hyrax/my/_work_action_menu.html.erb %>
<% ul_id = 'admin-set-action-dropdown-ul-' + document.id %>

<div class="btn-group">

  <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" type="button" id="dropdownMenu_<%= document.id %>" aria-haspopup="true" aria-expanded="false" aria-controls="<%= ul_id %>">
    <span class="sr-only"><%= t("hyrax.dashboard.my.sr.press_to") %> </span>
    <%= t("hyrax.dashboard.my.action.select") %>
  </button>

  <ul role="menu" id="<%= ul_id %>" class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu_<%= document.id %>">

    <% if can? :edit, document.id %>
      <li class="dropdown-item" role="menuitem" tabindex="-1">
        <%= link_to [main_app, :edit, document],
                    id: 'action-edit-work' do %>
          <%= t("hyrax.dashboard.my.action.edit_work") %>
        <% end %>
      </li>

      <li class="dropdown-item" role="menuitem" tabindex="-1">
        <%= link_to [main_app, document],
                    method: :delete,
                    id: 'action-delete-work',
                    data: {
                      confirm: t("hyrax.dashboard.my.action.work_confirmation", application_name: application_name) } do %>
          <%= t("hyrax.dashboard.my.action.delete_work") %>
        <% end %>
      </li>
    <% end %>

    <%# [hyc-override] Remove the option to feature on profile page, as we don't use profiles %>
    <%# <li class="dropdown-item" role="menuitem" tabindex="-1"> %>
      <%#= display_trophy_link(current_user, document.id) do |text| %>
        <%#= text %>
      <%# end %>
    <%# </li> %>

    <% if can? :transfer, document.id %>
      <li class="dropdown-item" role="menuitem" tabindex="-1">
        <%= link_to(hyrax.new_work_transfer_path(document.id), id: 'action-transfer-work', class: 'itemicon itemtransfer', title: t("hyrax.dashboard.my.action.transfer")) do %>
          <%= t("hyrax.dashboard.my.action.transfer") %>
        <% end %>
      </li>
    <% end %>
  </ul>
</div>