blacklight-spotlight 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/app/assets/javascripts/spotlight/blocks/link_to_search_block.js +16 -0
  4. data/app/assets/javascripts/spotlight/exhibits.js +16 -5
  5. data/app/assets/javascripts/spotlight/form_observer.js +2 -2
  6. data/app/assets/javascripts/spotlight/pages.js.erb +3 -2
  7. data/app/assets/javascripts/spotlight/sir-trevor/locales.js +6 -0
  8. data/app/controllers/spotlight/concerns/application_controller.rb +4 -8
  9. data/app/controllers/spotlight/contact_email_controller.rb +22 -0
  10. data/app/controllers/spotlight/searches_controller.rb +3 -1
  11. data/app/models/concerns/spotlight/blacklight_configuration_defaults.rb +4 -4
  12. data/app/models/sir_trevor_rails/blocks/browse_block.rb +7 -1
  13. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +3 -1
  14. data/app/models/sir_trevor_rails/blocks/link_to_search_block.rb +15 -0
  15. data/app/models/spotlight/ability.rb +1 -1
  16. data/app/models/spotlight/blacklight_configuration.rb +8 -7
  17. data/app/models/spotlight/exhibit.rb +2 -0
  18. data/app/models/spotlight/resource.rb +8 -2
  19. data/app/services/spotlight/carrierwave_file_resolver.rb +5 -0
  20. data/app/services/spotlight/upload_solr_document_builder.rb +2 -2
  21. data/app/views/spotlight/appearances/edit.html.erb +1 -1
  22. data/app/views/spotlight/exhibits/_confirmation_status.html.erb +1 -1
  23. data/app/views/spotlight/exhibits/_contact.html.erb +15 -10
  24. data/app/views/spotlight/exhibits/_exhibit_card_back.html.erb +2 -2
  25. data/app/views/spotlight/exhibits/_form.html.erb +7 -6
  26. data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
  27. data/app/views/spotlight/pages/_form.html.erb +1 -1
  28. data/app/views/spotlight/search_configurations/_facets.html.erb +1 -1
  29. data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
  30. data/app/views/spotlight/search_configurations/_sort.html.erb +1 -1
  31. data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +23 -0
  32. data/config/locales/spotlight.en.yml +9 -0
  33. data/config/routes.rb +1 -0
  34. data/db/migrate/20171005231502_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
  35. data/lib/spotlight/engine.rb +4 -3
  36. data/lib/spotlight/version.rb +1 -1
  37. data/spec/controllers/application_controller_spec.rb +1 -1
  38. data/spec/controllers/spotlight/about_pages_controller_spec.rb +15 -15
  39. data/spec/controllers/spotlight/admin_users_controller_spec.rb +4 -4
  40. data/spec/controllers/spotlight/appearances_controller_spec.rb +3 -3
  41. data/spec/controllers/spotlight/application_controller_spec.rb +1 -1
  42. data/spec/controllers/spotlight/attachments_controller_spec.rb +2 -2
  43. data/spec/controllers/spotlight/browse_controller_spec.rb +4 -4
  44. data/spec/controllers/spotlight/catalog_controller_spec.rb +15 -15
  45. data/spec/controllers/spotlight/confirmations_controller_spec.rb +1 -1
  46. data/spec/controllers/spotlight/contact_email_controller_spec.rb +63 -0
  47. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +1 -1
  48. data/spec/controllers/spotlight/contacts_controller_spec.rb +5 -5
  49. data/spec/controllers/spotlight/custom_fields_controller_spec.rb +3 -3
  50. data/spec/controllers/spotlight/dashboards_controller_spec.rb +3 -3
  51. data/spec/controllers/spotlight/exhibits_controller_spec.rb +4 -4
  52. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +12 -12
  53. data/spec/controllers/spotlight/featured_images_controller_spec.rb +2 -2
  54. data/spec/controllers/spotlight/filters_controller_spec.rb +4 -4
  55. data/spec/controllers/spotlight/home_pages_controller_spec.rb +5 -5
  56. data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +3 -3
  57. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +2 -2
  58. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +2 -2
  59. data/spec/controllers/spotlight/resources_controller_spec.rb +2 -2
  60. data/spec/controllers/spotlight/roles_controller_spec.rb +4 -4
  61. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +3 -3
  62. data/spec/controllers/spotlight/searches_controller_spec.rb +10 -11
  63. data/spec/controllers/spotlight/sites_controller_spec.rb +5 -5
  64. data/spec/controllers/spotlight/solr_controller_spec.rb +3 -3
  65. data/spec/controllers/spotlight/tags_controller_spec.rb +3 -3
  66. data/spec/controllers/spotlight/versions_controller_spec.rb +7 -7
  67. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +3 -3
  68. data/spec/examples.txt +1154 -1136
  69. data/spec/factories/contact_emails.rb +6 -0
  70. data/spec/factories/contact_images.rb +1 -1
  71. data/spec/factories/contacts.rb +1 -1
  72. data/spec/factories/custom_fields.rb +1 -1
  73. data/spec/factories/exhibit_thumbnails.rb +1 -1
  74. data/spec/factories/exhibits.rb +2 -2
  75. data/spec/factories/featured_images.rb +1 -1
  76. data/spec/factories/pages.rb +2 -2
  77. data/spec/factories/reindexing_log_entries.rb +1 -1
  78. data/spec/factories/resources.rb +1 -1
  79. data/spec/factories/roles.rb +2 -2
  80. data/spec/factories/searches.rb +3 -3
  81. data/spec/factories/tags.rb +3 -3
  82. data/spec/factories/users.rb +2 -2
  83. data/spec/features/about_page_spec.rb +6 -6
  84. data/spec/features/add_contacts_spec.rb +3 -3
  85. data/spec/features/add_custom_field_metadata_spec.rb +4 -4
  86. data/spec/features/add_iiif_manifest_spec.rb +2 -2
  87. data/spec/features/add_items_spec.rb +4 -4
  88. data/spec/features/autocomplete_typeahead_spec.rb +3 -4
  89. data/spec/features/browse_category_admin_spec.rb +3 -3
  90. data/spec/features/browse_category_spec.rb +3 -3
  91. data/spec/features/catalog_spec.rb +3 -3
  92. data/spec/features/confirm_email_spec.rb +1 -1
  93. data/spec/features/create_exhibit_spec.rb +1 -1
  94. data/spec/features/create_page_spec.rb +5 -5
  95. data/spec/features/curator_items.rb +2 -2
  96. data/spec/features/dashboard_spec.rb +4 -4
  97. data/spec/features/edit_contact_spec.rb +4 -4
  98. data/spec/features/edit_search_fields_spec.rb +2 -2
  99. data/spec/features/exhibit_masthead_spec.rb +2 -2
  100. data/spec/features/exhibit_themes_spec.rb +2 -2
  101. data/spec/features/exhibits/add_tags_spec.rb +3 -3
  102. data/spec/features/exhibits/administration_spec.rb +78 -4
  103. data/spec/features/exhibits/custom_metadata_fields_spec.rb +2 -2
  104. data/spec/features/exhibits/edit_metadata_fields_spec.rb +2 -2
  105. data/spec/features/exhibits_index_spec.rb +3 -3
  106. data/spec/features/feature_page_spec.rb +9 -9
  107. data/spec/features/home_page_spec.rb +4 -4
  108. data/spec/features/import_exhibit_spec.rb +2 -2
  109. data/spec/features/item_admin_spec.rb +2 -2
  110. data/spec/features/javascript/about_page_admin_spec.rb +2 -2
  111. data/spec/features/javascript/block_controls_spec.rb +2 -2
  112. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +5 -5
  113. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +4 -4
  114. data/spec/features/javascript/blocks/link_to_search_block_spec.rb +44 -0
  115. data/spec/features/javascript/{rule_block_spec.rb → blocks/rule_block_spec.rb} +4 -4
  116. data/spec/features/javascript/blocks/search_result_block_spec.rb +4 -4
  117. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +5 -6
  118. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +3 -4
  119. data/spec/features/javascript/edit_in_place_spec.rb +2 -2
  120. data/spec/features/javascript/feature_page_admin_spec.rb +26 -7
  121. data/spec/features/javascript/home_page_edit_spec.rb +3 -3
  122. data/spec/features/javascript/metadata_admin_spec.rb +2 -2
  123. data/spec/features/javascript/multi_image_select_spec.rb +6 -6
  124. data/spec/features/javascript/reindex_monitor_spec.rb +4 -4
  125. data/spec/features/javascript/roles_admin_spec.rb +3 -3
  126. data/spec/features/javascript/search_config_admin_spec.rb +2 -3
  127. data/spec/features/javascript/search_context_spec.rb +6 -6
  128. data/spec/features/main_navigation_spec.rb +2 -2
  129. data/spec/features/metadata_admin_spec.rb +2 -2
  130. data/spec/features/report_a_problem_spec.rb +2 -2
  131. data/spec/features/site_admin_management_spec.rb +4 -4
  132. data/spec/features/site_masthead_spec.rb +1 -1
  133. data/spec/features/slideshow_spec.rb +4 -3
  134. data/spec/features/tags_admin_spec.rb +3 -3
  135. data/spec/features/user_admin_spec.rb +2 -2
  136. data/spec/helpers/spotlight/application_helper_spec.rb +2 -2
  137. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +1 -1
  138. data/spec/helpers/spotlight/main_app_helpers_spec.rb +3 -3
  139. data/spec/helpers/spotlight/meta_helper_spec.rb +1 -1
  140. data/spec/helpers/spotlight/pages_helper_spec.rb +2 -2
  141. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +3 -3
  142. data/spec/jobs/spotlight/reindex_job_spec.rb +3 -3
  143. data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +1 -1
  144. data/spec/lib/migration/iiif_spec.rb +3 -3
  145. data/spec/lib/spotlight/controller_spec.rb +3 -3
  146. data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +19 -1
  147. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +9 -1
  148. data/spec/models/sir_trevor_rails/blocks/search_results_block_spec.rb +1 -1
  149. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +1 -1
  150. data/spec/models/solr_document_spec.rb +2 -2
  151. data/spec/models/spotlight/ability_spec.rb +9 -9
  152. data/spec/models/spotlight/about_page_spec.rb +1 -1
  153. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -1
  154. data/spec/models/spotlight/blacklight_configuration_spec.rb +15 -1
  155. data/spec/models/spotlight/contact_email_spec.rb +1 -1
  156. data/spec/models/spotlight/contact_form_spec.rb +1 -1
  157. data/spec/models/spotlight/contact_spec.rb +1 -1
  158. data/spec/models/spotlight/custom_field_spec.rb +5 -5
  159. data/spec/models/spotlight/exhibit_spec.rb +20 -16
  160. data/spec/models/spotlight/feature_page_spec.rb +14 -14
  161. data/spec/models/spotlight/field_metadata_spec.rb +1 -1
  162. data/spec/models/spotlight/home_page_spec.rb +1 -1
  163. data/spec/models/spotlight/main_navigation_spec.rb +1 -1
  164. data/spec/models/spotlight/page_spec.rb +12 -8
  165. data/spec/models/spotlight/reindex_progress_spec.rb +4 -4
  166. data/spec/models/spotlight/reindexing_log_entry_spec.rb +8 -8
  167. data/spec/models/spotlight/resource_spec.rb +12 -1
  168. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +1 -1
  169. data/spec/models/spotlight/resources/iiif_manifest_spec.rb +1 -1
  170. data/spec/models/spotlight/resources/upload_spec.rb +3 -3
  171. data/spec/models/spotlight/role_spec.rb +3 -3
  172. data/spec/models/spotlight/search_spec.rb +7 -7
  173. data/spec/models/spotlight/sitemap_spec.rb +6 -6
  174. data/spec/models/spotlight/solr_document_sidecar_spec.rb +1 -1
  175. data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +1 -1
  176. data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +20 -20
  177. data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +1 -1
  178. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
  179. data/spec/services/spotlight/solr_document_builder_spec.rb +3 -3
  180. data/spec/spec_helper.rb +4 -5
  181. data/spec/support/features/test_features_helpers.rb +2 -2
  182. data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +1 -1
  183. data/spec/views/_user_util_links.html.erb_spec.rb +1 -1
  184. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +9 -9
  185. data/spec/views/shared/_masthead.html.erb_spec.rb +3 -3
  186. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +4 -4
  187. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +2 -2
  188. data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -2
  189. data/spec/views/spotlight/browse/show.html.erb_spec.rb +2 -2
  190. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +1 -1
  191. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +1 -1
  192. data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +6 -6
  193. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +1 -1
  194. data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +1 -1
  195. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +1 -1
  196. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +6 -6
  197. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +8 -8
  198. data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +1 -1
  199. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +1 -1
  200. data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +1 -1
  201. data/spec/views/spotlight/pages/_form.html.erb_spec.rb +18 -0
  202. data/spec/views/spotlight/roles/index.html.erb_spec.rb +2 -2
  203. data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +14 -2
  204. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +9 -2
  205. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +10 -1
  206. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +8 -8
  207. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +1 -1
  208. data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +1 -1
  209. data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +18 -0
  210. data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +2 -2
  211. data/spec/views/spotlight/tags/index.html.erb_spec.rb +3 -3
  212. metadata +226 -200
  213. data/app/assets/stylesheets/spotlight/application.scss +0 -5
  214. data/vendor/assets/javascripts/leaflet.js +0 -9
  215. data/vendor/assets/stylesheets/leaflet.css +0 -624
