blacklight-spotlight 3.0.0.alpha.9 → 3.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
  4. data/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
  5. data/app/assets/javascripts/spotlight/admin/{add_new_page_button.js → add_new_button.js} +7 -0
  6. data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +4 -4
  7. data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +55 -1
  8. data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
  9. data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
  10. data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +1 -1
  11. data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -2
  12. data/app/assets/javascripts/spotlight/admin/crop.es6 +11 -0
  13. data/app/assets/javascripts/spotlight/admin/croppable.js +1 -1
  14. data/app/assets/javascripts/spotlight/admin/index.js +0 -2
  15. data/app/assets/javascripts/spotlight/admin/reindex_monitor.js +1 -0
  16. data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
  17. data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +21 -12
  18. data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +11 -3
  19. data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
  20. data/app/assets/javascripts/spotlight/user/index.js +1 -0
  21. data/app/assets/stylesheets/spotlight/_accessibility.scss +1 -1
  22. data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
  23. data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
  24. data/app/assets/stylesheets/spotlight/_catalog.scss +6 -6
  25. data/app/assets/stylesheets/spotlight/_curation.scss +6 -0
  26. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +214 -83
  27. data/app/assets/stylesheets/spotlight/_header.scss +1 -1
  28. data/app/assets/stylesheets/spotlight/_item_text_block.scss +6 -0
  29. data/app/assets/stylesheets/spotlight/_pages.scss +9 -4
  30. data/app/assets/stylesheets/spotlight/_report_a_problem.scss +5 -2
  31. data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
  32. data/app/assets/stylesheets/spotlight/_translations.scss +7 -0
  33. data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +92 -0
  34. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
  35. data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
  36. data/app/controllers/spotlight/appearances_controller.rb +0 -12
  37. data/app/controllers/spotlight/browse_controller.rb +7 -3
  38. data/app/controllers/spotlight/catalog_controller.rb +5 -2
  39. data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
  40. data/app/controllers/spotlight/dashboards_controller.rb +1 -1
  41. data/app/controllers/spotlight/exhibits_controller.rb +2 -3
  42. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  43. data/app/controllers/spotlight/groups_controller.rb +80 -0
  44. data/app/controllers/spotlight/pages_controller.rb +6 -9
  45. data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
  46. data/app/controllers/spotlight/searches_controller.rb +7 -19
  47. data/app/controllers/spotlight/translations_controller.rb +46 -0
  48. data/app/helpers/spotlight/application_helper.rb +20 -1
  49. data/app/helpers/spotlight/crop_helper.rb +4 -1
  50. data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
  51. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  52. data/app/helpers/spotlight/pages_helper.rb +1 -1
  53. data/app/jobs/concerns/spotlight/job_tracking.rb +47 -0
  54. data/app/jobs/concerns/spotlight/limit_concurrency.rb +33 -0
  55. data/app/jobs/spotlight/add_uploads_from_csv.rb +34 -6
  56. data/app/jobs/spotlight/application_job.rb +8 -0
  57. data/app/jobs/spotlight/cleanup_job_trackers_job.rb +13 -0
  58. data/app/jobs/spotlight/default_thumbnail_job.rb +1 -3
  59. data/app/jobs/spotlight/reindex_exhibit_job.rb +36 -0
  60. data/app/jobs/spotlight/reindex_job.rb +49 -41
  61. data/app/jobs/spotlight/rename_sidecar_field_job.rb +2 -2
  62. data/app/jobs/spotlight/update_job_trackers_job.rb +20 -0
  63. data/app/mailers/spotlight/indexing_complete_mailer.rb +3 -2
  64. data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
  65. data/app/models/concerns/spotlight/translatables.rb +17 -1
  66. data/app/models/concerns/spotlight/user.rb +2 -1
  67. data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
  68. data/app/models/spotlight/ability.rb +2 -0
  69. data/app/models/spotlight/about_page.rb +3 -1
  70. data/app/models/spotlight/blacklight_configuration.rb +2 -1
  71. data/app/models/spotlight/contact.rb +1 -1
  72. data/app/models/spotlight/custom_field.rb +3 -3
  73. data/app/models/spotlight/event.rb +13 -0
  74. data/app/models/spotlight/exhibit.rb +18 -14
  75. data/app/models/spotlight/feature_page.rb +3 -1
  76. data/app/models/spotlight/featured_image.rb +29 -12
  77. data/app/models/spotlight/group.rb +22 -0
  78. data/app/models/spotlight/group_member.rb +11 -0
  79. data/app/models/spotlight/home_page.rb +3 -1
  80. data/app/models/spotlight/job_tracker.rb +105 -0
  81. data/app/models/spotlight/main_navigation.rb +2 -2
  82. data/app/models/spotlight/masthead.rb +1 -1
  83. data/app/models/spotlight/page.rb +5 -1
  84. data/app/models/spotlight/page_configurations.rb +6 -0
  85. data/app/models/spotlight/page_content.rb +2 -0
  86. data/app/models/spotlight/reindex_progress.rb +44 -27
  87. data/app/models/spotlight/resource.rb +24 -58
  88. data/app/models/spotlight/resources/csv_upload.rb +2 -1
  89. data/app/models/spotlight/resources/iiif_harvester.rb +10 -1
  90. data/app/models/spotlight/resources/iiif_manifest.rb +11 -7
  91. data/app/models/spotlight/resources/iiif_service.rb +1 -1
  92. data/app/models/spotlight/resources/json_upload.rb +12 -0
  93. data/app/models/spotlight/resources/upload.rb +25 -2
  94. data/app/models/spotlight/search.rb +10 -1
  95. data/app/models/spotlight/solr_document_sidecar.rb +9 -6
  96. data/app/models/spotlight/temporary_image.rb +8 -0
  97. data/app/services/spotlight/etl.rb +7 -0
  98. data/app/services/spotlight/etl/context.rb +52 -0
  99. data/app/services/spotlight/etl/executor.rb +194 -0
  100. data/app/services/spotlight/etl/loaders.rb +12 -0
  101. data/app/services/spotlight/etl/pipeline.rb +81 -0
  102. data/app/services/spotlight/etl/solr_loader.rb +96 -0
  103. data/app/services/spotlight/etl/sources.rb +25 -0
  104. data/app/services/spotlight/etl/step.rb +82 -0
  105. data/app/services/spotlight/etl/transforms.rb +64 -0
  106. data/app/services/spotlight/exhibit_import_export_service.rb +482 -0
  107. data/app/services/spotlight/validity_checker.rb +5 -5
  108. data/app/values/custom_field_name.rb +1 -0
  109. data/app/views/catalog/_save_search.html.erb +1 -1
  110. data/app/views/spotlight/about_pages/_empty.html.erb +5 -5
  111. data/app/views/spotlight/browse/_search.html.erb +5 -3
  112. data/app/views/spotlight/browse/_search_title.html.erb +2 -1
  113. data/app/views/spotlight/browse/index.html.erb +13 -0
  114. data/app/views/spotlight/catalog/_document.html.erb +2 -4
  115. data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
  116. data/app/views/spotlight/contacts/_form.html.erb +1 -1
  117. data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +6 -6
  118. data/app/views/spotlight/feature_pages/_empty.html.erb +5 -5
  119. data/app/views/spotlight/featured_images/_form.html.erb +1 -1
  120. data/app/views/spotlight/featured_images/_upload_form.html.erb +1 -1
  121. data/app/views/spotlight/home_pages/_empty.html.erb +3 -3
  122. data/app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb +9 -0
  123. data/app/views/spotlight/pages/_form.html.erb +2 -2
  124. data/app/views/spotlight/searches/_form.html.erb +13 -0
  125. data/app/views/spotlight/searches/_group.html.erb +27 -0
  126. data/app/views/spotlight/searches/_search.html.erb +1 -0
  127. data/app/views/spotlight/searches/index.html.erb +58 -17
  128. data/app/views/spotlight/shared/_honeypot_field.html.erb +4 -0
  129. data/app/views/spotlight/shared/_locale_picker.html.erb +1 -1
  130. data/app/views/spotlight/shared/_report_a_problem.html.erb +7 -10
  131. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
  132. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +45 -0
  133. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
  134. data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
  135. data/app/views/spotlight/translations/_general.html.erb +7 -7
  136. data/app/views/spotlight/translations/_groups.html.erb +34 -0
  137. data/app/views/spotlight/translations/_import.html.erb +24 -0
  138. data/app/views/spotlight/translations/_metadata.html.erb +1 -1
  139. data/app/views/spotlight/translations/_page.html.erb +5 -5
  140. data/app/views/spotlight/translations/_pages.html.erb +4 -4
  141. data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
  142. data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
  143. data/app/views/spotlight/translations/edit.html.erb +14 -6
  144. data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
  145. data/config/i18n-tasks.yml +7 -0
  146. data/config/locales/spotlight.ar.yml +57 -24
  147. data/config/locales/spotlight.en.yml +184 -128
  148. data/config/routes.rb +16 -1
  149. data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
  150. data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
  151. data/db/migrate/20210122082032_create_job_trackers.rb +22 -0
  152. data/db/migrate/20210126123041_create_events.rb +15 -0
  153. data/lib/generators/spotlight/install_generator.rb +23 -2
  154. data/lib/generators/spotlight/scaffold_resource_generator.rb +5 -13
  155. data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +10 -0
  156. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -1
  157. data/lib/spotlight/engine.rb +35 -4
  158. data/lib/spotlight/upload_field_config.rb +1 -0
  159. data/lib/spotlight/version.rb +1 -1
  160. data/spec/controllers/spotlight/about_pages_controller_spec.rb +3 -3
  161. data/spec/controllers/spotlight/browse_controller_spec.rb +24 -1
  162. data/spec/controllers/spotlight/catalog_controller_spec.rb +4 -2
  163. data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
  164. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
  165. data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
  166. data/spec/controllers/spotlight/home_pages_controller_spec.rb +2 -2
  167. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +4 -4
  168. data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
  169. data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
  170. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
  171. data/spec/examples.txt +1448 -125
  172. data/spec/factories/featured_images.rb +4 -0
  173. data/spec/factories/group.rb +17 -0
  174. data/spec/factories/job_trackers.rb +9 -0
  175. data/spec/factories/searches.rb +11 -1
  176. data/spec/features/add_contacts_spec.rb +1 -1
  177. data/spec/features/add_items_spec.rb +9 -4
  178. data/spec/features/browse_category_admin_spec.rb +39 -7
  179. data/spec/features/browse_category_navigation_spec.rb +44 -0
  180. data/spec/features/browse_category_spec.rb +2 -2
  181. data/spec/features/catalog_spec.rb +2 -2
  182. data/spec/features/create_exhibit_spec.rb +5 -4
  183. data/spec/features/dashboard_spec.rb +7 -7
  184. data/spec/features/edit_search_fields_spec.rb +2 -2
  185. data/spec/features/exhibits/administration_spec.rb +3 -3
  186. data/spec/features/exhibits/edit_metadata_fields_spec.rb +1 -1
  187. data/spec/features/exhibits/language_create_edit_spec.rb +3 -3
  188. data/spec/features/exhibits/translation_editing_spec.rb +57 -8
  189. data/spec/features/home_page_spec.rb +13 -4
  190. data/spec/features/item_admin_spec.rb +4 -4
  191. data/spec/features/javascript/about_page_admin_spec.rb +1 -1
  192. data/spec/features/javascript/block_controls_spec.rb +3 -1
  193. data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
  194. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
  195. data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
  196. data/spec/features/javascript/edit_in_place_spec.rb +3 -3
  197. data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
  198. data/spec/features/javascript/reindex_monitor_spec.rb +1 -1
  199. data/spec/features/javascript/search_config_admin_spec.rb +1 -1
  200. data/spec/features/report_a_problem_spec.rb +6 -5
  201. data/spec/features/site_users_management_spec.rb +4 -4
  202. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
  203. data/spec/helpers/spotlight/pages_helper_spec.rb +10 -2
  204. data/spec/i18n_spec.rb +0 -2
  205. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +13 -1
  206. data/spec/jobs/spotlight/reindex_exhibit_job_spec.rb +43 -0
  207. data/spec/jobs/spotlight/reindex_job_spec.rb +30 -59
  208. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +11 -1
  209. data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
  210. data/spec/models/solr_document_spec.rb +2 -3
  211. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -0
  212. data/spec/models/spotlight/exhibit_spec.rb +21 -59
  213. data/spec/models/spotlight/featured_image_spec.rb +27 -0
  214. data/spec/models/spotlight/group_spec.rb +19 -0
  215. data/spec/models/spotlight/main_navigation_spec.rb +1 -1
  216. data/spec/models/spotlight/page_spec.rb +6 -1
  217. data/spec/models/spotlight/reindex_progress_spec.rb +89 -87
  218. data/spec/models/spotlight/resource_spec.rb +69 -90
  219. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +9 -10
  220. data/spec/models/spotlight/resources/upload_spec.rb +43 -79
  221. data/spec/models/spotlight/role_spec.rb +3 -3
  222. data/spec/models/spotlight/search_spec.rb +30 -3
  223. data/spec/models/spotlight/solr_document_sidecar_spec.rb +1 -0
  224. data/spec/services/spotlight/etl/context_spec.rb +66 -0
  225. data/spec/services/spotlight/etl/executor_spec.rb +149 -0
  226. data/spec/services/spotlight/etl/pipeline_spec.rb +22 -0
  227. data/spec/services/spotlight/etl/solr_loader_spec.rb +76 -0
  228. data/spec/services/spotlight/etl/step_spec.rb +70 -0
  229. data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +168 -23
  230. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
  231. data/spec/spec_helper.rb +3 -6
  232. data/spec/support/features/test_features_helpers.rb +15 -0
  233. data/spec/test_app_templates/Gemfile.extra +1 -3
  234. data/spec/test_app_templates/catalog_controller.rb +6 -3
  235. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  236. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +1 -1
  237. data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
  238. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +1 -1
  239. data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +28 -25
  240. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -3
  241. data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
  242. data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +1 -1
  243. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +7 -8
  244. data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
  245. data/vendor/assets/javascripts/leaflet-iiif.js +46 -21
  246. data/vendor/assets/javascripts/tiny-slider.js +3218 -0
  247. data/vendor/assets/stylesheets/tiny-slider.css +1 -0
  248. metadata +444 -289
  249. data/app/models/concerns/spotlight/resources/open_graph.rb +0 -36
  250. data/app/models/spotlight/reindexing_log_entry.rb +0 -42
  251. data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
  252. data/app/serializers/spotlight/featured_image_representer.rb +0 -29
  253. data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
  254. data/app/serializers/spotlight/page_representer.rb +0 -33
  255. data/app/services/spotlight/resources/iiif_builder.rb +0 -19
  256. data/app/services/spotlight/solr_document_builder.rb +0 -76
  257. data/app/services/spotlight/upload_solr_document_builder.rb +0 -57
  258. data/spec/factories/reindexing_log_entries.rb +0 -54
  259. data/spec/models/spotlight/reindexing_log_entry_spec.rb +0 -129
  260. data/spec/models/spotlight/resources/open_graph_spec.rb +0 -65
  261. data/spec/services/spotlight/solr_document_builder_spec.rb +0 -66
  262. data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -148,7 +148,7 @@ describe 'Translation editing', type: :feature do
