blacklight-spotlight 2.13.0 → 3.0.0.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/blacklight/add_circle.svg +1 -0
  3. data/app/assets/images/blacklight/arrow_back_ios.svg +1 -0
  4. data/app/assets/images/blacklight/arrow_forward_ios.svg +1 -0
  5. data/app/assets/images/blacklight/check.svg +1 -0
  6. data/app/assets/images/blacklight/check_circle.svg +1 -0
  7. data/app/assets/images/blacklight/chevron_right.svg +1 -0
  8. data/app/assets/images/blacklight/custom_fullscreen.svg +1 -0
  9. data/app/assets/images/blacklight/edit.svg +1 -0
  10. data/app/assets/images/blacklight/error.svg +1 -0
  11. data/app/assets/images/blacklight/info.svg +1 -0
  12. data/app/assets/images/blacklight/remove_circle.svg +1 -0
  13. data/app/assets/images/blacklight/remove_circle_outline.svg +1 -0
  14. data/app/assets/images/blacklight/resize_small.svg +1 -0
  15. data/app/assets/images/blacklight/warning.svg +1 -0
  16. data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +1 -1
  17. data/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +2 -2
  18. data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +1 -1
  19. data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
  20. data/app/assets/javascripts/spotlight/admin/blocks/resources_block.js +7 -7
  21. data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +3 -3
  22. data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -7
  23. data/app/assets/javascripts/spotlight/admin/catalog_edit.js +2 -2
  24. data/app/assets/javascripts/spotlight/admin/multi_image_selector.js +2 -2
  25. data/app/assets/javascripts/spotlight/admin/reindex_monitor.js +1 -1
  26. data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
  27. data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +1 -1
  28. data/app/assets/javascripts/spotlight/admin/users.js +1 -1
  29. data/app/assets/javascripts/spotlight/user/index.js +1 -0
  30. data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +6 -6
  31. data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +44 -4
  32. data/app/assets/stylesheets/spotlight/_blacklight_overrides.scss +4 -8
  33. data/app/assets/stylesheets/spotlight/_bootstrap_overrides.scss +31 -14
  34. data/app/assets/stylesheets/spotlight/_browse.scss +16 -13
  35. data/app/assets/stylesheets/spotlight/_catalog.scss +13 -7
  36. data/app/assets/stylesheets/spotlight/_collapse_toggle.scss +10 -14
  37. data/app/assets/stylesheets/spotlight/_curation.scss +34 -32
  38. data/app/assets/stylesheets/spotlight/_exhibit_admin.scss +4 -29
  39. data/app/assets/stylesheets/spotlight/_exhibits_index.scss +16 -14
  40. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +22 -20
  41. data/app/assets/stylesheets/spotlight/_footer.scss +2 -2
  42. data/app/assets/stylesheets/spotlight/_header.scss +18 -39
  43. data/app/assets/stylesheets/spotlight/_item_text_block.scss +1 -24
  44. data/app/assets/stylesheets/spotlight/_mixins.scss +3 -8
  45. data/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +1 -1
  46. data/app/assets/stylesheets/spotlight/_nestable.scss +1 -2
  47. data/app/assets/stylesheets/spotlight/_pages.scss +33 -54
  48. data/app/assets/stylesheets/spotlight/_report_a_problem.scss +7 -1
  49. data/app/assets/stylesheets/spotlight/_sir-trevor_overrides.scss +9 -9
  50. data/app/assets/stylesheets/spotlight/_slideshow_block.scss +13 -11
  51. data/app/assets/stylesheets/spotlight/_spotlight.scss +0 -1
  52. data/app/assets/stylesheets/spotlight/_translations.scss +12 -12
  53. data/app/assets/stylesheets/spotlight/_variables.scss +14 -15
  54. data/app/assets/stylesheets/spotlight/_variables_bootstrap.scss +7 -7
  55. data/app/assets/stylesheets/spotlight/typeahead.css +1 -1
  56. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +3 -2
  57. data/app/controllers/concerns/spotlight/catalog.rb +1 -1
  58. data/app/controllers/concerns/spotlight/controller.rb +3 -3
  59. data/app/controllers/concerns/spotlight/search_helper.rb +23 -0
  60. data/app/controllers/spotlight/browse_controller.rb +18 -4
  61. data/app/controllers/spotlight/catalog_controller.rb +13 -17
  62. data/app/controllers/spotlight/dashboards_controller.rb +5 -1
  63. data/app/controllers/spotlight/exhibits_controller.rb +1 -1
  64. data/app/controllers/spotlight/home_pages_controller.rb +32 -3
  65. data/app/controllers/spotlight/pages_controller.rb +19 -1
  66. data/app/controllers/spotlight/search_configurations_controller.rb +3 -3
  67. data/app/controllers/spotlight/searches_controller.rb +4 -1
  68. data/app/controllers/spotlight/solr_controller.rb +1 -2
  69. data/app/helpers/spotlight/application_helper.rb +1 -1
  70. data/app/helpers/spotlight/browse_helper.rb +1 -1
  71. data/app/helpers/spotlight/crud_link_helpers.rb +19 -0
  72. data/app/helpers/spotlight/pages_helper.rb +1 -1
  73. data/app/mailers/spotlight/contact_mailer.rb +1 -1
  74. data/app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb +2 -2
  75. data/app/models/concerns/spotlight/exhibit_analytics.rb +1 -3
  76. data/app/models/concerns/spotlight/exhibit_documents.rb +1 -1
  77. data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +11 -3
  78. data/app/models/spotlight/ability.rb +1 -1
  79. data/app/models/spotlight/analytics/ga.rb +25 -35
  80. data/app/models/spotlight/analytics/ga_model.rb +29 -0
  81. data/app/models/spotlight/blacklight_configuration.rb +5 -3
  82. data/app/models/spotlight/contact_form.rb +11 -4
  83. data/app/models/spotlight/exhibit.rb +0 -4
  84. data/app/models/spotlight/field_metadata.rb +3 -9
  85. data/app/models/spotlight/page.rb +0 -3
  86. data/app/models/spotlight/page_configurations.rb +1 -1
  87. data/app/models/spotlight/role.rb +0 -4
  88. data/app/models/spotlight/search.rb +3 -17
  89. data/app/presenters/spotlight/iiif_manifest_presenter.rb +5 -1
  90. data/app/serializers/spotlight/exhibit_export_serializer.rb +69 -28
  91. data/app/serializers/spotlight/page_representer.rb +1 -1
  92. data/app/views/catalog/_save_search.html.erb +6 -4
  93. data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
  94. data/app/views/layouts/spotlight/base.html.erb +48 -0
  95. data/app/views/layouts/spotlight/spotlight.html.erb +16 -54
  96. data/app/views/shared/_about_navbar.html.erb +2 -2
  97. data/app/views/shared/_browse_navbar.html.erb +2 -2
  98. data/app/views/shared/_curated_features_navbar.html.erb +4 -4
  99. data/app/views/shared/_exhibit_navbar.html.erb +5 -5
  100. data/app/views/shared/_header_navbar.html.erb +8 -13
  101. data/app/views/shared/_masthead.html.erb +1 -1
  102. data/app/views/shared/_site_sidebar.html.erb +6 -6
  103. data/app/views/shared/_user_util_links.html.erb +47 -0
  104. data/app/views/spotlight/about_pages/_contact.html.erb +3 -4
  105. data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
  106. data/app/views/spotlight/about_pages/_sidebar.html.erb +3 -5
  107. data/app/views/spotlight/about_pages/index.html.erb +7 -6
  108. data/app/views/spotlight/admin_users/index.html.erb +78 -79
  109. data/app/views/spotlight/appearances/edit.html.erb +26 -23
  110. data/app/views/spotlight/browse/_search.html.erb +2 -2
  111. data/app/views/spotlight/browse/_search_box.html.erb +9 -6
  112. data/app/views/spotlight/browse/_search_title.html.erb +1 -1
  113. data/app/views/spotlight/browse/_sort_and_per_page.html.erb +3 -5
  114. data/app/views/spotlight/browse/index.html.erb +4 -6
  115. data/app/views/spotlight/browse/show.html.erb +1 -1
  116. data/app/views/spotlight/catalog/_admin_header.html.erb +2 -2
  117. data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
  118. data/app/views/spotlight/catalog/_document_admin_table.html.erb +4 -4
  119. data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
  120. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -2
  121. data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +3 -5
  122. data/app/views/spotlight/catalog/admin.html.erb +12 -12
  123. data/app/views/spotlight/contact_forms/new.html.erb +1 -3
  124. data/app/views/spotlight/contacts/edit.html.erb +6 -5
  125. data/app/views/spotlight/contacts/new.html.erb +6 -5
  126. data/app/views/spotlight/custom_fields/edit.html.erb +6 -5
  127. data/app/views/spotlight/custom_fields/new.html.erb +6 -5
  128. data/app/views/spotlight/dashboards/_analytics.html.erb +3 -3
  129. data/app/views/spotlight/dashboards/_page.html.erb +6 -6
  130. data/app/views/spotlight/dashboards/_page_activity.html.erb +5 -5
  131. data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +12 -12
  132. data/app/views/spotlight/dashboards/analytics.html.erb +11 -11
  133. data/app/views/spotlight/dashboards/show.html.erb +13 -13
  134. data/app/views/spotlight/exhibits/_confirmation_status.html.erb +3 -4
  135. data/app/views/spotlight/exhibits/_contact.html.erb +3 -3
  136. data/app/views/spotlight/exhibits/_delete.html.erb +7 -5
  137. data/app/views/spotlight/exhibits/_exhibit_card.html.erb +2 -2
  138. data/app/views/spotlight/exhibits/_exhibit_card_front.html.erb +2 -2
  139. data/app/views/spotlight/exhibits/_form.html.erb +5 -5
  140. data/app/views/spotlight/exhibits/_languages.html.erb +2 -2
  141. data/app/views/spotlight/exhibits/_new_exhibit_form.html.erb +0 -2
  142. data/app/views/spotlight/exhibits/edit.html.erb +43 -42
  143. data/app/views/spotlight/exhibits/index.html.erb +40 -41
  144. data/app/views/spotlight/exhibits/new.html.erb +4 -5
  145. data/app/views/spotlight/feature_pages/_header.html.erb +12 -14
  146. data/app/views/spotlight/feature_pages/_sidebar.html.erb +2 -4
  147. data/app/views/spotlight/featured_images/_form.html.erb +4 -4
  148. data/app/views/spotlight/filters/_form.html.erb +1 -1
  149. data/app/views/spotlight/home_pages/_edit_page_link.html.erb +1 -1
  150. data/app/views/spotlight/home_pages/_sidebar.html.erb +1 -3
  151. data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +4 -4
  152. data/app/views/spotlight/metadata_configurations/edit.html.erb +5 -4
  153. data/app/views/spotlight/pages/_edit_page_link.html.erb +1 -1
  154. data/app/views/spotlight/pages/_form.html.erb +7 -7
  155. data/app/views/spotlight/pages/_order_pages.html.erb +2 -2
  156. data/app/views/spotlight/pages/_page.html.erb +11 -11
  157. data/app/views/spotlight/pages/_view_type_group.html.erb +1 -1
  158. data/app/views/spotlight/pages/edit.html.erb +2 -4
  159. data/app/views/spotlight/pages/index.html.erb +5 -4
  160. data/app/views/spotlight/pages/show.html.erb +5 -4
  161. data/app/views/spotlight/resources/_external_resources_form.html.erb +2 -2
  162. data/app/views/spotlight/resources/_form.html.erb +1 -1
  163. data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
  164. data/app/views/spotlight/resources/iiif/_form.html.erb +1 -1
  165. data/app/views/spotlight/resources/json_upload/_form.html.erb +1 -1
  166. data/app/views/spotlight/resources/new.html.erb +25 -23
  167. data/app/views/spotlight/resources/upload/_form.html.erb +2 -2
  168. data/app/views/spotlight/roles/index.html.erb +60 -57
  169. data/app/views/spotlight/search_configurations/_facet_metadata.html.erb +3 -1
  170. data/app/views/spotlight/search_configurations/_facets.html.erb +19 -18
  171. data/app/views/spotlight/search_configurations/_search_fields.html.erb +6 -6
  172. data/app/views/spotlight/search_configurations/_sort.html.erb +6 -6
  173. data/app/views/spotlight/search_configurations/edit.html.erb +42 -40
  174. data/app/views/spotlight/searches/_form.html.erb +15 -10
  175. data/app/views/spotlight/searches/_search.html.erb +29 -22
  176. data/app/views/spotlight/searches/edit.html.erb +6 -5
  177. data/app/views/spotlight/searches/index.html.erb +32 -31
  178. data/app/views/spotlight/shared/_configuration_sidebar.html.erb +6 -6
  179. data/app/views/spotlight/shared/_curation_sidebar.html.erb +8 -9
  180. data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +6 -8
  181. data/app/views/spotlight/shared/_locale_picker.html.erb +3 -3
  182. data/app/views/spotlight/shared/_report_a_problem.html.erb +2 -2
  183. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
  184. data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
  185. data/app/views/spotlight/sir_trevor/blocks/_oembed_block.html.erb +2 -2
  186. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
  187. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +8 -8
  188. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +8 -8
  189. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb +3 -4
  190. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +32 -31
  191. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +5 -5
  192. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +8 -10
  193. data/app/views/spotlight/sites/edit.html.erb +31 -34
  194. data/app/views/spotlight/sites/edit_exhibits.html.erb +28 -29
  195. data/app/views/spotlight/tags/index.html.erb +25 -24
  196. data/app/views/spotlight/translations/_browse_categories.html.erb +20 -15
  197. data/app/views/spotlight/translations/_general.html.erb +69 -91
  198. data/app/views/spotlight/translations/_metadata.html.erb +18 -14
  199. data/app/views/spotlight/translations/_page.html.erb +2 -2
  200. data/app/views/spotlight/translations/_search_fields.html.erb +26 -20
  201. data/app/views/spotlight/translations/edit.html.erb +16 -14
  202. data/config/locales/spotlight.en.yml +3 -0
  203. data/config/routes.rb +1 -1
  204. data/lib/generators/spotlight/install_generator.rb +2 -2
  205. data/lib/generators/spotlight/scaffold_resource_generator.rb +1 -1
  206. data/lib/generators/spotlight/templates/spotlight.scss +0 -1
  207. data/lib/spotlight/engine.rb +12 -0
  208. data/lib/spotlight/version.rb +1 -1
  209. data/spec/controllers/application_controller_spec.rb +2 -2
  210. data/spec/controllers/spotlight/browse_controller_spec.rb +1 -1
  211. data/spec/controllers/spotlight/catalog_controller_spec.rb +13 -13
  212. data/spec/controllers/spotlight/dashboards_controller_spec.rb +2 -1
  213. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +1 -1
  214. data/spec/examples.txt +50 -1489
  215. data/spec/features/add_items_spec.rb +2 -2
  216. data/spec/features/browse_category_admin_spec.rb +3 -3
  217. data/spec/features/browse_category_spec.rb +3 -3
  218. data/spec/features/catalog_spec.rb +1 -1
  219. data/spec/features/exhibits/translation_editing_spec.rb +21 -21
  220. data/spec/features/feature_page_spec.rb +1 -1
  221. data/spec/features/home_page_spec.rb +3 -3
  222. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +1 -1
  223. data/spec/features/javascript/blocks/link_to_search_block_spec.rb +1 -1
  224. data/spec/features/javascript/blocks/search_result_block_spec.rb +9 -4
  225. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +23 -15
  226. data/spec/features/javascript/blocks/solr_documents_carousel_block_spec.rb +29 -0
  227. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +2 -2
  228. data/spec/features/javascript/edit_in_place_spec.rb +1 -0
  229. data/spec/features/javascript/feature_page_admin_spec.rb +11 -11
  230. data/spec/features/javascript/locale_selector_spec.rb +0 -1
  231. data/spec/features/javascript/multi_image_select_spec.rb +3 -3
  232. data/spec/features/javascript/reindex_monitor_spec.rb +2 -2
  233. data/spec/features/javascript/roles_admin_spec.rb +2 -2
  234. data/spec/features/javascript/search_context_spec.rb +4 -6
  235. data/spec/features/site_users_management_spec.rb +1 -1
  236. data/spec/helpers/spotlight/application_helper_spec.rb +2 -1
  237. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +19 -0
  238. data/spec/helpers/spotlight/languages_helper_spec.rb +1 -0
  239. data/spec/lib/spotlight/controller_spec.rb +2 -2
  240. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +38 -0
  241. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +7 -6
  242. data/spec/models/spotlight/analytics/ga_spec.rb +16 -1
  243. data/spec/models/spotlight/contact_form_spec.rb +37 -5
  244. data/spec/models/spotlight/exhibit_spec.rb +8 -4
  245. data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +4 -0
  246. data/spec/routing/spotlight/exhibit_catalog_spec.rb +15 -11
  247. data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +60 -0
  248. data/spec/test_app_templates/Gemfile.extra +3 -0
  249. data/spec/test_app_templates/catalog_controller.rb +4 -0
  250. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
  251. data/spec/views/shared/_header_navbar.html.erb_spec.rb +1 -1
  252. data/spec/views/shared/_masthead.html.erb_spec.rb +1 -1
  253. data/spec/views/{_user_util_links.html.erb_spec.rb → shared/_user_util_links.html.erb_spec.rb} +1 -1
  254. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +2 -2
  255. data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +2 -2
  256. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +1 -1
  257. data/spec/views/spotlight/browse/_sort_and_per_page.html.erb_spec.rb +2 -13
  258. data/spec/views/spotlight/browse/show.html.erb_spec.rb +2 -2
  259. data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +1 -1
  260. data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +5 -5
  261. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +1 -1
  262. data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +2 -2
  263. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +1 -1
  264. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +1 -1
  265. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +7 -7
  266. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -2
  267. data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +2 -1
  268. data/spec/views/spotlight/pages/index.html.erb_spec.rb +2 -2
  269. data/spec/views/spotlight/pages/show.html.erb_spec.rb +3 -3
  270. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +1 -1
  271. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +3 -3
  272. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +3 -3
  273. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +1 -1
  274. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +2 -2
  275. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +1 -1
  276. data/spec/views/spotlight/translations/_page.html.erb_spec.rb +2 -2
  277. data/vendor/assets/javascripts/bootstrap-tagsinput.js +1 -1
  278. data/vendor/assets/stylesheets/sir-trevor/_variables.scss +15 -8
  279. metadata +31 -28
  280. data/app/assets/stylesheets/spotlight/_navbar.scss +0 -48
  281. data/app/views/_user_util_links.html.erb +0 -50
  282. data/app/views/shared/_modal.html.erb +0 -6
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legato'
4
+
5
+ module Spotlight
6
+ module Analytics
7
+ ##
8
+ # Google Analytics data model for the Exhibit dashboard
9
+ class GaModel
10
+ extend Legato::Model
11
+
12
+ metrics :sessions, :users, :pageviews
13
+
14
+ def self.context(exhibit)
15
+ if exhibit.is_a? Spotlight::Exhibit
16
+ for_exhibit(exhibit)
17
+ else
18
+ path(exhibit)
19
+ end
20
+ end
21
+
22
+ def self.for_exhibit(exhibit)
23
+ path(Spotlight::Engine.routes.url_helpers.exhibit_path(exhibit))
24
+ end
25
+
26
+ filter :path, &->(path) { contains(:pagePath, "^#{path}") }
27
+ end
28
+ end
29
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'blacklight/utils'
3
+ require 'blacklight/open_struct_with_hash_access'
4
4
 