@@ -1,7 +1,7 @@
1
1
 
2
2
  describe 'Adding custom metadata fields', type: :feature do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
+ let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
5
5
 
6
6
  before do
7
7
  login_as(admin)
@@ -1,7 +1,7 @@
1
1
 
2
2
  describe 'Editing metadata fields', type: :feature do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
+ let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
5
5
  before { login_as(admin) }
6
6
 
7
7
  it 'works' do
@@ -1,7 +1,7 @@
1
1
  describe 'Exhibits index page', type: :feature do
2
2
  context 'with multiple exhibits' do
3
- let!(:exhibit) { FactoryGirl.create(:exhibit, title: 'Some Exhibit Title') }
4
- let!(:other_exhibit) { FactoryGirl.create(:exhibit, title: 'Some Other Title') }
3
+ let!(:exhibit) { FactoryBot.create(:exhibit, title: 'Some Exhibit Title') }
4
+ let!(:other_exhibit) { FactoryBot.create(:exhibit, title: 'Some Other Title') }
5
5
 
6
6
  it 'shows some cards for each published exhibit' do
7
7
  visit spotlight.exhibits_path
@@ -44,7 +44,7 @@ describe 'Exhibits index page', type: :feature do
44
44
  end
45
45
 
46
46
  context 'with a single exhibit' do