148
148
  before do
149
149
  within '.translation-edit-form #general' do
150
150
  fill_in 'Home', with: 'Maison'
151
- fill_in 'Search Results', with: 'Résultats de la recherche'
151
+ fill_in 'Search results', with: 'Résultats de la recherche'
152
152
  click_button 'Save changes'
153
153
  end
154
154
  end
@@ -310,7 +310,7 @@ describe 'Translation editing', type: :feature do
310
310
  click_link 'Search field labels'
311
311
 
312
312
  within('#search_fields', visible: true) do
313
- fill_in 'Relevance', with: 'French Relevance'
313
+ fill_in 'relevance', with: 'French Relevance'
314
314
  click_button 'Save changes'
315
315
  end
316
316
 
@@ -330,10 +330,10 @@ describe 'Translation editing', type: :feature do
330
330
 
331
331
  it 'has a title and description for every browse category' do
332
332
  within '#browse' do
333
- expect(page).to have_css('input[type="text"]', count: 2)
333
+ expect(page).to have_css('input[type="text"]', count: 4)
334
334
  expect(page).to have_css('textarea', count: 2)
335
335
 
336
- expect(page).to have_field 'All Exhibit Items'
336
+ expect(page).to have_field 'All exhibit items'
337
337
  expect(page).to have_field 'Browse Category 1'
