From a28cf5e2ae9a24f252c5a7f2064e1075ebc541bb Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Fri, 12 Jan 2024 16:14:19 -0500 Subject: [PATCH] Match Hyrax version with addition of delete perms --- app/views/hyrax/base/_show_actions.html.erb | 67 ++++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/app/views/hyrax/base/_show_actions.html.erb b/app/views/hyrax/base/_show_actions.html.erb index 324fa48af..8638fa49d 100644 --- a/app/views/hyrax/base/_show_actions.html.erb +++ b/app/views/hyrax/base/_show_actions.html.erb @@ -1,18 +1,40 @@ -<%# OVERRIDE Hyrax v5.0.0rc2 Adjust permission checks and add analytics button %> -
- <% if presenter.editor? %> - <%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary' %> - <%# OVERRIDE: wrap Delete button in #can? check %> - <% if current_ability.can?(:delete, presenter.solr_document) %> - <%= link_to "Delete", [main_app, presenter], class: 'btn btn-danger', data: { confirm: "Delete this #{presenter.human_readable_type}?" }, method: :delete %> +<%# OVERRIDE Hyrax v5.0.0rc2 Adjust permission checks for delete %> +
+
+ <% if !workflow_restriction?(presenter) %> + <% if presenter.show_deposit_for?(collections: @user_collections) %> + + <%= button_tag t('hyrax.dashboard.my.action.add_to_collection'), + class: 'btn btn-secondary submits-batches submits-batches-add', + data: { toggle: "modal", target: "#collection-list-container" } %> <% end %> - <% if presenter.member_presenters.size > 1 %> + <% if presenter.work_featurable? %> + <%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json), + data: { behavior: 'feature' }, + class: presenter.display_feature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %> + + <%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json), + data: { behavior: 'unfeature' }, + class: presenter.display_unfeature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %> + <% end %> + <% end %> + <% if Hyrax.config.analytics? %> + <% # turbolinks needs to be turned off or the page will use the cache and the %> + <% # analytics graph will not show unless the page is refreshed. %> + <%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %> + <% end %> +
+ +
+ <% if presenter.editor? && !workflow_restriction?(presenter) %> + <%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-secondary' %> + <% if presenter.member_count > 1 %> <%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-secondary' %> <% end %> <% if presenter.valid_child_concerns.length > 0 %>
+ <%= t('.attach_child') %>
<% end %> - <% end %> - <% if presenter.show_deposit_for?(collections: @user_collections) %> - - <%= button_tag t('hyrax.dashboard.my.action.add_to_collection'), - class: 'btn btn-secondary submits-batches submits-batches-add', - data: { toggle: "modal", target: "#collection-list-container" } %> - <% end %> - <% if presenter.work_featurable? %> - <%= link_to "Feature", hyrax.featured_work_path(presenter, format: :json), - data: { behavior: 'feature' }, - class: presenter.display_unfeature_link? ? 'btn btn-secondary collapse' : 'btn btn-secondary' %> - - <%= link_to "Unfeature", hyrax.featured_work_path(presenter, format: :json), - data: { behavior: 'unfeature' }, - class: presenter.display_feature_link? ? 'btn btn-secondary collapse' : 'btn btn-secondary' %> - <% end %> - <% if Hyrax.config.analytics? %> - <% # turbolinks needs to be turned off or the page will use the cache and the %> - <% # analytics graph will not show unless the page is refreshed. %> - <%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %> - <% end %> + <%# OVERRIDE to validate delete permission %> + <% if current_ability.can?(:delete, presenter.solr_document) %> + <%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %> + <% end %> + <% end %> +