From 6839b85f6db2fb78077499a7bc29ee9e6347fb93 Mon Sep 17 00:00:00 2001 From: Trey Pendragon Date: Wed, 20 Nov 2024 13:42:58 -0800 Subject: [PATCH] Add downloadable to bulk edit. Closes #6552 --- app/jobs/bulk_update_job.rb | 3 ++- app/views/bulk_edit/resources_edit.html.erb | 8 ++++++++ spec/features/bulk_edit_spec.rb | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/jobs/bulk_update_job.rb b/app/jobs/bulk_update_job.rb index a7c22c8af..5b0f5da3e 100644 --- a/app/jobs/bulk_update_job.rb +++ b/app/jobs/bulk_update_job.rb @@ -30,7 +30,8 @@ def self.supported_attributes :refresh_remote_metadata, :rights_statement, :visibility, - :pdf_type + :pdf_type, + :downloadable ] end diff --git a/app/views/bulk_edit/resources_edit.html.erb b/app/views/bulk_edit/resources_edit.html.erb index c8909cb25..cc67ecc04 100644 --- a/app/views/bulk_edit/resources_edit.html.erb +++ b/app/views/bulk_edit/resources_edit.html.erb @@ -78,6 +78,14 @@ input_html: { class: 'form-control pdf-type' }, required: false %> +
+
<%= label_tag "downloadable", "User Downloads" %>
+ <%= select_tag :downloadable, + options_from_collection_for_select(ControlledVocabulary.for(:downloadable).all, "value", "label"), + include_blank: "[Do not update]", + input_html: { class: 'form-control downloadable' }, + required: false %> +
<%= label_tag "embargo_date", "Embargo Date" %>
<%= select_tag :embargo_date_action, diff --git a/spec/features/bulk_edit_spec.rb b/spec/features/bulk_edit_spec.rb index 2d848c9b6..35973adca 100644 --- a/spec/features/bulk_edit_spec.rb +++ b/spec/features/bulk_edit_spec.rb @@ -147,6 +147,7 @@ page.check("mark_complete") page.select collection2.title.first, from: "append_collection_ids", visible: false page.select "No PDF", from: "pdf_type", visible: false + page.select "None", from: "downloadable", visible: false accept_alert do click_button("Apply Edits") end @@ -156,6 +157,7 @@ expect(updated.state).to eq ["complete"] expect(updated.member_of_collection_ids).to eq [collection.id, collection2.id] expect(updated.pdf_type).to eq ["none"] + expect(updated.downloadable).to eq ["none"] end it "doesn't add a collection if one isn't picked" do @@ -173,6 +175,8 @@ expect(updated.member_of_collection_ids).to eq [collection.id] # Ensure PDF type doesn't change. expect(updated.pdf_type).to eq ["color"] + # Ensure downloadable doesn't change + expect(updated.downloadable).to eq ["public"] end context "with linked collections" do