47
- let!(:exhibit) { FactoryGirl.create(:exhibit, title: 'Some Exhibit Title') }
47
+ let!(:exhibit) { FactoryBot.create(:exhibit, title: 'Some Exhibit Title') }
48
48
 
49
49
  it 'redirects to the exhibit home page' do
50
50
  visit spotlight.exhibits_path
@@ -1,10 +1,10 @@
1
- describe 'Feature page', type: :feature do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
1
+ describe 'Feature page', type: :feature, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
 
5
5
  describe 'viewing the page' do
6
6
  let!(:feature_page) do
7
- FactoryGirl.create(:feature_page, title: 'Parent Page', exhibit: exhibit)
7
+ FactoryBot.create(:feature_page, title: 'Parent Page', exhibit: exhibit)
8
8
  end
9
9
  it 'has <meta> tags' do
10
10
  TopHat.current['twitter_card'] = nil
@@ -21,10 +21,10 @@ describe 'Feature page', type: :feature do
21
21
 
22
22
  describe 'sidebar' do
23
23
  let!(:parent_feature_page) do
24
- FactoryGirl.create(:feature_page, title: 'Parent Page', exhibit: exhibit)
24
+ FactoryBot.create(:feature_page, title: 'Parent Page', exhibit: exhibit)
25
25
  end
