Skip to content

Commit

Permalink
Merge pull request #6553 from pulibrary/user_download
Browse files Browse the repository at this point in the history
Add downloadable to bulk edit.
  • Loading branch information
tpendragon authored Nov 20, 2024
2 parents 237b85f + 6839b85 commit 0afeda8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/jobs/bulk_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def self.supported_attributes
:refresh_remote_metadata,
:rights_statement,
:visibility,
:pdf_type
:pdf_type,
:downloadable
]
end

Expand Down
8 changes: 8 additions & 0 deletions app/views/bulk_edit/resources_edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
input_html: { class: 'form-control pdf-type' },
required: false %>
</div>
<div class="row">
<div class="col-sm-2"><%= label_tag "downloadable", "User Downloads" %></div>
<%= 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 %>
</div>
<div class="row">
<div class="col-sm-2"><%= label_tag "embargo_date", "Embargo Date" %></div>
<%= select_tag :embargo_date_action,
Expand Down
4 changes: 4 additions & 0 deletions spec/features/bulk_edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0afeda8

Please sign in to comment.