338
338
  expect(page).to have_css('.form-text', text: 'All items in this exhibit.')
339
339
  end
@@ -342,7 +342,7 @@ describe 'Translation editing', type: :feature do
342
342
  it 'redirects to the same form tab' do
343
343
  click_link 'Browse categories'
344
344
  within('#browse', visible: true) do
345
- fill_in 'All Exhibit Items', with: "Tous les objets d'exposition"
345
+ fill_in 'All exhibit items', with: "Tous les objets d'exposition"
346
346
  click_button 'Save changes'
347
347
  end
348
348
 
@@ -354,7 +354,7 @@ describe 'Translation editing', type: :feature do
354
354
  click_link 'Browse categories'
355
355
 
356
356
  within('#browse', visible: true) do
357
- fill_in 'All Exhibit Items', with: "Tous les objets d'exposition"
357
+ fill_in 'All exhibit items', with: "Tous les objets d'exposition"
358
358
 
359
359
  first('.translation-description-toggle').click
360
360
 
@@ -366,7 +366,7 @@ describe 'Translation editing', type: :feature do
366
366
 
367
367
  expect(page).to have_css('.flash_messages', text: 'The exhibit was successfully updated.')
368
368
 
369
- expect(exhibit.searches.first.title).to eq 'All Exhibit Items'
369
+ expect(exhibit.searches.first.title).to eq 'All exhibit items'
370
370
  expect(exhibit.searches.first.long_description).to eq 'All items in this exhibit.'