26
26
  let!(:child_feature_page) do
27
- FactoryGirl.create(
27
+ FactoryBot.create(
28
28
  :feature_page,
29
29
  title: 'Child Page',
30
30
  parent_page: parent_feature_page, exhibit: exhibit
@@ -71,7 +71,7 @@ describe 'Feature page', type: :feature do
71
71
  describe 'page options' do
72
72
  before { login_as exhibit_curator }
73
73
  describe 'publish' do
74
- let!(:unpublished_page) { FactoryGirl.create(:feature_page, published: false, exhibit: exhibit) }
74
+ let!(:unpublished_page) { FactoryBot.create(:feature_page, published: false, exhibit: exhibit) }
75
75
  it 'is updatable from the edit page' do
76
76
  expect(unpublished_page).not_to be_published
77
77
 
@@ -88,7 +88,7 @@ describe 'Feature page', type: :feature do
88
88
  end
89
89
  end
90
90
  describe 'display_sidebar' do
91
- let!(:feature_page) { FactoryGirl.create(:feature_page, display_sidebar: false, exhibit: exhibit) }
91
+ let!(:feature_page) { FactoryBot.create(:feature_page, display_sidebar: false, exhibit: exhibit) }
92
92
  before { feature_page.update display_sidebar: false }
93
93
  it 'is updatable from the edit page' do
94
94
  expect(feature_page.display_sidebar?).to be_falsey
@@ -109,7 +109,7 @@ describe 'Feature page', type: :feature do
109
109
 
110
110
  describe 'page locking' do
111
111
  before { login_as exhibit_curator }
112
- let!(:feature_page) { FactoryGirl.create(:feature_page, display_sidebar: false, exhibit: exhibit) }
112
+ let!(:feature_page) { FactoryBot.create(:feature_page, display_sidebar: false, exhibit: exhibit) }
113
113
 
114
114
  it 'shows a lock message if someone is currently editing the page' do
115
115
  # open the edit page
@@ -1,6 +1,6 @@
1
- describe 'Home page', type: :feature do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
1
+ describe 'Home page', type: :feature, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  before { login_as exhibit_curator }
5
5
  it 'exists by default on exhibits' do
6
6
  visit spotlight.exhibit_dashboard_path(exhibit)
@@ -58,7 +58,7 @@ describe 'Home page', type: :feature do
58
58
 
59
59
  describe 'page options on edit form' do
60
60
  describe 'show title' do
61
- let(:home_page) { FactoryGirl.create(:home_page, display_title: false, exhibit: exhibit) }
61
+ let(:home_page) { FactoryBot.create(:home_page, display_title: false, exhibit: exhibit) }
62
62
  it 'is updatable from the edit page' do
63
63
  expect(home_page.display_title).to be_falsey
64
64
 
@@ -1,8 +1,8 @@
1
1
  require 'tempfile'
2
2
 
3
3
  describe 'Allow exhibit admins to import and export content from an exhibit', type: :feature, js: true do
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
5
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
4
+ let(:exhibit) { FactoryBot.create(:exhibit) }
5
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
6
6
  before { login_as user }
7
7
 
8
8
  pending 'should allow admins to export content from an exhibit' do
@@ -1,6 +1,6 @@
1
1
  describe 'Item Administration', type: :feature do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  before { login_as curator }
5
5
 
6
6
  before do
@@ -1,6 +1,6 @@
1
1
  feature 'About Pages Adminstration', js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  before { login_as exhibit_curator }
5
5
 
6
6
  it 'is able to create new pages' do
@@ -1,6 +1,6 @@
1
1
  feature 'Block controls' do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  before { login_as exhibit_curator }
5
5
 
6
6
  scenario 'should be split into separate sections', js: true do
@@ -1,11 +1,11 @@
1
1
 
2
2
  describe 'Featured Browse Category Block', type: :feature, js: true do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
5
5
 
6
- let!(:feature_page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
7
- let!(:search1) { FactoryGirl.create(:published_search, exhibit: exhibit, title: 'Title1', published: true) }
8
- let!(:search2) { FactoryGirl.create(:published_search, exhibit: exhibit, title: 'Title2', published: true) }
6
+ let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
7
+ let!(:search1) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'Title1', published: true) }
8
+ let!(:search2) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'Title2', published: true) }
9
9
 
