Skip to content

Commit

Permalink
Merge 25a62cb into 4d6744b
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoviola committed Jan 15, 2020
2 parents 4d6744b + 25a62cb commit 08b6146
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 80 deletions.
4 changes: 4 additions & 0 deletions app/controllers/sc_collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def import
render 'explore_manifest', at_id: at_id
end
rescue => e
puts "ERROR: source: #{params[:source]}"
puts "ERROR: source_url: #{params[:source_url]}"
puts "ERROR: ScCollectionsController#import: #{e.message}"
puts "ERROR: ScCollectionsController#import: #{e}"
case params[:source]
when 'contentdm'
flash[:error] = "No IIIF manifest exists for CONTENTdm item #{params[:source_url]}"
Expand Down
4 changes: 4 additions & 0 deletions app/views/collection/new.html.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.litebox-embed(style="width:550px")
h1 Create New Collection

- if current_user.account_type == "Individual Researcher" && current_user.collections.count >= 1
p(style="color: #FF0000") Individual Researcher Accounts are limited to a single collection. To upgrade your account, contact support@fromthepage.com.

p To create a new collection please start from entering the collection title. On the next step you will be able to add works into the collection.

=form_for(@collection, url: { :action => 'create' }) do |f|
Expand Down
26 changes: 0 additions & 26 deletions spec/features/import_data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,10 @@

context "CONTENTdm" do

let(:item_url) { 'https://cdm16488.contentdm.oclc.org/digital/collection/MPD01/id/2' }
let(:collection_url){ 'https://cdm16488.contentdm.oclc.org/digital/collection/MPD01' }
let(:repository_url){ 'https://cdm16488.contentdm.oclc.org/' }
let(:bad_item_url) { 'https://cdm16488.contentdm.oclc.org/digital/collection/MPD01/id/1' }

it "browses a single record", :js => true do
owner = User.first
login_as(owner, :scope => :user)
visit dashboard_owner_path
page.find('.tabs').click_link("Start A Project")
page.find(:css, "#import-contentdm").click
VCR.use_cassette('cdm/midpoint-shelwater-item') do
page.fill_in 'cdm_url', with: item_url
page.find('#cdm_import').click
end
expect(page).to have_content("Manifest: Letter with envelope from Virginia Shewalter")
end
it "browses records from a collection", :js => true do
owner = User.first
login_as(owner, :scope => :user)
Expand All @@ -52,18 +39,5 @@
end
expect(page).to have_content("Collections:")
end
it "Gives an error for a well-formed Cdm URL with a bad/empty IIIF manifest", :js => true do
owner = User.first
login_as(owner, :scope => :user)
visit dashboard_owner_path
page.find('.tabs').click_link("Start A Project")
page.find(:css, "#import-contentdm").click
VCR.use_cassette('cdm/bad_iiif_manifest') do
page.fill_in 'cdm_url', with: bad_item_url
page.find('#cdm_import').click
end
flash_message = "No IIIF manifest exists for CONTENTdm item #{bad_item_url}"
expect(page).to have_content(flash_message)
end
end
end
13 changes: 13 additions & 0 deletions spec/features/owner_actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,18 @@
expect(rtl_collection.text_language).to eq 'eng'
end

it "warns if account type is Individual Researcher" do
@owner.account_type = "Individual Researcher"
visit dashboard_owner_path
page.find('a', text: 'Create a Collection').click
expect(@owner.collections.count).to be >= 1
expect(page).to have_content("Individual Researcher Accounts are limited to a single collection.")
end

it "does not warn with another account type" do
@owner.account_type = "Trial"
visit dashboard_owner_path
page.find('a', text: 'Create a Collection').click
expect(page).not_to have_content("Individual Researcher Accounts are limited to a single collection.")
end
end
54 changes: 0 additions & 54 deletions spec/http-mocks/cdm/bad_iiif_manifest.yml

This file was deleted.

0 comments on commit 08b6146

Please sign in to comment.