371
371
 
372
372
  I18n.locale = :fr
@@ -378,6 +378,55 @@ describe 'Translation editing', type: :feature do
378
378
  end
379
379
  end
380
380
 
381
+ describe 'Browse groups' do
382
+ before do
383
+ FactoryBot.create(:group, exhibit: exhibit, title: 'Browse Group 1')
384
+ FactoryBot.create(:group, exhibit: exhibit, title: 'Browse Group 2')
385
+
386
+ visit spotlight.edit_exhibit_translations_path(exhibit, language: 'fr')
387
+ end
388
+
389
+ it 'has a title browse group' do
390
+ within '#groups' do
391
+ expect(page).to have_css('input[type="text"]', count: 2)
392
+
393
+ expect(page).to have_field 'Browse Group 1'
394
+ expect(page).to have_field 'Browse Group 2'
395
+ end
396
+ end
397
+
398
+ it 'redirects to the same form tab' do
399
+ click_link 'Browse categories'
400
+ within('#groups', visible: true) do
401
+ fill_in 'Browse Group 1', with: 'parcourir le groupe 1'
402
+ click_button 'Save changes'
403
+ end
404
+
405
+ expect(page).to have_css '.nav-pills .nav-link.active', text: 'French'
406
+ expect(page).to have_css '.nav-tabs .nav-link.active', text: 'Browse groups'
407
+ end
408
+
409
+ it 'persists changes', js: true do
410
+ click_link 'Browse groups'
411
+
412
+ within('#groups', visible: true) do
413
+ fill_in 'Browse Group 1', with: 'parcourir le groupe 1'
414
+
415
+ click_button 'Save changes'
416
+ end
417
+
418
+ expect(page).to have_css('.flash_messages', text: 'The exhibit was successfully updated.')
419
+
420
+ expect(exhibit.groups.first.title).to eq 'Browse Group 1'
421
+
422
+ I18n.locale = :fr
423
+ Translation.current_exhibit = exhibit
424
+ expect(exhibit.groups.first.title).to eq 'parcourir le groupe 1'
425
+ I18n.locale = I18n.default_locale
426
+ Translation.current_exhibit = nil
427
+ end
428
+ end
429
+
381
430
  describe 'home page translation table entry' do
