blacklight-spotlight 0.32.0 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/assets/images/spotlight/default_browse_thumbnail.jpg +0 -0
- data/app/assets/javascripts/spotlight/application.js +6 -1
- data/app/assets/javascripts/spotlight/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/blocks/resources_block.js +7 -4
- data/app/assets/javascripts/spotlight/blocks/solr_documents_base_block.js +108 -0
- data/app/assets/javascripts/spotlight/blocks/solr_documents_block.js +12 -56
- data/app/assets/javascripts/spotlight/blocks/solr_documents_carousel_block.js +3 -3
- data/app/assets/javascripts/spotlight/blocks/solr_documents_embed_block.js +3 -3
- data/app/assets/javascripts/spotlight/blocks/solr_documents_features_block.js +3 -3
- data/app/assets/javascripts/spotlight/blocks/solr_documents_grid_block.js +3 -3
- data/app/assets/javascripts/spotlight/crop.es6 +205 -0
- data/app/assets/javascripts/spotlight/croppable.js +7 -104
- data/app/assets/javascripts/spotlight/iiif.es6 +54 -0
- data/app/assets/javascripts/spotlight/multi_image_selector.js +34 -16
- data/app/assets/javascripts/spotlight/pages.js.erb +1 -1
- data/app/assets/javascripts/spotlight/reindex_monitor.js +5 -1
- data/app/assets/javascripts/spotlight/search_typeahead.js +33 -47
- data/app/assets/javascripts/spotlight/sir-trevor/locales.js +5 -2
- data/app/assets/javascripts/spotlight/zpr_links.js.erb +30 -0
- data/app/assets/stylesheets/spotlight/_croppable.scss +8 -13
- data/app/assets/stylesheets/spotlight/_multi_image_selector.scss +1 -1
- data/app/assets/stylesheets/spotlight/_pages.scss +5 -0
- data/app/assets/stylesheets/spotlight/typeahead.css +0 -1
- data/app/controllers/concerns/spotlight/base.rb +3 -5
- data/app/controllers/spotlight/appearances_controller.rb +6 -4
- data/app/controllers/spotlight/catalog_controller.rb +10 -0
- data/app/controllers/spotlight/contacts_controller.rb +2 -6
- data/app/controllers/spotlight/featured_images_controller.rb +26 -0
- data/app/controllers/spotlight/pages_controller.rb +3 -2
- data/app/controllers/spotlight/resources/iiif_harvester_controller.rb +10 -0
- data/app/controllers/spotlight/resources/upload_controller.rb +4 -3
- data/app/controllers/spotlight/searches_controller.rb +20 -6
- data/app/controllers/spotlight/sites_controller.rb +2 -5
- data/app/helpers/spotlight/application_helper.rb +14 -1
- data/app/helpers/spotlight/crop_helper.rb +37 -0
- data/app/helpers/spotlight/main_app_helpers.rb +13 -0
- data/app/helpers/spotlight/meta_helper.rb +10 -20
- data/app/models/concerns/spotlight/solr_document.rb +1 -2
- data/app/models/concerns/spotlight/solr_document/uploaded_resource.rb +1 -23
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +10 -0
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +10 -0
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +5 -0
- data/app/models/spotlight/analytics/ga.rb +1 -1
- data/app/models/spotlight/blacklight_configuration.rb +16 -8
- data/app/models/spotlight/contact.rb +2 -13
- data/app/models/spotlight/contact_image.rb +11 -0
- data/app/models/spotlight/exhibit.rb +11 -8
- data/app/models/spotlight/exhibit_thumbnail.rb +12 -0
- data/app/models/spotlight/feature_page.rb +3 -5
- data/app/models/spotlight/featured_image.rb +28 -9
- data/app/models/spotlight/home_page.rb +2 -0
- data/app/models/spotlight/masthead.rb +5 -11
- data/app/models/spotlight/page.rb +5 -0
- data/app/models/spotlight/reindex_progress.rb +10 -18
- data/app/models/spotlight/reindexing_log_entry.rb +1 -0
- data/app/models/spotlight/resources/iiif_harvester.rb +33 -0
- data/app/models/spotlight/resources/iiif_manifest.rb +211 -0
- data/app/models/spotlight/resources/iiif_service.rb +93 -0
- data/app/models/spotlight/resources/upload.rb +1 -2
- data/app/models/spotlight/search.rb +5 -34
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +79 -0
- data/app/serializers/spotlight/exhibit_export_serializer.rb +9 -41
- data/app/services/spotlight/carrierwave_file_resolver.rb +3 -1
- data/app/services/spotlight/iiif_resource_resolver.rb +73 -0
- data/app/services/spotlight/resources/iiif_builder.rb +17 -0
- data/app/services/spotlight/upload_solr_document_builder.rb +23 -23
- data/app/uploaders/spotlight/attachment_uploader.rb +0 -48
- data/app/uploaders/spotlight/featured_image_uploader.rb +2 -16
- data/app/views/_user_util_links.html.erb +8 -5
- data/app/views/catalog/_save_search.html.erb +4 -2
- data/app/views/layouts/spotlight/spotlight.html.erb +5 -1
- data/app/views/shared/_masthead.html.erb +1 -1
- data/app/views/spotlight/about_pages/_contact_properties.html.erb +1 -1
- data/app/views/spotlight/appearances/edit.html.erb +26 -6
- data/app/views/spotlight/browse/_search.html.erb +1 -1
- data/app/views/spotlight/contacts/_form.html.erb +12 -7
- data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +1 -1
- data/app/views/spotlight/exhibits/_exhibit_card_front.html.erb +2 -2
- data/app/views/spotlight/featured_images/_form.html.erb +12 -15
- data/app/views/spotlight/featured_images/_upload_form.html.erb +6 -12
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +3 -3
- data/app/views/spotlight/pages/_form.html.erb +3 -3
- data/app/views/spotlight/pages/edit.html.erb +4 -2
- data/app/views/spotlight/resources/iiif/_form.html.erb +9 -0
- data/app/views/spotlight/searches/_form.html.erb +3 -3
- data/app/views/spotlight/searches/_search.html.erb +4 -2
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +7 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +4 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +4 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +4 -2
- data/app/views/spotlight/sites/edit.html.erb +1 -1
- data/config/locales/spotlight.en.yml +31 -6
- data/config/routes.rb +9 -0
- data/db/migrate/20160714144125_add_iiif_urls_to_featured_image.rb +9 -0
- data/db/migrate/20160718194010_add_iiif_url_to_contact.rb +6 -0
- data/db/migrate/20160805143841_add_upload_id_to_resources.rb +6 -0
- data/db/migrate/20170204091234_add_theme_to_spotlight_exhibits.rb +5 -0
- data/lib/generators/spotlight/install_generator.rb +5 -2
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +0 -1
- data/lib/generators/spotlight/templates/spotlight.scss +3 -2
- data/lib/migration/iiif.rb +82 -0
- data/lib/spotlight/engine.rb +22 -10
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +10 -0
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/appearances_controller_spec.rb +31 -18
- data/spec/controllers/spotlight/catalog_controller_spec.rb +40 -0
- data/spec/controllers/spotlight/contacts_controller_spec.rb +20 -1
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +2 -6
- data/spec/controllers/spotlight/featured_images_controller_spec.rb +74 -0
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/searches_controller_spec.rb +3 -1
- data/spec/controllers/spotlight/sites_controller_spec.rb +6 -1
- data/spec/examples.txt +1118 -1059
- data/spec/factories/contact_images.rb +6 -0
- data/spec/factories/contacts.rb +4 -1
- data/spec/factories/exhibit_thumbnails.rb +6 -0
- data/spec/factories/exhibits.rb +4 -0
- data/spec/factories/featured_images.rb +1 -0
- data/spec/factories/resources.rb +2 -1
- data/spec/features/add_contacts_spec.rb +5 -5
- data/spec/features/add_iiif_manifest_spec.rb +41 -0
- data/spec/features/add_items_spec.rb +2 -2
- data/spec/features/autocomplete_typeahead_spec.rb +86 -0
- data/spec/features/browse_category_admin_spec.rb +27 -6
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/create_exhibit_spec.rb +3 -3
- data/spec/features/exhibit_masthead_spec.rb +20 -9
- data/spec/features/exhibit_themes_spec.rb +25 -0
- data/spec/features/home_page_spec.rb +1 -1
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +42 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +5 -3
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/features/javascript/multi_image_select_spec.rb +5 -6
- data/spec/features/javascript/search_config_admin_spec.rb +1 -1
- data/spec/features/site_masthead_spec.rb +14 -4
- data/spec/fixtures/gk446cj2442-manifest.json +58 -0
- data/spec/fixtures/iiif_responses.rb +274 -0
- data/spec/fixtures/sample_solr_documents.yml +106 -0
- data/spec/helpers/spotlight/crop_helper_spec.rb +9 -0
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +45 -0
- data/spec/helpers/spotlight/meta_helper_spec.rb +2 -15
- data/spec/lib/migration/iiif_spec.rb +70 -0
- data/spec/models/spotlight/blacklight_configuration_spec.rb +17 -5
- data/spec/models/spotlight/contact_image_spec.rb +9 -0
- data/spec/models/spotlight/exhibit_spec.rb +17 -20
- data/spec/models/spotlight/exhibit_thumbnail_spec.rb +8 -0
- data/spec/models/spotlight/featured_image_spec.rb +59 -10
- data/spec/models/spotlight/masthead_spec.rb +33 -17
- data/spec/models/spotlight/page_spec.rb +14 -0
- data/spec/models/spotlight/reindex_progress_spec.rb +22 -73
- data/spec/models/spotlight/resources/iiif_harvester_spec.rb +30 -0
- data/spec/models/spotlight/resources/iiif_manifest_spec.rb +107 -0
- data/spec/models/spotlight/resources/iiif_service_spec.rb +52 -0
- data/spec/models/spotlight/resources/upload_spec.rb +7 -3
- data/spec/models/spotlight/search_spec.rb +0 -45
- data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +11 -29
- data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +123 -0
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +4 -0
- data/spec/routing/spotlight/featured_images_spec.rb +21 -0
- data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +15 -18
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +90 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/features/test_features_helpers.rb +3 -2
- data/spec/support/stub_iiif_response.rb +24 -0
- data/spec/support/views/test_view_helpers.rb +1 -0
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/uploaders/spotlight/attachment_uploader_spec.rb +24 -0
- data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +30 -0
- data/spec/views/_user_util_links.html.erb_spec.rb +9 -5
- data/spec/views/shared/_masthead.html.erb_spec.rb +5 -2
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +4 -7
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +7 -2
- data/spec/views/spotlight/pages/edit.html.erb_spec.rb +3 -1
- data/spec/views/spotlight/pages/new.html.erb_spec.rb +3 -1
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +3 -2
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +3 -2
- data/vendor/assets/javascripts/leaflet-areaselect.js +184 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +230 -0
- data/vendor/assets/javascripts/leaflet.js +9 -0
- data/vendor/assets/javascripts/polyfill.min.js +4 -0
- data/vendor/assets/stylesheets/leaflet-areaselect.css +15 -0
- data/vendor/assets/stylesheets/leaflet.css +624 -0
- metadata +136 -62
- data/app/assets/javascripts/spotlight/jcrop.js +0 -1696
- data/app/helpers/spotlight/jcrop_helper.rb +0 -37
- data/app/models/concerns/spotlight/default_thumbnailable.rb +0 -25
- data/app/models/concerns/spotlight/image_derivatives.rb +0 -58
- data/app/models/concerns/spotlight/solr_document/spotlight_images.rb +0 -55
- data/app/uploaders/spotlight/avatar_uploader.rb +0 -24
- data/app/uploaders/spotlight/item_uploader.rb +0 -25
- data/app/uploaders/spotlight/masthead_uploader.rb +0 -22
- data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -33
- data/spec/models/spotlight/default_thumbnailable_concern_spec.rb +0 -16
- data/spec/models/spotlight/image_derivatives_spec.rb +0 -15
- data/spec/models/spotlight/solr_document/spotlight_images_spec.rb +0 -42
- data/spec/uploaders/spotlight/item_uploader_spec.rb +0 -67
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :contact_image, class: Spotlight::ContactImage do
|
3
|
+
image { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'avatar.png'), __dir__)) }
|
4
|
+
iiif_tilesource 'https://exhibits-stage.stanford.edu/images/78'
|
5
|
+
end
|
6
|
+
end
|
data/spec/factories/contacts.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :contact, class: Spotlight::Contact do
|
3
3
|
exhibit
|
4
|
-
|
4
|
+
|
5
|
+
trait :with_avatar do
|
6
|
+
association :avatar, factory: :contact_image
|
7
|
+
end
|
5
8
|
end
|
6
9
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :exhibit_thumbnail, class: Spotlight::ExhibitThumbnail do
|
3
|
+
image { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'avatar.png'), __dir__)) }
|
4
|
+
iiif_tilesource 'https://exhibits-stage.stanford.edu/images/78'
|
5
|
+
end
|
6
|
+
end
|
data/spec/factories/exhibits.rb
CHANGED
@@ -3,5 +3,9 @@ FactoryGirl.define do
|
|
3
3
|
sequence(:title) { |n| "Exhibit Title #{n}" }
|
4
4
|
published true
|
5
5
|
after(:build) { |exhibit| exhibit.searches << FactoryGirl.build(:default_search) }
|
6
|
+
|
7
|
+
trait :with_thumbnail do
|
8
|
+
association :thumbnail, factory: :exhibit_thumbnail
|
9
|
+
end
|
6
10
|
end
|
7
11
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :featured_image, class: Spotlight::FeaturedImage do
|
3
3
|
image { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'avatar.png'), __dir__)) }
|
4
|
+
iiif_tilesource 'https://exhibits-stage.stanford.edu/images/78'
|
4
5
|
end
|
5
6
|
|
6
7
|
factory :masthead, class: Spotlight::Masthead do
|
data/spec/factories/resources.rb
CHANGED
@@ -6,6 +6,7 @@ FactoryGirl.define do
|
|
6
6
|
end
|
7
7
|
factory :uploaded_resource, class: Spotlight::Resources::Upload, parent: :resource do
|
8
8
|
type 'Spotlight::Resources::Upload'
|
9
|
-
|
9
|
+
association :upload, factory: :featured_image
|
10
|
+
# url { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'avatar.png'), __dir__)) }
|
10
11
|
end
|
11
12
|
end
|
@@ -41,19 +41,19 @@ describe 'Add a contact to an exhibit', type: :feature do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "allows the curator to crop the contact's avatar", js: true do
|
44
|
-
skip "
|
44
|
+
skip "Capybara doesn't play well with the image cropper..."
|
45
45
|
|
46
46
|
visit spotlight.exhibit_about_pages_path(exhibit)
|
47
47
|
click_link 'Add contact'
|
48
|
-
|
49
|
-
find('.jcrop-holder')
|
50
|
-
end
|
48
|
+
|
51
49
|
within '#new_contact' do
|
52
50
|
fill_in 'Name', with: 'Pictured User'
|
53
51
|
fill_in 'Email', with: 'marcus@rome.gov'
|
54
|
-
attach_file('
|
52
|
+
attach_file('contact_avatar_attributes_file', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
53
|
+
click_button 'Save'
|
55
54
|
end
|
56
55
|
expect(page).to have_content 'The contact was created.'
|
57
56
|
expect(page).to have_selector 'img.contact-photo'
|
57
|
+
expect(Spotlight::Contact.last.avatar.iiif_url).to be_present
|
58
58
|
end
|
59
59
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'adding IIIF Manifest', type: :feature do
|
4
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
5
|
+
let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
|
6
|
+
before { login_as curator }
|
7
|
+
|
8
|
+
it 'has form to add IIIF Manifests' do
|
9
|
+
visit spotlight.admin_exhibit_catalog_path(exhibit)
|
10
|
+
click_link 'Add items'
|
11
|
+
|
12
|
+
expect(page).to have_link('IIIF URL') # tab name
|
13
|
+
expect(page).to have_css("input[id='resource_url'][type='text']")
|
14
|
+
expect(page).to have_content 'Add the URL of a IIIF manifest or collection'
|
15
|
+
expect(page).to have_button 'Add IIIF items'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'submits the form to create a new item' do
|
19
|
+
expect_any_instance_of(Spotlight::Resource).to receive(:reindex_later).and_return(true)
|
20
|
+
url = 'https://purl.stanford.edu/vw754mr2281/iiif/manifest.json'
|
21
|
+
visit spotlight.admin_exhibit_catalog_path(exhibit)
|
22
|
+
|
23
|
+
click_link 'Add items'
|
24
|
+
fill_in 'URL', with: url
|
25
|
+
|
26
|
+
click_button 'Add IIIF items'
|
27
|
+
|
28
|
+
expect(Spotlight::Resource.last.url).to eq url
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'returns an error message if the URL returned in not a IIIF endpoint' do
|
32
|
+
visit spotlight.admin_exhibit_catalog_path(exhibit)
|
33
|
+
|
34
|
+
click_link 'Add items'
|
35
|
+
fill_in 'URL', with: 'http://example.com'
|
36
|
+
|
37
|
+
click_button 'Add IIIF items'
|
38
|
+
|
39
|
+
expect(page).to have_css('.alert', text: 'Invalid IIIF URL')
|
40
|
+
end
|
41
|
+
end
|
@@ -37,7 +37,7 @@ describe 'Uploading a non-repository item', type: :feature do
|
|
37
37
|
end
|
38
38
|
expect(page).to have_content 'Object uploaded successfully.'
|
39
39
|
|
40
|
-
expect(Spotlight::Resource.last.
|
40
|
+
expect(Spotlight::Resource.last.upload.image.file.path).to end_with '800x600.png'
|
41
41
|
Blacklight.default_index.connection.delete_by_id Spotlight::Resource.last.send(:compound_id)
|
42
42
|
Blacklight.default_index.connection.commit
|
43
43
|
end
|
@@ -98,7 +98,7 @@ describe 'Uploading a non-repository item', type: :feature do
|
|
98
98
|
click_button 'Save'
|
99
99
|
|
100
100
|
expect(page).to have_content 'This is a now an avatar'
|
101
|
-
expect(Spotlight::Resource.last.
|
101
|
+
expect(Spotlight::Resource.last.upload.image.path).to end_with 'avatar.png'
|
102
102
|
Blacklight.default_index.connection.delete_by_id Spotlight::Resource.last.send(:compound_id)
|
103
103
|
Blacklight.default_index.connection.commit
|
104
104
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
describe 'Autocomplete typeahead', type: :feature, js: true do
|
2
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
3
|
+
let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
|
4
|
+
|
5
|
+
before { login_as admin }
|
6
|
+
|
7
|
+
describe 'IIIF Integration' do
|
8
|
+
context 'for items that include a IIIF manifest' do
|
9
|
+
it 'instantiates a cropper and persists all levels of the IIIF manifest' do
|
10
|
+
visit spotlight.edit_exhibit_appearance_path(exhibit)
|
11
|
+
click_link 'Exhibit masthead'
|
12
|
+
|
13
|
+
expect(page).not_to have_css('.leaflet-container')
|
14
|
+
|
15
|
+
check 'Show background image in masthead'
|
16
|
+
|
17
|
+
fill_in_typeahead_field(with: 'gk446cj2442', type: 'featured-image')
|
18
|
+
|
19
|
+
expect(page).to have_css('.leaflet-container', visible: true)
|
20
|
+
|
21
|
+
click_button 'Save changes'
|
22
|
+
|
23
|
+
featured_image = Spotlight::FeaturedImage.last
|
24
|
+
|
25
|
+
expect(featured_image.iiif_manifest_url).to eq 'https://purl.stanford.edu/gk446cj2442/iiif/manifest.json'
|
26
|
+
expect(featured_image.iiif_canvas_id).to eq 'https://purl.stanford.edu/gk446cj2442/iiif/canvas/gk446cj2442_1'
|
27
|
+
expect(featured_image.iiif_image_id).to eq 'https://purl.stanford.edu/gk446cj2442/iiif/annotation/gk446cj2442_1'
|
28
|
+
expect(featured_image.iiif_tilesource).to eq 'https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001/info.json'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'instantiates the multi-image selector when an multi-image item is chosen in the typeahead (and again on edit)' do
|
32
|
+
# Poltergeist doesn't play nice with croppers behind tabs. This is not the case in real browsers
|
33
|
+
allow(Spotlight::Engine.config).to receive(:exhibit_themes).and_return(['default'])
|
34
|
+
|
35
|
+
visit spotlight.edit_exhibit_appearance_path(exhibit)
|
36
|
+
|
37
|
+
check 'Show background image in masthead'
|
38
|
+
|
39
|
+
fill_in_typeahead_field(with: 'xd327cm9378', type: 'featured-image')
|
40
|
+
|
41
|
+
expect(page).to have_css('[data-panel-image-pagination]', text: /Image 1 of 2/, visible: true)
|
42
|
+
|
43
|
+
# Open the multi-image selector and choose the last one
|
44
|
+
click_link('Change')
|
45
|
+
all('.thumbs-list li').last.click
|
46
|
+
expect(page).to have_css('.leaflet-container', visible: true)
|
47
|
+
|
48
|
+
click_button 'Save changes'
|
49
|
+
|
50
|
+
expect(page).to have_content('The exhibit was successfully updated.')
|
51
|
+
|
52
|
+
expect(page).to have_css('[data-panel-image-pagination]', text: /Image 2 of 2/, visible: true)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'removes the multi-image selector when a non multi-image item is selected' do
|
56
|
+
visit spotlight.edit_exhibit_appearance_path(exhibit)
|
57
|
+
click_link 'Exhibit masthead'
|
58
|
+
|
59
|
+
fill_in_typeahead_field(with: 'xd327cm9378', type: 'featured-image')
|
60
|
+
|
61
|
+
expect(page).to have_css('[data-panel-image-pagination]', text: /Image 1 of 2/, visible: true)
|
62
|
+
|
63
|
+
fill_in_typeahead_field(with: 'gk446cj2442', type: 'featured-image')
|
64
|
+
|
65
|
+
expect(page).not_to have_css('[data-panel-image-pagination]', text: /Image 1 of 2/)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'for items that do not include a IIIF manifest' do
|
70
|
+
before do
|
71
|
+
allow(Spotlight::Engine.config).to receive(:iiif_manifest_field).and_return('not_a_real_field')
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'provides an alert informing the user that they cannot crop from that item' do
|
75
|
+
visit spotlight.edit_exhibit_appearance_path(exhibit)
|
76
|
+
click_link 'Exhibit masthead'
|
77
|
+
|
78
|
+
expect(page).not_to have_css('[data-behavior="non-iiif-alert"]', visible: true)
|
79
|
+
|
80
|
+
fill_in_typeahead_field(with: 'gk446cj2442', type: 'featured-image')
|
81
|
+
|
82
|
+
expect(page).to have_css('[data-behavior="non-iiif-alert"]', visible: true)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -9,6 +9,27 @@ describe 'Browse Category Administration', type: :feature do
|
|
9
9
|
expect(page).to have_css('.panel .search .title', text: search.title)
|
10
10
|
end
|
11
11
|
end
|
12
|
+
describe 'create' do
|
13
|
+
it 'creates a new browse category with the current search parameters', js: true do
|
14
|
+
visit spotlight.search_exhibit_catalog_path(exhibit, q: 'xyz')
|
15
|
+
click_button 'Save this search'
|
16
|
+
expect(page).to have_css('#save-modal')
|
17
|
+
fill_in 'search_title', with: 'Some search'
|
18
|
+
expect do
|
19
|
+
click_button 'Save'
|
20
|
+
exhibit.searches.reload
|
21
|
+
end.to change { exhibit.searches.count }.by 1
|
22
|
+
expect(exhibit.searches.last.query_params).to eq 'q' => 'xyz'
|
23
|
+
end
|
24
|
+
it 'updates an existing browse category with the current search parameters', js: true do
|
25
|
+
visit spotlight.search_exhibit_catalog_path(exhibit, q: 'xyz')
|
26
|
+
click_button 'Save this search'
|
27
|
+
expect(page).to have_css('#save-modal')
|
28
|
+
select search.title, from: 'id'
|
29
|
+
click_button 'Save'
|
30
|
+
expect(search.reload.query_params).to eq 'q' => 'xyz'
|
31
|
+
end
|
32
|
+
end
|
12
33
|
describe 'edit' do
|
13
34
|
it 'displays an edit form' do
|
14
35
|
visit spotlight.edit_exhibit_search_path(exhibit, search)
|
@@ -27,7 +48,10 @@ describe 'Browse Category Administration', type: :feature do
|
|
27
48
|
|
28
49
|
within '#search-masthead' do
|
29
50
|
choose 'Upload an image'
|
30
|
-
attach_file('
|
51
|
+
# attach_file('search_masthead_attributes_file', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
52
|
+
# The JS fills in these fields:
|
53
|
+
find('#search_masthead_attributes_iiif_tilesource', visible: false).set 'http://test.host/images/7'
|
54
|
+
find('#search_masthead_attributes_iiif_region', visible: false).set '0,0,100,200'
|
31
55
|
end
|
32
56
|
|
33
57
|
click_button 'Save changes'
|
@@ -37,8 +61,7 @@ describe 'Browse Category Administration', type: :feature do
|
|
37
61
|
search.reload
|
38
62
|
|
39
63
|
expect(search.masthead).not_to be nil
|
40
|
-
expect(search.masthead.
|
41
|
-
expect(search.masthead.image.path).to end_with 'avatar.png'
|
64
|
+
expect(search.masthead.iiif_url).to eq 'http://test.host/images/7/0,0,100,200/1800,180/0/default.jpg'
|
42
65
|
end
|
43
66
|
|
44
67
|
it 'attaches a thumbnail image' do
|
@@ -48,7 +71,7 @@ describe 'Browse Category Administration', type: :feature do
|
|
48
71
|
|
49
72
|
within '#search-thumbnail' do
|
50
73
|
choose 'Upload an image'
|
51
|
-
attach_file('
|
74
|
+
attach_file('search_thumbnail_attributes_file', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
52
75
|
end
|
53
76
|
|
54
77
|
click_button 'Save changes'
|
@@ -58,8 +81,6 @@ describe 'Browse Category Administration', type: :feature do
|
|
58
81
|
search.reload
|
59
82
|
|
60
83
|
expect(search.thumbnail).not_to be nil
|
61
|
-
expect(search.thumbnail.image.thumb).not_to be_nil
|
62
|
-
expect(search.thumbnail.image.path).to end_with 'avatar.png'
|
63
84
|
end
|
64
85
|
|
65
86
|
it 'can select a default index view type' do
|
@@ -35,11 +35,11 @@ feature 'Browse pages' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'with a custom masthead' do
|
38
|
-
let(:masthead) { FactoryGirl.create(:masthead, display: true) }
|
38
|
+
let(:masthead) { FactoryGirl.create(:masthead, display: true, iiif_tilesource: 'http://test.host/images/1') }
|
39
39
|
|
40
40
|
before do
|
41
41
|
search.masthead = masthead
|
42
|
-
search.save
|
42
|
+
search.save!
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'has a contextual masthead with the title and resource count' do
|
@@ -8,7 +8,7 @@ describe 'Create a new exhibit', type: :feature do
|
|
8
8
|
it 'has a link in the user dropdown' do
|
9
9
|
visit '/'
|
10
10
|
within '.dropdown-menu' do
|
11
|
-
click_link 'Create
|
11
|
+
click_link 'Create new exhibit'
|
12
12
|
end
|
13
13
|
expect(page).to have_selector 'h1', text: 'Manage exhibits'
|
14
14
|
expect(page).to have_selector 'h1 small', text: 'Create a new exhibit'
|
@@ -17,7 +17,7 @@ describe 'Create a new exhibit', type: :feature do
|
|
17
17
|
it 'allows admins to create a new exhibit' do
|
18
18
|
visit '/'
|
19
19
|
within '.dropdown-menu' do
|
20
|
-
click_link 'Create
|
20
|
+
click_link 'Create new exhibit'
|
21
21
|
end
|
22
22
|
|
23
23
|
fill_in 'Title', with: 'My exhibit title'
|
@@ -31,7 +31,7 @@ describe 'Create a new exhibit', type: :feature do
|
|
31
31
|
it 'allows admins to create a new exhibit with a slug' do
|
32
32
|
visit '/'
|
33
33
|
within '.dropdown-menu' do
|
34
|
-
click_link 'Create
|
34
|
+
click_link 'Create new exhibit'
|
35
35
|
end
|
36
36
|
|
37
37
|
fill_in 'Title', with: 'My exhibit title'
|
@@ -10,12 +10,16 @@ describe 'Add and update the site masthead', type: :feature do
|
|
10
10
|
click_link 'Appearance'
|
11
11
|
end
|
12
12
|
|
13
|
-
click_link '
|
13
|
+
click_link 'Exhibit masthead'
|
14
14
|
|
15
15
|
within '#site-masthead' do
|
16
16
|
check 'Show background image in masthead'
|
17
17
|
choose 'Upload an image'
|
18
|
-
|
18
|
+
|
19
|
+
# The JS fills in these fields:
|
20
|
+
find('#exhibit_masthead_attributes_iiif_tilesource', visible: false).set 'http://test.host/images/7'
|
21
|
+
find('#exhibit_masthead_attributes_iiif_region', visible: false).set '0,0,100,200'
|
22
|
+
# attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
19
23
|
end
|
20
24
|
|
21
25
|
click_button 'Save changes'
|
@@ -26,13 +30,14 @@ describe 'Add and update the site masthead', type: :feature do
|
|
26
30
|
click_link 'Appearance'
|
27
31
|
end
|
28
32
|
|
29
|
-
click_link '
|
33
|
+
click_link 'Exhibit masthead'
|
30
34
|
|
31
35
|
within '#site-masthead' do
|
32
36
|
expect(field_labeled('Show background image in masthead')).to be_checked
|
33
37
|
expect(field_labeled('Upload an image')).to be_checked
|
34
38
|
end
|
35
39
|
end
|
40
|
+
|
36
41
|
it 'displays a masthead image when one is uploaded and configured' do
|
37
42
|
visit spotlight.exhibit_dashboard_path(exhibit)
|
38
43
|
expect(page).to_not have_css('.image-masthead')
|
@@ -40,12 +45,15 @@ describe 'Add and update the site masthead', type: :feature do
|
|
40
45
|
click_link 'Appearance'
|
41
46
|
end
|
42
47
|
|
43
|
-
click_link '
|
48
|
+
click_link 'Exhibit masthead'
|
44
49
|
|
45
50
|
within '#site-masthead' do
|
46
51
|
check 'Show background image in masthead'
|
47
52
|
|
48
|
-
attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
53
|
+
# attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
54
|
+
# The JS fills in these fields:
|
55
|
+
find('#exhibit_masthead_attributes_iiif_tilesource', visible: false).set 'http://test.host/images/7'
|
56
|
+
find('#exhibit_masthead_attributes_iiif_region', visible: false).set '0,0,100,200'
|
49
57
|
end
|
50
58
|
|
51
59
|
click_button 'Save changes'
|
@@ -54,6 +62,7 @@ describe 'Add and update the site masthead', type: :feature do
|
|
54
62
|
|
55
63
|
expect(page).to have_css('.image-masthead .background-container')
|
56
64
|
end
|
65
|
+
|
57
66
|
it 'does not display an uploaded masthead if configured to not display' do
|
58
67
|
visit spotlight.exhibit_dashboard_path(exhibit)
|
59
68
|
expect(page).to_not have_css('.image-masthead')
|
@@ -61,10 +70,10 @@ describe 'Add and update the site masthead', type: :feature do
|
|
61
70
|
click_link 'Appearance'
|
62
71
|
end
|
63
72
|
|
64
|
-
click_link '
|
73
|
+
click_link 'Exhibit masthead'
|
65
74
|
|
66
75
|
within '#site-masthead' do
|
67
|
-
attach_file('
|
76
|
+
attach_file('exhibit_masthead_attributes_file', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
68
77
|
end
|
69
78
|
|
70
79
|
click_button 'Save changes'
|
@@ -73,15 +82,17 @@ describe 'Add and update the site masthead', type: :feature do
|
|
73
82
|
|
74
83
|
expect(page).to_not have_css('.image-masthead .background-container')
|
75
84
|
end
|
85
|
+
|
76
86
|
it 'displays a masthead image when one is uploaded from an exhibit item', js: true do
|
77
|
-
skip "Capyabara and
|
87
|
+
skip "Capyabara and the cropping tool don't play well together.."
|
88
|
+
|
78
89
|
visit spotlight.exhibit_dashboard_path(exhibit)
|
79
90
|
expect(page).to_not have_css('.image-masthead')
|
80
91
|
within '#sidebar' do
|
81
92
|
click_link 'Appearance'
|
82
93
|
end
|
83
94
|
|
84
|
-
click_link '
|
95
|
+
click_link 'Exhibit masthead'
|
85
96
|
|
86
97
|
within '#site-masthead' do
|
87
98
|
check 'Show background image in masthead'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe 'Update the site theme', type: :feature do
|
2
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
3
|
+
let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
|
4
|
+
|
5
|
+
before { login_as user }
|
6
|
+
it 'updates the exhibit theme' do
|
7
|
+
visit spotlight.edit_exhibit_appearance_path(exhibit)
|
8
|
+
|
9
|
+
expect(page).to have_content('Visual theme')
|
10
|
+
choose 'Modern'
|
11
|
+
|
12
|
+
click_button 'Save changes'
|
13
|
+
|
14
|
+
expect(page).to have_content('The exhibit was successfully updated.')
|
15
|
+
|
16
|
+
within '#sidebar' do
|
17
|
+
click_link 'Appearance'
|
18
|
+
end
|
19
|
+
|
20
|
+
click_link 'Exhibit masthead'
|
21
|
+
|
22
|
+
expect(field_labeled('Modern')).to be_checked
|
23
|
+
expect(page).to have_xpath('//link[contains(@href, "/stylesheets/application_modern.css")]', visible: false)
|
24
|
+
end
|
25
|
+
end
|