From b0ea9b35fad1d042031141c6b6fc7281eab81f29 Mon Sep 17 00:00:00 2001 From: Corey Gillen Date: Wed, 8 Jul 2026 15:22:38 -0700 Subject: [PATCH] Turn approve/reapprove/tombstone into a switch --- app/views/hyrax/base/_show_actions.html.erb | 13 ++++++++++--- config/locales/hyrax.en.yml | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/views/hyrax/base/_show_actions.html.erb b/app/views/hyrax/base/_show_actions.html.erb index c69159847..e7d107efc 100644 --- a/app/views/hyrax/base/_show_actions.html.erb +++ b/app/views/hyrax/base/_show_actions.html.erb @@ -72,15 +72,22 @@
- <% if @presenter.workflow.actions.present? && @presenter.solr_document['workflow_state_name_ssim']&.first&.capitalize == 'Deposited' %> + <% workflow_state = @presenter.solr_document['workflow_state_name_ssim']&.first&.downcase %> + <% workflow_actions = @presenter.workflow.actions %> + <% if workflow_actions.present? && workflow_state == 'deposited' %> <%= form_tag main_app.hyrax_workflow_action_path(presenter), method: :put do %> <%= hidden_field :workflow_action, :name, value: 'tombstone' %> '> <% end %> - <% else %> + <% elsif workflow_actions.present? && workflow_state == 'tombstoned' %> <%= form_tag main_app.hyrax_workflow_action_path(presenter), method: :put do %> <%= hidden_field :workflow_action, :name, value: 'approve' %> - ' <%= disabled='disabled' unless (@presenter.solr_document['workflow_state_name_ssim']&.first&.capitalize == 'Tombstoned' && current_user.admin?) %>> + ' <%= disabled='disabled' unless current_user.admin? %>> + <% end %> + <% elsif workflow_actions.present? && workflow_state != 'approved' %> + <%= form_tag main_app.hyrax_workflow_action_path(presenter), method: :put do %> + <%= hidden_field :workflow_action, :name, value: 'approve' %> + ' <%= disabled='disabled' unless current_user.admin? %>> <% end %> <% end %>
diff --git a/config/locales/hyrax.en.yml b/config/locales/hyrax.en.yml index 97e482b7b..f2942391a 100644 --- a/config/locales/hyrax.en.yml +++ b/config/locales/hyrax.en.yml @@ -225,6 +225,7 @@ en: content_warning: content_alert: 'This material contains content or imagery that may be harmful or difficult for some users. By clicking the ‘I Understand’ button you are acknowledging that you have been informed about the content you will view.' workflow: + approve: 'Are you sure you want to approve this item?' tombstoned: "This item has been deleted. It is no longer available." tombstone: confirmation: 'Are you sure you want to tombstone this item?'