382
431
  let(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
383
432
  let(:about_page) { FactoryBot.create(:about_page, exhibit: exhibit) }
@@ -407,7 +456,7 @@ describe 'Translation editing', type: :feature do
407
456
  visit spotlight.edit_exhibit_translations_path(exhibit, language: 'fr')
408
457
  expect(page).to have_link('General 1/8')
409
458
  expect(page).to have_link('Search field labels 0/16')
410
- expect(page).to have_link('Browse categories 0/2')
459
+ expect(page).to have_link('Browse categories 0/3')
411
460
  expect(page).to have_link('Metadata field labels 0/17')
412
461
  end
413
462
  end
@@ -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 Home'
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.home_page)
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.home_page)
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.home_page)
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 Private'
34
- item.click_button 'Make Private'
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 Public'
38
- item.click_button 'Make Public'
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
- add_new_page_via_button('My New Page')
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
- add_new_page_via_button('My New Feature Page')
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: 2)
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
- add_new_page_via_button('My New Feature Page')
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
- add_new_page_via_button('My New Feature Page')
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 Features')
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
- add_new_page_via_button('My New Page')
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')
@@ -8,7 +8,7 @@ describe 'Reindex Monitor', js: true, default_max_wait_time: 10 do
8
8
  let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
9
9
 
