blacklight-spotlight 3.0.0.alpha.8 → 3.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
- data/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
- data/app/assets/javascripts/spotlight/admin/{add_new_page_button.js → add_new_button.js} +7 -0
- data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +4 -4
- data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +55 -1
- data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -2
- data/app/assets/javascripts/spotlight/admin/crop.es6 +11 -0
- data/app/assets/javascripts/spotlight/admin/croppable.js +1 -1
- data/app/assets/javascripts/spotlight/admin/index.js +0 -2
- data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
- data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +21 -12
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +11 -3
- data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
- data/app/assets/javascripts/spotlight/user/index.js +1 -0
- data/app/assets/stylesheets/spotlight/_accessibility.scss +1 -1
- data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
- data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
- data/app/assets/stylesheets/spotlight/_catalog.scss +6 -6
- data/app/assets/stylesheets/spotlight/_curation.scss +6 -0
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +214 -83
- data/app/assets/stylesheets/spotlight/_header.scss +1 -1
- data/app/assets/stylesheets/spotlight/_item_text_block.scss +6 -0
- data/app/assets/stylesheets/spotlight/_pages.scss +10 -5
- data/app/assets/stylesheets/spotlight/_report_a_problem.scss +5 -2
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
- data/app/assets/stylesheets/spotlight/_translations.scss +7 -0
- data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +69 -0
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
- data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
- data/app/controllers/spotlight/appearances_controller.rb +0 -12
- data/app/controllers/spotlight/browse_controller.rb +7 -3
- data/app/controllers/spotlight/catalog_controller.rb +1 -1
- data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
- data/app/controllers/spotlight/exhibits_controller.rb +2 -3
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/groups_controller.rb +80 -0
- data/app/controllers/spotlight/pages_controller.rb +6 -9
- data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +7 -19
- data/app/controllers/spotlight/translations_controller.rb +46 -0
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/crop_helper.rb +4 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
- data/app/helpers/spotlight/main_app_helpers.rb +1 -1
- data/app/jobs/spotlight/add_uploads_from_csv.rb +30 -5
- data/app/mailers/spotlight/indexing_complete_mailer.rb +3 -2
- data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
- data/app/models/concerns/spotlight/translatables.rb +17 -1
- data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
- data/app/models/spotlight/ability.rb +2 -0
- data/app/models/spotlight/about_page.rb +3 -1
- data/app/models/spotlight/blacklight_configuration.rb +2 -1
- data/app/models/spotlight/contact.rb +1 -1
- data/app/models/spotlight/custom_field.rb +3 -3
- data/app/models/spotlight/exhibit.rb +18 -4
- data/app/models/spotlight/feature_page.rb +3 -1
- data/app/models/spotlight/featured_image.rb +29 -12
- data/app/models/spotlight/group.rb +22 -0
- data/app/models/spotlight/group_member.rb +11 -0
- data/app/models/spotlight/home_page.rb +3 -1
- data/app/models/spotlight/main_navigation.rb +2 -2
- data/app/models/spotlight/masthead.rb +1 -1
- data/app/models/spotlight/page.rb +5 -1
- data/app/models/spotlight/page_configurations.rb +6 -0
- data/app/models/spotlight/page_content.rb +2 -0
- data/app/models/spotlight/resources/csv_upload.rb +2 -1
- data/app/models/spotlight/resources/iiif_manifest.rb +8 -6
- data/app/models/spotlight/resources/upload.rb +1 -1
- data/app/models/spotlight/search.rb +10 -1
- data/app/models/spotlight/solr_document_sidecar.rb +7 -5
- data/app/models/spotlight/temporary_image.rb +8 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +482 -0
- data/app/services/spotlight/solr_document_builder.rb +1 -0
- data/app/values/custom_field_name.rb +1 -0
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/spotlight/about_pages/_empty.html.erb +5 -5
- data/app/views/spotlight/browse/_search.html.erb +5 -3
- data/app/views/spotlight/browse/_search_title.html.erb +2 -1
- data/app/views/spotlight/browse/index.html.erb +13 -0
- data/app/views/spotlight/catalog/_document.html.erb +2 -4
- data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
- data/app/views/spotlight/contacts/_form.html.erb +1 -1
- data/app/views/spotlight/feature_pages/_empty.html.erb +5 -5
- data/app/views/spotlight/featured_images/_form.html.erb +1 -1
- data/app/views/spotlight/featured_images/_upload_form.html.erb +1 -1
- data/app/views/spotlight/home_pages/_empty.html.erb +3 -3
- data/app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb +9 -0
- data/app/views/spotlight/pages/_form.html.erb +2 -2
- data/app/views/spotlight/searches/_form.html.erb +13 -0
- data/app/views/spotlight/searches/_group.html.erb +27 -0
- data/app/views/spotlight/searches/_search.html.erb +1 -0
- data/app/views/spotlight/searches/index.html.erb +58 -17
- data/app/views/spotlight/shared/_honeypot_field.html.erb +4 -0
- data/app/views/spotlight/shared/_report_a_problem.html.erb +7 -10
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +44 -0
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
- data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
- data/app/views/spotlight/translations/_general.html.erb +7 -7
- data/app/views/spotlight/translations/_groups.html.erb +34 -0
- data/app/views/spotlight/translations/_import.html.erb +24 -0
- data/app/views/spotlight/translations/_metadata.html.erb +1 -1
- data/app/views/spotlight/translations/_page.html.erb +5 -5
- data/app/views/spotlight/translations/_pages.html.erb +4 -4
- data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
- data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
- data/app/views/spotlight/translations/edit.html.erb +14 -6
- data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
- data/config/i18n-tasks.yml +7 -0
- data/config/locales/spotlight.ar.yml +47 -24
- data/config/locales/spotlight.en.yml +182 -127
- data/config/routes.rb +16 -1
- data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
- data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
- data/lib/generators/spotlight/install_generator.rb +23 -2
- data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +10 -0
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -1
- data/lib/spotlight/engine.rb +27 -3
- data/lib/spotlight/upload_field_config.rb +1 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +3 -3
- data/spec/controllers/spotlight/browse_controller_spec.rb +24 -1
- data/spec/controllers/spotlight/catalog_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
- data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
- data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
- data/spec/examples.txt +1437 -1389
- data/spec/factories/featured_images.rb +4 -0
- data/spec/factories/group.rb +17 -0
- data/spec/factories/searches.rb +11 -1
- data/spec/features/add_contacts_spec.rb +1 -1
- data/spec/features/browse_category_admin_spec.rb +39 -7
- data/spec/features/browse_category_navigation_spec.rb +44 -0
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/catalog_spec.rb +2 -2
- data/spec/features/create_exhibit_spec.rb +5 -4
- data/spec/features/dashboard_spec.rb +7 -7
- data/spec/features/edit_search_fields_spec.rb +2 -2
- data/spec/features/exhibits/administration_spec.rb +3 -3
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +1 -1
- data/spec/features/exhibits/language_create_edit_spec.rb +3 -3
- data/spec/features/exhibits/translation_editing_spec.rb +57 -8
- data/spec/features/home_page_spec.rb +13 -4
- data/spec/features/item_admin_spec.rb +4 -4
- data/spec/features/javascript/about_page_admin_spec.rb +1 -1
- data/spec/features/javascript/block_controls_spec.rb +3 -1
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
- data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
- data/spec/features/javascript/edit_in_place_spec.rb +3 -3
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/features/javascript/search_config_admin_spec.rb +1 -1
- data/spec/features/report_a_problem_spec.rb +6 -5
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
- data/spec/helpers/spotlight/pages_helper_spec.rb +2 -2
- data/spec/i18n_spec.rb +0 -2
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +13 -1
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +11 -1
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
- data/spec/models/solr_document_spec.rb +2 -3
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -0
- data/spec/models/spotlight/exhibit_spec.rb +18 -2
- data/spec/models/spotlight/featured_image_spec.rb +27 -0
- data/spec/models/spotlight/group_spec.rb +19 -0
- data/spec/models/spotlight/main_navigation_spec.rb +1 -1
- data/spec/models/spotlight/page_spec.rb +6 -1
- data/spec/models/spotlight/resources/upload_spec.rb +43 -79
- data/spec/models/spotlight/role_spec.rb +3 -3
- data/spec/models/spotlight/search_spec.rb +30 -3
- data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +168 -23
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
- data/spec/services/spotlight/solr_document_builder_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/features/test_features_helpers.rb +15 -0
- data/spec/test_app_templates/Gemfile.extra +1 -3
- data/spec/test_app_templates/catalog_controller.rb +6 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
- data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +7 -8
- data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +46 -21
- data/vendor/assets/javascripts/tiny-slider.js +3218 -0
- data/vendor/assets/stylesheets/tiny-slider.css +1 -0
- metadata +399 -284
- data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
- data/app/serializers/spotlight/featured_image_representer.rb +0 -29
- data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
- data/app/serializers/spotlight/page_representer.rb +0 -33
- data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -10,7 +10,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
10
10
|
visit spotlight.exhibit_dashboard_path(exhibit)
|
11
11
|
click_link 'Feature pages'
|
12
12
|
expect(page).to have_selector 'h2', text: 'Homepage'
|
13
|
-
expect(page).to have_selector 'h3.card-title', text: 'Exhibit
|
13
|
+
expect(page).to have_selector 'h3.card-title', text: 'Exhibit home'
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'allows users to edit the home page title' do
|
@@ -31,8 +31,17 @@ describe 'Home page', type: :feature, versioning: true do
|
|
31
31
|
expect(page).to have_selector '.card-title a', text: 'New Home Page Title'
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'redirects back to the correct home page URL after updating (no format param to interfere w/ faceting)' do
|
35
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
36
|
+
|
37
|
+
click_link 'Edit'
|
38
|
+
click_button 'Save changes'
|
39
|
+
|
40
|
+
expect(page.current_url).to eq spotlight.exhibit_home_page_url(exhibit)
|
41
|
+
end
|
42
|
+
|
34
43
|
it 'has working facet links' do
|
35
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
44
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
36
45
|
click_button 'Genre'
|
37
46
|
click_link 'map'
|
38
47
|
expect(page).to have_content exhibit.title
|
@@ -40,7 +49,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
40
49
|
end
|
41
50
|
|
42
51
|
it 'has a search box' do
|
43
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
52
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
44
53
|
fill_in 'q', with: 'query'
|
45
54
|
click_button 'Search'
|
46
55
|
|
@@ -53,7 +62,7 @@ describe 'Home page', type: :feature, versioning: true do
|
|
53
62
|
TopHat.current['opengraph'] = nil
|
54
63
|
Spotlight::Site.instance.update(title: 'some title')
|
55
64
|
|
56
|
-
visit spotlight.exhibit_home_page_path(exhibit
|
65
|
+
visit spotlight.exhibit_home_page_path(exhibit)
|
57
66
|
|
58
67
|
expect(page).to have_css "meta[name='twitter:card'][value='summary']", visible: false
|
59
68
|
expect(page).to have_css "meta[name='twitter:url'][value='#{spotlight.exhibit_root_url(exhibit)}']", visible: false
|
@@ -30,12 +30,12 @@ describe 'Item Administration', type: :feature do
|
|
30
30
|
it 'has a public/private toggle' do
|
31
31
|
visit spotlight.admin_exhibit_catalog_path(exhibit)
|
32
32
|
item = first('tr[itemscope]')
|
33
|
-
expect(item).to have_button 'Make
|
34
|
-
item.click_button 'Make
|
33
|
+
expect(item).to have_button 'Make private'
|
34
|
+
item.click_button 'Make private'
|
35
35
|
|
36
36
|
item = first('tr[itemscope]')
|
37
|
-
expect(item).to have_button 'Make
|
38
|
-
item.click_button 'Make
|
37
|
+
expect(item).to have_button 'Make public'
|
38
|
+
item.click_button 'Make public'
|
39
39
|
end
|
40
40
|
|
41
41
|
it "toggles the 'blacklight-private' label", js: true, default_max_wait_time: 5 do
|
@@ -12,7 +12,7 @@ describe 'About Pages Adminstration', js: true do
|
|
12
12
|
|
13
13
|
click_link 'About pages'
|
14
14
|
|
15
|
-
|
15
|
+
add_new_via_button('My New Page')
|
16
16
|
|
17
17
|
expect(page).to have_content 'The about page was created.'
|
18
18
|
expect(page).to have_css('li.dd-item')
|
@@ -12,7 +12,7 @@ describe 'Block controls' do
|
|
12
12
|
|
13
13
|
click_link 'Feature pages'
|
14
14
|
|
15
|
-
|
15
|
+
add_new_via_button('My New Feature Page')
|
16
16
|
|
17
17
|
expect(page).to have_css('h3', text: 'My New Feature Page')
|
18
18
|
|
@@ -27,10 +27,12 @@ describe 'Block controls' do
|
|
27
27
|
|
28
28
|
within('.spotlight-block-controls') do
|
29
29
|
expect(page).to have_css('.st-controls-group', count: 2)
|
30
|
+
|
30
31
|
within(first('.st-controls-group')) do
|
31
32
|
expect(page).to have_content 'Standard widgets'
|
32
33
|
expect(page).to have_css('.st-block-controls__button')
|
33
34
|
end
|
35
|
+
|
34
36
|
within(all('.st-controls-group').last) do
|
35
37
|
expect(page).to have_content 'Exhibit item widgets'
|
36
38
|
expect(page).to have_css('.st-block-controls__button')
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Browse Group Categories', type: :feature, js: true do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
6
|
+
|
7
|
+
let(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
8
|
+
let(:search1) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good dogs') }
|
9
|
+
let(:search2) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good cats') }
|
10
|
+
let(:search3) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good birds') }
|
11
|
+
let(:search4) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good pigs') }
|
12
|
+
let(:search5) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good tigers') }
|
13
|
+
let(:search6) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'All of the good ferrets') }
|
14
|
+
let(:search7) { FactoryBot.create(:search, exhibit: exhibit, title: 'All of the good turtles') }
|
15
|
+
let!(:group) { FactoryBot.create(:group, exhibit: exhibit, searches: [search1, search2, search3, search4, search5, search6], title: 'Pets', published: true) }
|
16
|
+
let!(:group2) { FactoryBot.create(:group, exhibit: exhibit, searches: [search1, search2], title: 'Good animals', published: true) }
|
17
|
+
|
18
|
+
before do
|
19
|
+
login_as exhibit_curator
|
20
|
+
|
21
|
+
visit spotlight.edit_exhibit_feature_page_path(exhibit, feature_page)
|
22
|
+
add_widget 'browse_group_categories'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'allows a curator to select a caption to display' do
|
26
|
+
fill_in_prefetched_typeahead_field with: 'Pets', wait_for: '[data-type="browse_group_categories"] [data-browse-groups-fetched]'
|
27
|
+
within '.dd-list' do
|
28
|
+
expect(page).to have_css '.title', text: 'Pets'
|
29
|
+
end
|
30
|
+
|
31
|
+
save_page
|
32
|
+
|
33
|
+
expect(page).to have_css 'h2', text: 'Pets'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'can navigate using arrows' do
|
37
|
+
fill_in_prefetched_typeahead_field with: 'Pets', wait_for: '[data-type="browse_group_categories"] [data-browse-groups-fetched]'
|
38
|
+
within '.dd-list' do
|
39
|
+
expect(page).to have_css '.title', text: 'Pets'
|
40
|
+
end
|
41
|
+
|
42
|
+
save_page
|
43
|
+
|
44
|
+
expect(page).to have_css 'h2', text: 'Pets'
|
45
|
+
|
46
|
+
expect(page).to have_css '.category-title', text: 'All of the good dogs'
|
47
|
+
expect(page).not_to have_css '.category-title', text: 'All of the good tigers'
|
48
|
+
find('[data-controls="next"]').click
|
49
|
+
expect(page).not_to have_css '.category-title', text: 'All of the good dogs'
|
50
|
+
expect(page).to have_css '.category-title', text: 'All of the good tigers'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'only published searches are displayed' do
|
54
|
+
fill_in_prefetched_typeahead_field with: 'Pets', wait_for: '[data-type="browse_group_categories"] [data-browse-groups-fetched]'
|
55
|
+
within '.dd-list' do
|
56
|
+
expect(page).to have_css '.title', text: 'Pets'
|
57
|
+
end
|
58
|
+
|
59
|
+
save_page
|
60
|
+
|
61
|
+
expect(page).to have_css 'h2', text: 'Pets'
|
62
|
+
expect(page).to have_css '.box.category-1', count: 6, visible: false
|
63
|
+
end
|
64
|
+
end
|
@@ -26,6 +26,7 @@ describe 'Uploaded Items Block', feature: true, js: true, versioning: true do
|
|
26
26
|
within('.dd-list') do
|
27
27
|
expect(page).to have_css('.card-title', text: '800x600.png')
|
28
28
|
fill_in 'Caption', with: 'Some caption text'
|
29
|
+
fill_in 'Link URL', with: 'https://example.com/'
|
29
30
|
end
|
30
31
|
|
31
32
|
attach_file('uploaded_item_url', fixture_file2)
|
@@ -41,8 +42,10 @@ describe 'Uploaded Items Block', feature: true, js: true, versioning: true do
|
|
41
42
|
expect(page).to have_css('p', text: text)
|
42
43
|
|
43
44
|
within('.uploaded-items-block') do
|
44
|
-
expect(page).to have_css('img[alt=""]', count:
|
45
|
+
expect(page).to have_css('img[alt=""]', count: 1)
|
46
|
+
expect(page).to have_css('img[alt="Some caption text"]', count: 1)
|
45
47
|
expect(page).to have_css '.caption', text: 'Some caption text'
|
48
|
+
expect(page).to have_link 'Some caption text', href: 'https://example.com/'
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Browse Group Adminstration', js: true do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
6
|
+
let!(:group1) do
|
7
|
+
FactoryBot.create(
|
8
|
+
:group,
|
9
|
+
title: 'Good group 1',
|
10
|
+
exhibit: exhibit
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
before { login_as exhibit_curator }
|
15
|
+
|
16
|
+
it 'is able to create new groups' do
|
17
|
+
visit spotlight.exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
18
|
+
|
19
|
+
add_new_via_button('My New Group')
|
20
|
+
|
21
|
+
expect(page).to have_content 'The browse group was created.'
|
22
|
+
expect(page).to have_css('li.dd-item')
|
23
|
+
expect(page).to have_css('h4', text: 'My New Group')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'updates the page titles' do
|
27
|
+
visit spotlight.exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
28
|
+
|
29
|
+
within("[data-id='#{group1.id}']") do
|
30
|
+
within('h4') do
|
31
|
+
expect(page).to have_content('Good group 1')
|
32
|
+
expect(page).to have_css('.title-field', visible: false)
|
33
|
+
click_link('Good group 1')
|
34
|
+
expect(page).to have_css('.title-field', visible: true)
|
35
|
+
find('.title-field').set('New good group 1')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
click_button('Save changes')
|
39
|
+
within("[data-id='#{group1.id}']") do
|
40
|
+
within('h4') do
|
41
|
+
expect(page).to have_content('New good group 1')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -12,7 +12,7 @@ describe 'Edit in place', type: :feature, js: true do
|
|
12
12
|
|
13
13
|
click_link 'Feature pages'
|
14
14
|
|
15
|
-
|
15
|
+
add_new_via_button('My New Feature Page')
|
16
16
|
|
17
17
|
expect(page).to have_css('h3', text: 'My New Feature Page')
|
18
18
|
|
@@ -38,7 +38,7 @@ describe 'Edit in place', type: :feature, js: true do
|
|
38
38
|
|
39
39
|
click_link 'Feature pages'
|
40
40
|
|
41
|
-
|
41
|
+
add_new_via_button('My New Feature Page')
|
42
42
|
|
43
43
|
expect(page).to have_css('h3', text: 'My New Feature Page')
|
44
44
|
|
@@ -73,7 +73,7 @@ describe 'Edit in place', type: :feature, js: true do
|
|
73
73
|
within('#nested-navigation') do
|
74
74
|
expect(page).to have_css("#exhibit_main_navigations_attributes_0_label[type='hidden']", visible: false)
|
75
75
|
expect(page).not_to have_css("#exhibit_main_navigations_attributes_0_label[type='text']")
|
76
|
-
click_link('Curated
|
76
|
+
click_link('Curated features')
|
77
77
|
expect(page).not_to have_css("#exhibit_main_navigations_attributes_0_label[type='hidden']")
|
78
78
|
expect(page).to have_css("#exhibit_main_navigations_attributes_0_label[type='text']")
|
79
79
|
fill_in 'exhibit_main_navigations_attributes_0_label', with: 'My Page Label'
|
@@ -26,7 +26,7 @@ describe 'Feature Pages Adminstration', js: true do
|
|
26
26
|
|
27
27
|
click_link 'Feature pages'
|
28
28
|
|
29
|
-
|
29
|
+
add_new_via_button('My New Page')
|
30
30
|
|
31
31
|
expect(page).to have_content 'The feature page was created.'
|
32
32
|
expect(page).to have_css('li.dd-item')
|
@@ -120,7 +120,7 @@ describe 'Search Configuration Administration', js: true do
|
|
120
120
|
within('#nested-sort-fields') do
|
121
121
|
expect(page).to have_css("#blacklight_configuration_sort_fields_title_label[type='hidden']", visible: false)
|
122
122
|
expect(page).not_to have_css("#blacklight_configuration_sort_fields_title_label[type='text']")
|
123
|
-
click_link('
|
123
|
+
click_link('title')
|
124
124
|
expect(page).not_to have_css("#blacklight_configuration_sort_fields_title_label[type='hidden']")
|
125
125
|
expect(page).to have_css("#blacklight_configuration_sort_fields_title_label[type='text']")
|
126
126
|
fill_in 'blacklight_configuration_sort_fields_title_label', with: 'My Title Label'
|
@@ -27,15 +27,16 @@ describe 'Report a Problem', type: :feature do
|
|
27
27
|
|
28
28
|
click_on 'Feedback'
|
29
29
|
|
30
|
-
expect(page).to have_css('h2', text: 'Contact
|
30
|
+
expect(page).to have_css('h2', text: 'Contact us', visible: true)
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'accepts a problem report', js: true do
|
34
34
|
visit spotlight.exhibit_solr_document_path(exhibit, id: 'dq287tq6352')
|
35
35
|
click_on 'Feedback'
|
36
|
+
expect(page).to have_css('.alert-primary', text: '/dq287tq6352')
|
36
37
|
expect(find('#contact_form_current_url', visible: false).value).to end_with spotlight.exhibit_solr_document_path(exhibit, id: 'dq287tq6352')
|
37
|
-
fill_in '
|
38
|
-
fill_in '
|
38
|
+
fill_in 'Your name', with: 'Some Body'
|
39
|
+
fill_in 'Your email', with: 'test@example.com'
|
39
40
|
fill_in 'Message', with: 'This is my problem report'
|
40
41
|
|
41
42
|
expect do
|
@@ -47,8 +48,8 @@ describe 'Report a Problem', type: :feature do
|
|
47
48
|
visit spotlight.exhibit_solr_document_path(exhibit, id: 'dq287tq6352')
|
48
49
|
click_on 'Feedback'
|
49
50
|
expect(find('#contact_form_current_url', visible: false).value).to end_with spotlight.exhibit_solr_document_path(exhibit, id: 'dq287tq6352')
|
50
|
-
fill_in '
|
51
|
-
fill_in '
|
51
|
+
fill_in 'Your name', with: 'Some Body'
|
52
|
+
fill_in 'Your email', with: 'test@example.com'
|
52
53
|
page.evaluate_script("$('#contact_form_#{honeypot_field_name}').val('possible_spam@spam.com')")
|
53
54
|
fill_in 'Message', with: 'This is my problem report'
|
54
55
|
|
@@ -104,7 +104,7 @@ describe Spotlight::CrudLinkHelpers, type: :helper do
|
|
104
104
|
describe '#action_default_value' do
|
105
105
|
it 'attempts i18n lookups for models' do
|
106
106
|
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.edit',
|
107
|
-
model: some_model.class.model_name.human,
|
107
|
+
model: some_model.class.model_name.human.downcase,
|
108
108
|
default: [:'helpers.action.edit', 'Edit Feature page'])
|
109
109
|
expect(helper.send(:action_default_value, some_model))
|
110
110
|
end
|
@@ -112,14 +112,14 @@ describe Spotlight::CrudLinkHelpers, type: :helper do
|
|
112
112
|
it 'attempts i18n lookups for unpersisted models' do
|
113
113
|
some_model = Spotlight::FeaturePage.new
|
114
114
|
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.create',
|
115
|
-
model: some_model.class.model_name.human,
|
115
|
+
model: some_model.class.model_name.human.downcase,
|
116
116
|
default: [:'helpers.action.create', 'Create Feature page'])
|
117
117
|
expect(helper.send(:action_default_value, some_model))
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'attempts i18n lookups for models with an explicit action' do
|
121
121
|
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.custom_action',
|
122
|
-
model: some_model.class.model_name.human,
|
122
|
+
model: some_model.class.model_name.human.downcase,
|
123
123
|
default: [:'helpers.action.custom_action', 'Custom action Feature page'])
|
124
124
|
expect(helper.send(:action_default_value, some_model, :custom_action))
|
125
125
|
end
|
@@ -109,13 +109,13 @@ describe Spotlight::PagesHelper, type: :helper do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
describe '#content_editor_class' do
|
112
|
-
context '
|
112
|
+
context 'a sir-trevor backed page with a custom class' do
|
113
113
|
it 'has a custom class' do
|
114
114
|
expect(helper.content_editor_class(Spotlight::Page.new)).to eq 'js-st-instance'
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
context '
|
118
|
+
context 'a sir-trevor backed page with a derived class' do
|
119
119
|
it 'derives a css class name from the editor type' do
|
120
120
|
expect(helper.content_editor_class(Spotlight::Page.new(content_type: 'Something::Custom'))).to eq 'js-something-custom-instance'
|
121
121
|
end
|
data/spec/i18n_spec.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'i18n/tasks'
|
4
4
|
|
5
|
-
# rubocop:disable RSpec/DescribeClass
|
6
5
|
RSpec.describe 'I18n' do
|
7
6
|
let(:i18n) { I18n::Tasks::BaseTask.new }
|
8
7
|
let(:missing_keys) { i18n.missing_keys }
|
@@ -26,4 +25,3 @@ RSpec.describe 'I18n' do
|
|
26
25
|
expect(non_normalized).to be_empty, error_message
|
27
26
|
end
|
28
27
|
end
|
29
|
-
# rubocop:enable RSpec/DescribeClass
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe Spotlight::
|
3
|
+
describe Spotlight::AddUploadsFromCsv do
|
4
4
|
subject(:job) { described_class.new(data, exhibit, user) }
|
5
5
|
|
6
6
|
let(:exhibit) { FactoryBot.create(:exhibit) }
|
@@ -40,4 +40,16 @@ describe Spotlight::AddUploadsFromCSV do
|
|
40
40
|
|
41
41
|
job.perform_now
|
42
42
|
end
|
43
|
+
|
44
|
+
context 'with errors' do
|
45
|
+
it 'collects errors uploaded resources for each row of data' do
|
46
|
+
allow(Spotlight::IndexingCompleteMailer).to receive(:documents_indexed).and_return(double(deliver_now: true))
|
47
|
+
job.perform_now
|
48
|
+
expect(Spotlight::IndexingCompleteMailer).to have_received(:documents_indexed).with(
|
49
|
+
data, exhibit, user,
|
50
|
+
indexed_count: 1,
|
51
|
+
errors: { 1 => array_including(match(/relative URI: x/)), 2 => array_including(match(/Upload is invalid/)) }
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
43
55
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe Spotlight::IndexingCompleteMailer do
|
4
|
-
subject { described_class.documents_indexed [1, 2, 3], exhibit, user }
|
4
|
+
subject { described_class.documents_indexed [1, 2, 3], exhibit, user, indexed_count: 3 }
|
5
5
|
|
6
6
|
let(:user) { double(email: 'test@example.com') }
|
7
7
|
let(:exhibit) { double(title: 'Exhibit title') }
|
@@ -29,4 +29,14 @@ describe Spotlight::IndexingCompleteMailer do
|
|
29
29
|
it 'includes the exhibit title' do
|
30
30
|
expect(subject.body.encoded).to match exhibit.title
|
31
31
|
end
|
32
|
+
|
33
|
+
context 'with errors' do
|
34
|
+
subject { described_class.documents_indexed [], exhibit, user, indexed_count: 0, errors: { 1 => ['missing title'], 20 => ['whatever'] } }
|
35
|
+
|
36
|
+
it 'includes some errors' do
|
37
|
+
expect(subject.body.encoded).to match 'Errors'
|
38
|
+
expect(subject.body.encoded).to match 'Row 1: missing title'
|
39
|
+
expect(subject.body.encoded).to match 'Row 20: whatever'
|
40
|
+
end
|
41
|
+
end
|
32
42
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe SirTrevorRails::Blocks::BrowseGroupCategoriesBlock do
|
4
|
+
subject { described_class.new({ type: '', data: block_data }, page) }
|
5
|
+
|
6
|
+
let!(:exhibit) { FactoryBot.create(:exhibit) }
|
7
|
+
let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
8
|
+
let!(:group1) { FactoryBot.create(:group, exhibit: exhibit, title: 'abc123', published: true) }
|
9
|
+
let!(:group2) { FactoryBot.create(:group, exhibit: exhibit, title: 'xyz321', published: true) }
|
10
|
+
|
11
|
+
let(:block_data) { {} }
|
12
|
+
|
13
|
+
describe '#groups' do
|
14
|
+
it 'is the array of items with display set to true' do
|
15
|
+
block_data[:item] = {
|
16
|
+
'0': { id: 'abc123', display: 'true', weight: '2' },
|
17
|
+
'1': { id: 'xyz321', display: 'true', weight: '1' }
|
18
|
+
}
|
19
|
+
expect(subject.groups.length).to eq 2
|
20
|
+
expect(subject.groups.first.title).to eq 'xyz321'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#groups?' do
|
25
|
+
it 'is the array of items with display set to true' do
|
26
|
+
block_data[:item] = {}
|
27
|
+
expect(subject.be_groups).to be_falsy
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#display_item_counts?' do
|
32
|
+
it do
|
33
|
+
expect(subject).not_to be_display_item_counts
|
34
|
+
end
|
35
|
+
|
36
|
+
it do
|
37
|
+
block_data['display-item-counts'] = 'true'
|
38
|
+
expect(subject).to be_display_item_counts
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|