5
5
  module Spotlight
6
6
  ##
@@ -70,7 +70,9 @@ module Spotlight
70
70
  def blacklight_config
71
71
  @blacklight_config ||= begin
72
72
  # Create a new config based on the defaults
73
- config = default_blacklight_config.inheritable_copy
73
+ config = default_blacklight_config.inheritable_copy(self.class)
74
+
75
+ config.current_exhibit = exhibit
74
76
 
75
77
  config.show.merge! show unless show.blank?
76
78
  config.index.merge! index unless index.blank?
@@ -291,7 +293,7 @@ module Spotlight
291
293
  # rubocop:disable Style/GuardClause
292
294
  unless config.show_fields.include? :exhibit_tags
293
295
  config.add_show_field :exhibit_tags, field: config.document_model.solr_field_for_tagger(exhibit),
294
- link_to_search: true,
296
+ link_to_facet: true,
295
297
  separator_options: { words_connector: nil, two_words_connector: nil, last_word_connector: nil }
296
298
  end
297
299
 
@@ -20,16 +20,23 @@ module Spotlight
20
20
  def headers
21
21
  {
22
22
  to: to,
23
- subject: "#{I18n.t(:'blacklight.application_name')} Contact Form",
24
- from: %("#{name}" <#{email}>),
25
- cc: current_exhibit.contact_emails.join(', ')
23
+ subject: I18n.t(:'spotlight.contact_form.subject', application_name: application_name),
24
+ cc: contact_emails.join(', ')
26
25
  }
27
26
  end
28
27
 
29
28
  private
30
29
 
30
+ def application_name
31
+ current_exhibit&.title || Spotlight::Site.instance.title || I18n.t(:'blacklight.application_name')
32
+ end
33
+
31
34
  def to
32
- Spotlight::Engine.config.default_contact_email || current_exhibit.contact_emails.first.to_s
35
+ Spotlight::Engine.config.default_contact_email || contact_emails.first.to_s
36
+ end
37
+
38
+ def contact_emails
39
+ current_exhibit&.contact_emails || []
33
40
  end
34
41
  end
35
42
  end
@@ -55,11 +55,7 @@ module Spotlight
55
55
  has_many :roles, as: :resource, dependent: :delete_all
56
56
  has_many :searches, dependent: :destroy, extend: FriendlyId::FinderMethods
57
57
  has_many :solr_document_sidecars, dependent: :delete_all
58
-
59
- # Ignoring for https://github.com/rubocop-hq/rubocop/issues/6764
60
- # rubocop:disable Rails/ReflectionClassName
61
58
  has_many :users, through: :roles, class_name: Spotlight::Engine.config.user_class
62
- # rubocop:enable Rails/ReflectionClassName
63
59
 
64
60
  has_many :pages, dependent: :destroy
65
61
  has_many :filters, dependent: :delete_all
@@ -6,6 +6,8 @@ module Spotlight
6
6
  class FieldMetadata
7
7
  FACET_LIMIT = 20
8
8
 
9
+ include Spotlight::SearchHelper
10
+
9
11
  attr_reader :exhibit, :repository, :blacklight_config
10
12
 
11
13
  def initialize(exhibit, repository, blacklight_config)
@@ -23,7 +25,7 @@ module Spotlight
23
25
  end
24
26
 
25
27
  def search_params
26
- search_builder.merge(rows: 0, 'facet.limit' => FACET_LIMIT + 1)
28
+ search_service.search_builder.merge(rows: 0, 'facet.limit' => FACET_LIMIT + 1)
27
29
  end
28
30
 
29
31
  private
@@ -36,14 +38,6 @@ module Spotlight
36
38
  end
37
39
  end
38
40
 
39
- def search_builder_class
40
- blacklight_config.search_builder_class
41
- end
42
-
43
- def search_builder
44
- search_builder_class.new(self)
45
- end
46
-
47
41
  def solr_response
48
42
  @solr_response ||= repository.search(search_params.merge('facet.query' => facet_fields.map { |_key, fields| "#{fields.field}:[* TO *]" },
49
43
  'rows' => 0,
@@ -10,11 +10,8 @@ module Spotlight
10
10
  friendly_id :title, use: [:slugged, :scoped, :finders, :history], scope: [:exhibit, :locale]
11
11
 
12
12
  belongs_to :exhibit, touch: true
13
- # Ignoring for https://github.com/rubocop-hq/rubocop/issues/6764
14
- # rubocop:disable Rails/ReflectionClassName
15
13
  belongs_to :created_by, class_name: Spotlight::Engine.config.user_class, optional: true
16
14
  belongs_to :last_edited_by, class_name: Spotlight::Engine.config.user_class, optional: true
17
- # rubocop:enable Rails/ReflectionClassName
18
15
 
19
16
  belongs_to :thumbnail, class_name: 'Spotlight::FeaturedImage', dependent: :destroy, optional: true
20
17
  belongs_to :default_locale_page, class_name: 'Spotlight::Page', optional: true, inverse_of: :translated_pages
@@ -47,7 +47,7 @@ module Spotlight
47
47
  private
48
48
 
49
49
  def available_index_fields
50
- fields = blacklight_config.index_fields.map { |k, _v| { key: k, label: index_field_label(nil, k) } }
50
+ fields = blacklight_config.index_fields.map { |k, _v| { key: k, label: index_field_label(blacklight_config.document_model.new, k) } }
51
51
  fields.unshift(key: document_show_link_field, label: t(:'spotlight.pages.form.title_placeholder')) unless index_fields.include? document_show_link_field
52
52
 
53
53
  fields
@@ -6,11 +6,7 @@ module Spotlight
6
6
  class Role < ActiveRecord::Base
7
7
  ROLES = %w(admin curator).freeze
8
8
  belongs_to :resource, polymorphic: true, optional: true
9
-
10
- # Ignoring for https://github.com/rubocop-hq/rubocop/issues/6764
11
- # rubocop:disable Rails/ReflectionClassName
12
9
  belongs_to :user, class_name: Spotlight::Engine.config.user_class, autosave: true, optional: false
13
- # rubocop:enable Rails/ReflectionClassName
14
10
 
15
11
  validates :role, inclusion: { in: ROLES }
16
12
  validate :user_must_be_unique, if: :user
@@ -5,6 +5,8 @@ module Spotlight
5
5
  # Exhibit saved searches
6
6
  class Search < ActiveRecord::Base
7
7
  include Spotlight::Translatables
8
+ include Spotlight::SearchHelper
9
+
8
10
  extend FriendlyId
9
11
  friendly_id :title, use: [:slugged, :scoped, :finders, :history], scope: :exhibit
10
12
 
@@ -54,7 +56,7 @@ module Spotlight
54
56
  end
55
57
 
56
58
  def search_params
57
- search_builder.with(query_params.with_indifferent_access).merge(facet: false, fl: default_search_fields)
59
+ search_service.search_builder.with(query_params.with_indifferent_access).merge(facet: false)
58
60
  end
59
61
 
60
62
  def merge_params_for_search(params, blacklight_config)
@@ -65,26 +67,10 @@ module Spotlight
65
67
 
66
68
  private
67
69
 
68
- def search_builder_class
69
- blacklight_config.search_builder_class
70
- end
71
-
72
- def search_builder
73
- search_builder_class.new(self)
74
- end
75
-
76
70
  def repository
77
71
  @repository ||= Blacklight::Solr::Repository.new(blacklight_config)
78
72
  end
79
73
 
80
- def default_search_fields
81
- [
82
- blacklight_config.document_model.unique_key,
83
- blacklight_config.index.title_field,
84
- blacklight_config.index.thumbnail_field
85
- ].compact
86
- end
87
-
88
74
  def should_generate_new_friendly_id?
89
75
  return false if new_record? && slug.present?
90
76
 
@@ -56,7 +56,7 @@ module Spotlight
56
56
 
57
57
  # IIIFManifest will call #to_s on each leaf node to get its respective label (not called out in README).
58
58
  def to_s
59
- resource.first(blacklight_config.view_config(:show).title_field)
59
+ presenter.heading
60
60
  end
61
61
 
62
62
  def iiif_manifest
@@ -69,6 +69,10 @@ module Spotlight
69
69
 
70
70
  private
71
71
 
72
+ def presenter
73
+ controller.view_context.show_presenter(resource)
74
+ end
75
+
72
76
  def endpoint
73
77
  IIIFManifest::IIIFEndpoint.new(iiif_url, profile: 'http://iiif.io/api/image/2/level2.json')
74
78
  end
@@ -28,57 +28,64 @@ module Spotlight
28
28
  # Serialize an exhibit with all the data needed to reconstruct it
29
29
  # in a different environment
30
30
  class ExhibitExportSerializer < Roar::Decorator
31
+ def self.config?(config)
32
+ lambda do |**_args|
33
+ Spotlight::Engine.config.exports[config]
34
+ end
35
+ end
36
+
31
37
  include Roar::JSON
32
38
 
33
39
  (Spotlight::Exhibit.attribute_names - %w(id slug masthead_id thumbnail_id)).each do |prop|
34
- property prop
40
+ property prop, if: config?(:config)
35
41
  end
36
42
 
37
- property :theme, setter: lambda { |fragment:, represented:, **|
43
+ property :theme, if: config?(:config), setter: lambda { |fragment:, represented:, **|
38
44
  represented.theme = fragment if Spotlight::Engine.config.exhibit_themes.include? fragment
39
45
  }
40
46
 
47
+ collection :main_navigations, class: Spotlight::MainNavigation, decorator: MainNavigationRepresenter, if: config?(:config)
48
+ collection :contact_emails, class: Spotlight::ContactEmail, if: config?(:config) do
49
+ (Spotlight::ContactEmail.attribute_names - %w(id exhibit_id confirmation_token)).each do |prop|
50
+ property prop
51
+ end
52
+ end
53
+
41
54
  collection :searches, populator: ->(fragment, options) { options[:represented].searches.find_or_initialize_by(slug: fragment['slug']) },
55
+ if: config?(:pages),
42
56
  class: Spotlight::Search do
43
57
  (Spotlight::Search.attribute_names - %w(id scope exhibit_id masthead_id thumbnail_id)).each do |prop|
44
58
  property prop
45
59
  end
46
60
 
47
- property :masthead, class: Spotlight::Masthead, decorator: FeaturedImageRepresenter
61
+ property :masthead, class: Spotlight::Masthead,
62
+ decorator: FeaturedImageRepresenter,
63
+ if: Spotlight::ExhibitExportSerializer.config?(:attachments)
48
64
 
49
- property :thumbnail, class: Spotlight::FeaturedImage, decorator: FeaturedImageRepresenter
65
+ property :thumbnail, class: Spotlight::FeaturedImage,
66
+ decorator: FeaturedImageRepresenter,
67
+ if: Spotlight::ExhibitExportSerializer.config?(:attachments)
50
68
  end
51
69
 
52
70
  collection :about_pages, populator: ->(fragment, options) { options[:represented].about_pages.find_or_initialize_by(slug: fragment['slug']) },
71
+ if: config?(:pages),
53
72
  class: Spotlight::AboutPage,
54
73
  decorator: PageRepresenter
55
74
 
56
75
  collection :feature_pages, populator: ->(fragment, options) { options[:represented].feature_pages.find_or_initialize_by(slug: fragment['slug']) },
57
76
  getter: ->(_opts) { feature_pages.at_top_level },
58
77
  class: Spotlight::FeaturePage,
59
- decorator: NestedPageRepresenter
78
+ decorator: NestedPageRepresenter,
79
+ if: config?(:pages)
60
80
 
61
81
  property :home_page, populator: ->(_fragment, options) { options[:represented].home_page },
62
82
  class: Spotlight::HomePage,
63
- decorator: PageRepresenter
64
-
65
- property :masthead, class: Spotlight::Masthead, decorator: FeaturedImageRepresenter
66
-
67
- property :thumbnail, class: Spotlight::ExhibitThumbnail, decorator: FeaturedImageRepresenter
68
-
69
- collection :main_navigations, class: Spotlight::MainNavigation, decorator: MainNavigationRepresenter
70
-
71
- property :blacklight_configuration, class: Spotlight::BlacklightConfiguration, decorator: ConfigurationRepresenter
72
-
73
- collection :custom_fields, populator: ->(fragment, options) { options[:represented].custom_fields.find_or_initialize_by(slug: fragment['slug']) },
74
- class: Spotlight::CustomField do
75
- (Spotlight::CustomField.attribute_names - %w(id exhibit_id)).each do |prop|
76
- property prop
77
- end
78
- end
83
+ decorator: PageRepresenter,
84
+ if: config?(:pages)
79
85
 
80
86
  collection :contacts, populator: ->(fragment, options) { options[:represented].contacts.find_or_initialize_by(slug: fragment['slug']) },
81
- class: Spotlight::Contact do
87
+ class: Spotlight::Contact,
88
+ if: config?(:pages) do
82
89
  (Spotlight::Contact.attribute_names - %w(id exhibit_id)).each do |prop|
83
90
  property prop
84
91
  end
@@ -86,13 +93,22 @@ module Spotlight
86
93
  property :avatar, class: Spotlight::ContactImage, decorator: FeaturedImageRepresenter
87
94
  end
88
95
 
89
- collection :contact_emails, class: Spotlight::ContactEmail do
90
- (Spotlight::ContactEmail.attribute_names - %w(id exhibit_id confirmation_token)).each do |prop|
96
+ property :masthead, class: Spotlight::Masthead, decorator: FeaturedImageRepresenter, if: config?(:attachments)
97
+
98
+ property :thumbnail, class: Spotlight::ExhibitThumbnail, decorator: FeaturedImageRepresenter, if: config?(:attachments)
99
+
100
+ property :blacklight_configuration, class: Spotlight::BlacklightConfiguration, decorator: ConfigurationRepresenter, if: config?(:blacklight_configuration)
101
+
102
+ collection :custom_fields, populator: ->(fragment, options) { options[:represented].custom_fields.find_or_initialize_by(slug: fragment['slug']) },
103
+ class: Spotlight::CustomField,
104
+ if: config?(:blacklight_configuration) do
105
+ (Spotlight::CustomField.attribute_names - %w(id exhibit_id)).each do |prop|
91
106
  property prop
92
107
  end
93
108
  end
94
109
 
95
- collection :solr_document_sidecars, class: Spotlight::SolrDocumentSidecar do
110
+ collection :solr_document_sidecars, class: Spotlight::SolrDocumentSidecar,
111
+ if: config?(:resources) do
96
112
  (Spotlight::SolrDocumentSidecar.attribute_names - %w(id document_type exhibit_id)).each do |prop|
97
113
  property prop
98
114
  end
@@ -106,7 +122,8 @@ module Spotlight
106
122
  delegate :document_type=, to: :represented
107
123
  end
108
124
 
109
- collection :owned_taggings, class: ActsAsTaggableOn::Tagging do
125
+ collection :owned_taggings, class: ActsAsTaggableOn::Tagging,
126
+ if: config?(:resources) do
110
127
  property :taggable_id
111
128
  property :taggable_type
112
129
  property :context
@@ -121,7 +138,7 @@ module Spotlight
121
138
  end
122
139
  end
123
140
 
124
- collection :attachments, class: Spotlight::Attachment do
141
+ collection :attachments, class: Spotlight::Attachment, if: config?(:attachments) do
125
142
  (Spotlight::Attachment.attribute_names - %w(id exhibit_id file)).each do |prop|
126
143
  property prop
127
144
  end
@@ -141,7 +158,8 @@ module Spotlight
141
158
  end
142
159
  end
143
160
 
144
- collection :resources, class: ->(options) { options[:fragment].key?('type') ? options[:fragment]['type'].constantize : Spotlight::Resource } do
161
+ collection :resources, class: ->(options) { options[:fragment].key?('type') ? options[:fragment]['type'].constantize : Spotlight::Resource },
162
+ if: config?(:resources) do
145
163
  (Spotlight::Resource.attribute_names - %w(id upload_id exhibit_id)).each do |prop|
146
164
  property prop
147
165
  end
@@ -160,5 +178,28 @@ module Spotlight
160
178
  FeaturedImageRepresenter.new(represented.build_upload).from_json(json)
161
179
  end
162
180
  end
181
+
182
+ collection :languages, class: Spotlight::Language,
183
+ populator: ->(fragment, options) { options[:represented].languages.find_or_initialize_by(locale: fragment['locale']) },
184
+ if: config?(:config) do
185
+ (Spotlight::Language.attribute_names - %w(id exhibit_id)).each do |prop|
186
+ property prop
187
+ end
188
+ end
189
+
190
+ collection :translations, getter: ->(represented:, **) { represented.translations.unscope(where: :locale) },
191
+ populator: (lambda do |fragment, options|
192
+ options[:represented].translations
193
+ .unscope(where: :locale)
194
+ .find_or_initialize_by(locale: fragment['locale'], key: fragment['key'])
195
+ end),
196
+ class: I18n::Backend::ActiveRecord::Translation,
197
+ if: config?(:config) do
198
+ property :locale
199
+ property :key
200
+ property :value
201
+ property :interpolations
202
+ property :is_proc
203
+ end
163
204
  end
164
205
  end
@@ -28,6 +28,6 @@ module Spotlight
28
28
  class: Spotlight::FeaturePage,
29
29
  extend: NestedPageRepresenter
30
30
 
31
- property :thumbnail, class: Spotlight::FeaturedImage, decorator: FeaturedImageRepresenter
31
+ property :thumbnail, class: Spotlight::FeaturedImage, decorator: FeaturedImageRepresenter, if: Spotlight::ExhibitExportSerializer.config?(:attachments)
32
32
  end
33
33
  end
@@ -1,20 +1,22 @@
1
- <%= button_tag t(:'spotlight.saved_search.label'), id: "save-this-search", class: 'btn btn-default', data: {toggle:"modal", target:"#save-modal"} %>
1
+ <%= button_tag t(:'spotlight.saved_search.label'), id: "save-this-search", class: 'btn btn-secondary', data: {toggle:"modal", target:"#save-modal"} %>
2
2
  <div class="modal fade" id="save-modal" tabindex="-1" role="dialog" aria-labelledby="save-modal-label" aria-hidden="true">
3
3
  <div class="modal-dialog">
4
4
  <%= bootstrap_form_for [spotlight, current_exhibit, Spotlight::Search.new] do |f| %>
5
5
  <div class="modal-content">
6
6
  <div class="modal-header">
7
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
8
7
  <h4 class="modal-title" id="save-modal-label"><%= t(:'spotlight.saved_search.label') %></h4>
8
+ <button type="button" class="blacklight-modal-close close" data-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
9
+ <span aria-hidden="true">&times;</span>
10
+ </button>
9
11
  </div>
10
12
  <div class="modal-body">
11
13
  <%= f.text_field :title, label: t(:'spotlight.saved_search.title') %>
12
- <%= label_tag :id, t(:'spotlight.saved_search.id'), class: 'control-label' %>
14
+ <%= label_tag :id, t(:'spotlight.saved_search.id'), class: 'col-form-label' %>
13
15
  <%= select_tag :id, options_for_select(current_exhibit.searches.map { |s| [s.title, s.id] }), include_blank: true, class: 'form-control' %>
14
16
  <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:qt, :page, :utf8)) %>
15
17
  </div>
16
18
  <div class="modal-footer">
17
- <%= f.submit nil, class: 'btn btn-primary pull-right' %>
19
+ <%= f.submit nil, class: 'btn btn-primary float-right' %>
18
20
  <button type="button" class="btn btn-link" data-dismiss="modal"><%= t :cancel %></button>
19
21
  </div>
20
22
  </div>
@@ -7,7 +7,7 @@
7
7
  %>
8
8
  <p><%= t("spotlight.#{key}.invitation_instructions.hello", email: @resource.email) %></p>
9
9
 
10
- <p><%= t("spotlight.#{key}.invitation_instructions.someone_invited_you", role: @resource.roles.first.role, exhibit_name: @resource.roles.first.resource.title, url: spotlight.exhibit_home_page_url(@resource.roles.first.resource)) %></p>
10
+ <p><%= t("spotlight.#{key}.invitation_instructions.someone_invited_you", role: @resource.roles.first.role, exhibit_name: @resource.roles.first.resource.title, url: spotlight.exhibit_home_page_url(@resource.roles.first.resource, locale: nil)) %></p>
11
11
 
12
12
  <p><%= link_to t("spotlight.#{key}.invitation_instructions.accept_invitation"), accept_invitation_url(@resource, :invitation_token => @token) %></p>
13
13
 
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html>
2
+ <%= content_tag :html, class: 'no-js', **(try(:html_tag_attributes) || {}) do %>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
+
8
+ <title><%= h(@page_title || application_name.to_s) %></title>
9
+ <link href="<%= current_exhibit ? spotlight.opensearch_exhibit_catalog_url(current_exhibit, format: 'xml') : main_app.opensearch_catalog_url(format: 'xml') %>" title="<%= h(@page_title || application_name.to_str) %>" type="application/opensearchdescription+xml" rel="search"/>
10
+ <%= favicon_link_tag 'favicon.ico' %>
11
+ <% if current_exhibit %>
12
+ <%= exhibit_stylesheet_link_tag "application" %>
13
+ <% else %>
14
+ <%= stylesheet_link_tag "application" %>
15
+ <% end %>
16
+ <%= javascript_include_tag "application" %>
17
+ <%= csrf_meta_tags %>
18
+ <%= content_for(:head) %>
19
+ <%= description %>
20
+ <%= twitter_card %>
21
+ <%= opengraph %>
22
+ <%= javascript_tag '$.fx.off = true;' if Rails.env.test? %>
23
+ </head>
24
+ <body class="<%= render_body_class %>">
25
+ <div id="skip-link">
26
+ <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
27
+ <%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
28
+ <%= content_for(:skip_links) %>
29
+ </div>
30
+
31
+ <%= render partial: 'shared/header_navbar' %>
32
+ <%= render partial: 'shared/masthead' %>
33
+ <%= content_for?(:header_content) ? yield(:header_content) : "" %>
34
+
35
+ <main id="main-container" class="<%= container_classes %>" role="main" aria-label="<%= t('blacklight.main.aria.main_container') %>">
36
+ <%= content_for(:container_header) %>
37
+
38
+ <%= render partial: 'shared/flash_msg', layout: 'shared/flash_messages' %>
39
+
40
+ <div class="row">
41
+ <%= content_for?(:content) ? yield(:content) : yield %>
42
+ </div>
43
+ </main>
44
+
45
+ <%= render partial: 'shared/footer' %>
46
+ <%= render partial: 'shared/modal' %>
47
+ </body>
48
+ <% end %>