10
10
  before do
11
- FactoryBot.create(:in_progress_reindexing_log_entry, exhibit: exhibit, items_reindexed_estimate: 5)
11
+ exhibit.job_trackers.create(resource: exhibit, status: 'completed', job_class: 'Spotlight::ReindexExhibitJob')
12
12
  login_as exhibit_curator
13
13
  visit spotlight.admin_exhibit_catalog_path(exhibit)
14
14
  end
@@ -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('Title')
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 Us', visible: true)
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 'Name', with: 'Some Body'
38
- fill_in 'Email', with: 'test@example.com'
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 'Name', with: 'Some Body'
51
- fill_in 'Email', with: 'test@example.com'
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
 
@@ -44,13 +44,13 @@ describe 'Site users management', js: true do
44
44
 
45
45
  expect(page).to have_css(:td, text: 'not-an-admin@example.com')
46
46
 
47
- expect(page).to have_css(:a, text: 'Remove from admin role', count: 4)
47
+ expect(page).to have_css(:a, text: 'Remove from admin role', count: 2)
48
48
  within(all('table tbody tr:not([data-edit-for])').last) do
49
49
  click_link 'Remove from admin role'
50
50
  end
51
51
 
52
52
  expect(page).to have_content 'User removed from site adminstrator role'
53
- expect(page).to have_css(:a, text: 'Remove from admin role', count: 2)
53
+ expect(page).to have_css(:a, text: 'Remove from admin role', count: 0)
54
54
  end
55
55
 
56
56
  it 'sends an invitation email to users who do not exist' do
@@ -68,7 +68,7 @@ describe 'Site users management', js: true do
68
68
  click_link 'Add new administrator'
69
69
 
70
70
  expect(page).to have_css('td', text: user.email)
71
- # There are two users, the original site admin and our admin user so only one button
72
- expect(page).to have_css(:a, text: 'Remove from admin role', count: 2)
71
+ # There is just our admin user so no button
72
+ expect(page).to have_css(:a, text: 'Remove from admin role', count: 0)
73
73
  end
74
74
  end