10
10
  before do
11
11
  login_as exhibit_curator
@@ -1,8 +1,8 @@
1
1
 
2
2
  describe 'Featured Pages Blocks', type: :feature, js: true do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
  let!(:feature_page1) do
5
- FactoryGirl.create(
5
+ FactoryBot.create(
6
6
  :feature_page,
7
7
  title: 'FeaturePage1 Title',
8
8
  weight: 1,
@@ -10,7 +10,7 @@ describe 'Featured Pages Blocks', type: :feature, js: true do
10
10
  )
11
11
  end
12
12
  let!(:feature_page2) do
13
- FactoryGirl.create(
13
+ FactoryBot.create(
14
14
  :feature_page,
15
15
  title: 'FeaturePage2 Title',
16
16
  weight: 0,
@@ -18,7 +18,7 @@ describe 'Featured Pages Blocks', type: :feature, js: true do
18
18
  )
19
19
  end
20
20
 
21
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
21
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
22
22
 
23
23
  before do
24
24
  login_as exhibit_curator
@@ -0,0 +1,44 @@
1
+ describe 'Link to Search Block', type: :feature, js: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
+
5
+ let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
6
+ let!(:search1) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'Title1', published: true) }
7
+ let!(:search2) { FactoryBot.create(:published_search, exhibit: exhibit, title: 'Title2', published: true) }
8
+
9
+ before do
10
+ login_as exhibit_curator
11
+
12
+ visit spotlight.edit_exhibit_feature_page_path(exhibit, feature_page)
13
+ add_widget 'link_to_search'
14
+ end
15
+
16
+ pending 'allows a curator to select from existing browse categories' do
17
+ pending('Prefetched autocomplete does not work the same way as solr-backed autocompletes')
18
+ check 'Include item counts?'
19
+
20
+ fill_in_typeahead_field with: 'Title1'
21
+
22
+ within(:css, '.panel') do
23
+ uncheck 'Display?'
24
+ end
25
+
26
+ fill_in_typeahead_field with: 'Title2'
27
+
28
+ save_page
29
+
30
+ # Documents should exist
31
+ expect(page).not_to have_css('.category-title', text: search1.title)
32
+ expect(page).to have_css('.category-title', text: search2.title)
33
+ expect(page).to have_css('.item-count', text: /\d+ items/i)
34
+ end
35
+
36
+ pending 'allows the curator to omit document counts' do
37
+ pending('Prefetched autocomplete does not work the same way as solr-backed autocompletes')
38
+ uncheck 'Include item counts?'
39
+ fill_in_typeahead_field with: 'Title1'
40
+ save_page
41
+
42
+ expect(page).not_to have_css('.item-count', text: /\d+ items/i)
43
+ end
44
+ end
@@ -1,7 +1,7 @@
1
- describe 'Horizontal rule block', type: :feature, js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
4
- let!(:feature_page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
1
+ describe 'Horizontal rule block', type: :feature, js: true, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
+ let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
5
5
  before { login_as exhibit_curator }
6
6
 
7
7
  it 'allows the user to select which image in a multi image object to display' do
@@ -1,10 +1,10 @@
1
1
 
2
2
  describe 'Search Result Block', type: :feature, js: true do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
5
5
 
6
- let!(:feature_page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
7
- let!(:alt_search) { FactoryGirl.create(:search, title: 'Alt. Search', exhibit: exhibit) }
6
+ let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
7
+ let!(:alt_search) { FactoryBot.create(:search, title: 'Alt. Search', exhibit: exhibit) }
8
8
 
9
9
  before do
10
10
  login_as exhibit_curator
@@ -1,9 +1,8 @@
1
-
2
- feature 'Solr Document Block', feature: true do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
1
+ feature 'Solr Document Block', feature: true, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
5
4
  let(:feature_page) do
6
- FactoryGirl.create(
5
+ FactoryBot.create(
7
6
  :feature_page,
8
7
  title: 'FeaturePage1',
9
8
  exhibit: exhibit
@@ -58,7 +57,7 @@ feature 'Solr Document Block', feature: true do
58
57
 
59
58
  # Select the last image
60
59
  click_link('Change')
61
- all('.thumbs-list li').last.click
60
+ find('.thumbs-list li:last-child').click
62
61
 
63
62
  save_page
64
63
 
@@ -1,7 +1,6 @@
1
-
2
- feature 'Uploaded Items Block', feature: true, js: true do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
1
+ feature 'Uploaded Items Block', feature: true, js: true, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
5
4
  let(:fixture_file1) { File.join(FIXTURES_PATH, '800x600.png') }
6
5
  let(:fixture_file2) { File.join(FIXTURES_PATH, 'avatar.png') }
7
6
 
@@ -1,6 +1,6 @@
1
1
  describe 'Edit in place', type: :feature, js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as admin }
5
5
  describe 'Feature Pages' do
6
6
  it 'updates the label' do
@@ -1,15 +1,15 @@
1
1
  feature 'Feature Pages Adminstration', js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  let!(:page1) do
5
- FactoryGirl.create(
5
+ FactoryBot.create(
6
6
  :feature_page,
7
7
  title: 'FeaturePage1',
8
8
  exhibit: exhibit
9
9
  )
10
10
  end
11
11
  let!(:page2) do
12
- FactoryGirl.create(
12
+ FactoryBot.create(
13
13
  :feature_page,
14
14
  title: 'FeaturePage2',
15
15
  exhibit: exhibit,
@@ -53,21 +53,34 @@ feature 'Feature Pages Adminstration', js: true do
53
53
  end
54
54
 
55
55
  it 'stays in curation mode if a user has unsaved data' do
56
+ pending('Spec does not work with chromedriver')
56
57
  visit spotlight.edit_exhibit_feature_page_path(page1.exhibit, page1)
57
58
 
59
+ # Hack to bypass alert about unsaved changes
60
+ page.evaluate_script('function observedFormsStatusHasChanged() { return false; }')
61
+
58
62
  fill_in('Title', with: 'Some Fancy Title')
59
- click_link 'Cancel'
63
+
64
+ page.accept_confirm do
65
+ click_link 'Cancel'
66
+ end
60
67
  expect(page).not_to have_selector 'a', text: 'Edit'
61
68
  end
62
69
 
63
70
  it 'stays in curation mode if a user has unsaved contenteditable data' do
71
+ pending('Spec does not work with chromedriver')
64
72
  visit spotlight.edit_exhibit_feature_page_path(page1.exhibit, page1)
65
73
 
74
+ # Hack to bypass alert about unsaved changes
75
+ page.evaluate_script('function observedFormsStatusHasChanged() { return false; }')
76
+
66
77
  add_widget 'solr_documents'
67
78
  content_editable = find('.st-text-block')
68
79
  content_editable.set('Some Fancy Text.')
69
80
 
70
- click_link 'Cancel'
81
+ page.accept_confirm do
82
+ click_link 'Cancel'
83
+ end
71
84
  expect(page).not_to have_selector 'a', text: 'Edit'
72
85
  end
73
86
 
@@ -75,6 +88,10 @@ feature 'Feature Pages Adminstration', js: true do
75
88
  visit spotlight.exhibit_dashboard_path(exhibit)
76
89
 
77
90
  click_link 'Feature pages'
91
+
92
+ # Hack to bypass alert about unsaved changes
93
+ page.evaluate_script('function observedFormsStatusHasChanged() { return false; }')
94
+
78
95
  within("[data-id='#{page1.id}']") do
79
96
  within('h3') do
80
97
  expect(page).to have_content('FeaturePage1')
@@ -86,7 +103,9 @@ feature 'Feature Pages Adminstration', js: true do
86
103
  end
87
104
 
88
105
  within '#exhibit-navbar' do
89
- click_link 'Home'
106
+ page.accept_alert do
107
+ click_link 'Home'
108
+ end
90
109
  end
91
110
  expect(page).not_to have_content('Feature pages were successfully updated.')
92
111
  # NOTE: get flash message about unsaved changes
@@ -1,6 +1,6 @@
1
- feature 'Editing the Home Page', js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
1
+ feature 'Editing the Home Page', js: true, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
 
5
5
  before { login_as admin }
6
6
 
@@ -1,6 +1,6 @@
1
1
  feature 'Metadata Administration', js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as admin }
5
5
  describe 'Select/Deselect all button' do
6
6
  it 'deselects all checkboxes when all are selected' do
@@ -1,7 +1,7 @@
1
- describe 'Multi image selector', type: :feature, js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
4
- let(:feature_page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
1
+ describe 'Multi image selector', type: :feature, js: true, versioning: true do
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
+ let(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
5
5
  before { login_as exhibit_curator }
6
6
 
7
7
  it 'allows the user to select which image in a multi image object to display' do
@@ -29,13 +29,13 @@ describe 'Multi image selector', type: :feature, js: true do
29
29
 
30
30
  within('.panel') do
31
31
  expect(page).to have_content(/Image \d of \d/)
32
- find('a', text: 'Change').trigger('click')
32
+ find('a', text: 'Change').click
33
33
  end
34
34
 
35
35
  expect(page).to have_css('.thumbs-list ul', visible: true)
36
36
 
37
37
  within('.thumbs-list ul') do
38
- all('li')[1].trigger('click')
38
+ all('li')[1].click
39
39
  end
40
40
 
41
41
  save_page