-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgrade from Bulkrax 2.3.0 to 8.0.0, no configuration just yet * Fixes uploads-with-files issue by pointing to bulkrax branch * Work in Progress - tasks to ingest ProQuest ETD zips * WIP - next need to create CSV from array of metadata hashes * WIP - fixed problem creating header row * Fixed embargo logic; fixed CSV structure * Eliminated folder names from metadata csv FileSet entries; copy files to bulkrax zip staging directory, but will need to segregate files from each ETD into separate directoroes * Adds 'bulkrax_identifier' metadata; fixes imports of works w/files, using prerelease of next bulkrax release. * implemented parent work/child FileSet bulkrax_identifier, repaired embargo attributes * refactor file paths for extracted zip; parse creator/contributors * Repair attachment filenames with spaces (or else bulkrax will); fix author parsing * Add degree, advisors, committee members * Add gw_affiliation, date_created * Simplify embargo date; add rights statement; clean up * Fix truncated file; clarify configs, set default rights * Update bulkrax hash, now contains db migration fix * Code cleanup for PR * Add scholarspace-ingest directory and volume mapping * Add mapping for scholarspace-ingest directory * Add CI directive to create ingest folder * Upgrade Bulkrax to 8.1.0 * Allow admin user to visit /importers and /exporters even when there isn't yet an admin set for admin to deposit to * Add fixture zips for bulkrax rspec testing * Add sidekiq inline testing setting * Set testing queue for inline sidekiq * Modify ingest_bulkrax_prep when in test mode * Add bulkrax importer tests * Simplify bulkrax tests * Populates degree and resource_type. License is still WIP, pending input from ScholComm * Added resource_type field * updated Gemfile.lock * Re-apply bulkrax 5.5.1 changes * Upgrade bulkrax to 6.0.1 * Added display of license field; deprecated previous field; added new field * Fixed merge error in Gemfile * moved patch to folder that mirrors Hyrax repo location * Added rake task to update license field * Revised bulkrax spec test to use ENV variable for temp file path * Added tests * Fixed tests to use temp directory from environment * Fixed license & bulkrax tests* --------- Co-authored-by: Dan Kerchner <[email protected]> Co-authored-by: Alex Boyd <[email protected]>
- Loading branch information
1 parent
5dfd206
commit 509f225
Showing
9 changed files
with
121 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Hyrax | ||
module QaSelectServicePatch | ||
def include_current_value(value, _index, render_options, html_options) | ||
unless value.blank? || active?(value) | ||
html_options[:class][-1] += ' force-select' | ||
render_options += [[label(value) { value }, value]] | ||
end | ||
[render_options, html_options] | ||
end | ||
end | ||
end | ||
Hyrax::QaSelectService.prepend Hyrax::QaSelectServicePatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'rake' | ||
|
||
namespace :gwss do | ||
desc 'Replace license value for deprecated Europeana license' | ||
|
||
task :replace_license_value => :environment do | ||
old_value = 'http://www.europeana.eu/portal/rights/rr-r.html' | ||
new_value = 'All rights reserved' | ||
|
||
# Since the text field (tesim) doesn't allow exact searching we do an additional filter just to be safe | ||
solr_results(old_value).each do |doc| | ||
work = ActiveFedora::Base.find(doc['id']) # Retrieve the Fedora object | ||
work.license = work.license.map { |license_value| license_value == old_value ? new_value : license_value } # Update the Fedora object | ||
work.save | ||
end | ||
end | ||
end | ||
|
||
def solr_results(old_value) | ||
# Retrieve paginated results if necessary for records with the old value in the license field | ||
params = {:q => "license_tesim:#{old_value}", fl:'id,license_tesim'} | ||
docs = ActiveFedora::SolrService.instance.conn.paginate(1, 1000, 'select', :params => params).dig('response', 'docs') | ||
p = 2 | ||
while (next_page = ActiveFedora::SolrService.instance.conn.paginate(p, 1000, 'select', :params => params).dig('response', 'docs')) != [] | ||
docs += next_page | ||
p += 1 | ||
end | ||
docs | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe "View and edit license field" do | ||
|
||
let(:solr) { Blacklight.default_index.connection } | ||
let(:admin_set) { FactoryBot.create(:admin_set) } | ||
|
||
let(:content_admin_user) { FactoryBot.create(:content_admin) } | ||
|
||
let(:work_with_license) { FactoryBot.create(:public_work, | ||
admin_set: admin_set, | ||
user: content_admin_user) } | ||
|
||
let(:another_license_value) { Hyrax::QaSelectService.new('licenses').select_active_options.first.first } | ||
|
||
before do | ||
ActiveFedora::Cleaner.clean! | ||
solr.delete_by_query("*:*") | ||
|
||
solr.add(work_with_license.to_solr) | ||
|
||
solr.commit | ||
end | ||
|
||
after do | ||
ActiveFedora::Cleaner.clean! | ||
solr.delete_by_query("*:*") | ||
solr.commit | ||
end | ||
|
||
context 'as a user looking at a work bearing a license' do | ||
it 'can view the license field' do | ||
visit "/concern/gw_works/#{work_with_license.id}" | ||
expect(page).to have_content(work_with_license.license.first) | ||
end | ||
end | ||
context 'as a content-admin user' do | ||
before :each do | ||
sign_in_user(content_admin_user) | ||
end | ||
|
||
it 'can edit the work containing the license field' do | ||
visit "/concern/gw_works/#{work_with_license.id}/edit" | ||
page.select another_license_value, :from => "gw_work_license" | ||
page.click_on("Save changes") | ||
expect(page).to have_content(another_license_value) | ||
end | ||
end | ||
|
||
end |