blacklight-spotlight 3.0.0.alpha.8 → 3.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) 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/search_typeahead.js +2 -2
  16. data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +21 -12
  17. data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +11 -3
  18. data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
  19. data/app/assets/javascripts/spotlight/user/index.js +1 -0
  20. data/app/assets/stylesheets/spotlight/_accessibility.scss +1 -1
  21. data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
  22. data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
  23. data/app/assets/stylesheets/spotlight/_catalog.scss +6 -6
  24. data/app/assets/stylesheets/spotlight/_curation.scss +6 -0
  25. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +214 -83
  26. data/app/assets/stylesheets/spotlight/_header.scss +1 -1
  27. data/app/assets/stylesheets/spotlight/_item_text_block.scss +6 -0
  28. data/app/assets/stylesheets/spotlight/_pages.scss +10 -5
  29. data/app/assets/stylesheets/spotlight/_report_a_problem.scss +5 -2
  30. data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
  31. data/app/assets/stylesheets/spotlight/_translations.scss +7 -0
  32. data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +69 -0
  33. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
  34. data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
  35. data/app/controllers/spotlight/appearances_controller.rb +0 -12
  36. data/app/controllers/spotlight/browse_controller.rb +7 -3
  37. data/app/controllers/spotlight/catalog_controller.rb +1 -1
  38. data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
  39. data/app/controllers/spotlight/exhibits_controller.rb +2 -3
  40. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  41. data/app/controllers/spotlight/groups_controller.rb +80 -0
  42. data/app/controllers/spotlight/pages_controller.rb +6 -9
  43. data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
  44. data/app/controllers/spotlight/searches_controller.rb +7 -19
  45. data/app/controllers/spotlight/translations_controller.rb +46 -0
  46. data/app/helpers/spotlight/application_helper.rb +1 -1
  47. data/app/helpers/spotlight/crop_helper.rb +4 -1
  48. data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
  49. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  50. data/app/jobs/spotlight/add_uploads_from_csv.rb +30 -5
  51. data/app/mailers/spotlight/indexing_complete_mailer.rb +3 -2
  52. data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
  53. data/app/models/concerns/spotlight/translatables.rb +17 -1
  54. data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
  55. data/app/models/spotlight/ability.rb +2 -0
  56. data/app/models/spotlight/about_page.rb +3 -1
  57. data/app/models/spotlight/blacklight_configuration.rb +2 -1
  58. data/app/models/spotlight/contact.rb +1 -1
  59. data/app/models/spotlight/custom_field.rb +3 -3
  60. data/app/models/spotlight/exhibit.rb +18 -4
  61. data/app/models/spotlight/feature_page.rb +3 -1
  62. data/app/models/spotlight/featured_image.rb +29 -12
  63. data/app/models/spotlight/group.rb +22 -0
  64. data/app/models/spotlight/group_member.rb +11 -0
  65. data/app/models/spotlight/home_page.rb +3 -1
  66. data/app/models/spotlight/main_navigation.rb +2 -2
  67. data/app/models/spotlight/masthead.rb +1 -1
  68. data/app/models/spotlight/page.rb +5 -1
  69. data/app/models/spotlight/page_configurations.rb +6 -0
  70. data/app/models/spotlight/page_content.rb +2 -0
  71. data/app/models/spotlight/resources/csv_upload.rb +2 -1
  72. data/app/models/spotlight/resources/iiif_manifest.rb +8 -6
  73. data/app/models/spotlight/resources/upload.rb +1 -1
  74. data/app/models/spotlight/search.rb +10 -1
  75. data/app/models/spotlight/solr_document_sidecar.rb +7 -5
  76. data/app/models/spotlight/temporary_image.rb +8 -0
  77. data/app/services/spotlight/exhibit_import_export_service.rb +482 -0
  78. data/app/services/spotlight/solr_document_builder.rb +1 -0
  79. data/app/values/custom_field_name.rb +1 -0
  80. data/app/views/catalog/_save_search.html.erb +1 -1
  81. data/app/views/spotlight/about_pages/_empty.html.erb +5 -5
  82. data/app/views/spotlight/browse/_search.html.erb +5 -3
  83. data/app/views/spotlight/browse/_search_title.html.erb +2 -1
  84. data/app/views/spotlight/browse/index.html.erb +13 -0
  85. data/app/views/spotlight/catalog/_document.html.erb +2 -4
  86. data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
  87. data/app/views/spotlight/contacts/_form.html.erb +1 -1
  88. data/app/views/spotlight/feature_pages/_empty.html.erb +5 -5
  89. data/app/views/spotlight/featured_images/_form.html.erb +1 -1
  90. data/app/views/spotlight/featured_images/_upload_form.html.erb +1 -1
  91. data/app/views/spotlight/home_pages/_empty.html.erb +3 -3
  92. data/app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb +9 -0
  93. data/app/views/spotlight/pages/_form.html.erb +2 -2
  94. data/app/views/spotlight/searches/_form.html.erb +13 -0
  95. data/app/views/spotlight/searches/_group.html.erb +27 -0
  96. data/app/views/spotlight/searches/_search.html.erb +1 -0
  97. data/app/views/spotlight/searches/index.html.erb +58 -17
  98. data/app/views/spotlight/shared/_honeypot_field.html.erb +4 -0
  99. data/app/views/spotlight/shared/_report_a_problem.html.erb +7 -10
  100. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
  101. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +44 -0
  102. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
  103. data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
  104. data/app/views/spotlight/translations/_general.html.erb +7 -7
  105. data/app/views/spotlight/translations/_groups.html.erb +34 -0
  106. data/app/views/spotlight/translations/_import.html.erb +24 -0
  107. data/app/views/spotlight/translations/_metadata.html.erb +1 -1
  108. data/app/views/spotlight/translations/_page.html.erb +5 -5
  109. data/app/views/spotlight/translations/_pages.html.erb +4 -4
  110. data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
  111. data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
  112. data/app/views/spotlight/translations/edit.html.erb +14 -6
  113. data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
  114. data/config/i18n-tasks.yml +7 -0
  115. data/config/locales/spotlight.ar.yml +47 -24
  116. data/config/locales/spotlight.en.yml +182 -127
  117. data/config/routes.rb +16 -1
  118. data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
  119. data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
  120. data/lib/generators/spotlight/install_generator.rb +23 -2
  121. data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +10 -0
  122. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -1
  123. data/lib/spotlight/engine.rb +27 -3
  124. data/lib/spotlight/upload_field_config.rb +1 -0
  125. data/lib/spotlight/version.rb +1 -1
  126. data/spec/controllers/spotlight/about_pages_controller_spec.rb +3 -3
  127. data/spec/controllers/spotlight/browse_controller_spec.rb +24 -1
  128. data/spec/controllers/spotlight/catalog_controller_spec.rb +1 -1
  129. data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
  130. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
  131. data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
  132. data/spec/controllers/spotlight/home_pages_controller_spec.rb +2 -2
  133. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +4 -4
  134. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +2 -2
  135. data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
  136. data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
  137. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
  138. data/spec/examples.txt +1437 -1389
  139. data/spec/factories/featured_images.rb +4 -0
  140. data/spec/factories/group.rb +17 -0
  141. data/spec/factories/searches.rb +11 -1
  142. data/spec/features/add_contacts_spec.rb +1 -1
  143. data/spec/features/browse_category_admin_spec.rb +39 -7
  144. data/spec/features/browse_category_navigation_spec.rb +44 -0
  145. data/spec/features/browse_category_spec.rb +2 -2
  146. data/spec/features/catalog_spec.rb +2 -2
  147. data/spec/features/create_exhibit_spec.rb +5 -4
  148. data/spec/features/dashboard_spec.rb +7 -7
  149. data/spec/features/edit_search_fields_spec.rb +2 -2
  150. data/spec/features/exhibits/administration_spec.rb +3 -3
  151. data/spec/features/exhibits/edit_metadata_fields_spec.rb +1 -1
  152. data/spec/features/exhibits/language_create_edit_spec.rb +3 -3
  153. data/spec/features/exhibits/translation_editing_spec.rb +57 -8
  154. data/spec/features/home_page_spec.rb +13 -4
  155. data/spec/features/item_admin_spec.rb +4 -4
  156. data/spec/features/javascript/about_page_admin_spec.rb +1 -1
  157. data/spec/features/javascript/block_controls_spec.rb +3 -1
  158. data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
  159. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
  160. data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
  161. data/spec/features/javascript/edit_in_place_spec.rb +3 -3
  162. data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
  163. data/spec/features/javascript/search_config_admin_spec.rb +1 -1
  164. data/spec/features/report_a_problem_spec.rb +6 -5
  165. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
  166. data/spec/helpers/spotlight/pages_helper_spec.rb +2 -2
  167. data/spec/i18n_spec.rb +0 -2
  168. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +13 -1
  169. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +11 -1
  170. data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
  171. data/spec/models/solr_document_spec.rb +2 -3
  172. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -0
  173. data/spec/models/spotlight/exhibit_spec.rb +18 -2
  174. data/spec/models/spotlight/featured_image_spec.rb +27 -0
  175. data/spec/models/spotlight/group_spec.rb +19 -0
  176. data/spec/models/spotlight/main_navigation_spec.rb +1 -1
  177. data/spec/models/spotlight/page_spec.rb +6 -1
  178. data/spec/models/spotlight/resources/upload_spec.rb +43 -79
  179. data/spec/models/spotlight/role_spec.rb +3 -3
  180. data/spec/models/spotlight/search_spec.rb +30 -3
  181. data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +168 -23
  182. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
  183. data/spec/services/spotlight/solr_document_builder_spec.rb +1 -1
  184. data/spec/spec_helper.rb +1 -1
  185. data/spec/support/features/test_features_helpers.rb +15 -0
  186. data/spec/test_app_templates/Gemfile.extra +1 -3
  187. data/spec/test_app_templates/catalog_controller.rb +6 -3
  188. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  189. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +1 -1
  190. data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
  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/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -3
  194. data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
  195. data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +1 -1
  196. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +7 -8
  197. data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
  198. data/vendor/assets/javascripts/leaflet-iiif.js +46 -21
  199. data/vendor/assets/javascripts/tiny-slider.js +3218 -0
  200. data/vendor/assets/stylesheets/tiny-slider.css +1 -0
  201. metadata +399 -284
  202. data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
  203. data/app/serializers/spotlight/featured_image_representer.rb +0 -29
  204. data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
  205. data/app/serializers/spotlight/page_representer.rb +0 -33
  206. data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -79,7 +79,7 @@
79
79
  .image-masthead {
80
80
  background-color: $black;
81
81
 
82
- .navbar {
82
+ .exhibit-navbar {
83
83
  @extend .navbar-dark;
84
84
  background-color: $navbar-transparent-page-bg;
85
85
 
@@ -21,6 +21,12 @@
21
21
  }
22
22
  }
23
23
 
24
+ .item-text {
25
+ .items-col {
26
+ z-index: 1;
27
+ }
28
+ }
29
+
24
30
  .item-text-admin {
25
31
  .text-align {
26
32
  margin-top: 15px;
@@ -58,13 +58,18 @@
58
58
  }
59
59
 
60
60
  .contact-properties {
61
- padding-left: 1rem;
62
- text-indent: -1rem;
61
+ padding-left: 0.125rem;
62
+
63
+ > div {
64
+ padding-bottom: 5px;
65
+ }
63
66
  }
64
67
 
65
68
  ol.contacts {
69
+ line-height: 1.33;
70
+
66
71
  li {
67
- margin-bottom: $spacer * .5;
72
+ margin-bottom: 1rem;
68
73
  margin-top: $spacer * .5;
69
74
  word-break: break-word;
70
75
  .name {
@@ -76,7 +81,7 @@
76
81
  ol.sidenav {
77
82
  li {
78
83
  color: $gray-900;
79
- margin-top: $spacer * .25;
84
+ margin-top: $spacer * .5;
80
85
  }
81
86
 
82
87
  ol.subsection {
@@ -102,7 +107,7 @@
102
107
  height: 70px;
103
108
  margin-right: 15px;
104
109
  margin-top: 3px;
105
- width: 70px;
110
+ min-width: 70px;
106
111
  }
107
112
 
108
113
  // Indent contact fields so they align evenly, only when there is a contact photo
@@ -1,7 +1,10 @@
1
1
  #report-problem-form {
2
2
  display: none;
3
- background-color: #e7e7e7;
4
- border-bottom: 1px dotted $gray-600;
3
+ border-bottom: 1px solid $gray-600;
4
+
5
+ h2 {
6
+ @extend .sr-only;
7
+ }
5
8
  }
6
9
 
7
10
  @include media-breakpoint-up(sm) {
@@ -5,7 +5,9 @@
5
5
  @import "spotlight/sir-trevor_overrides";
6
6
  @import "spotlight/attachments";
7
7
  @import "spotlight/pages";
8
+ @import "spotlight/breadcrumbs";
8
9
  @import "spotlight/browse";
10
+ @import "spotlight/browse_group_categories_block";
9
11
  @import "spotlight/header";
10
12
  @import "spotlight/footer";
11
13
  @import "spotlight/catalog";
@@ -36,6 +36,7 @@
36
36
  }
37
37
  }
38
38
 
39
+ .translation-subtitle-toggle,
39
40
  .translation-description-toggle {
40
41
  margin: 0;
41
42
  padding: 0;
@@ -77,3 +78,9 @@
77
78
  margin-top: $spacer;
78
79
  padding-bottom: 3px;
79
80
  }
81
+
82
+ .translation-import-export-label {
83
+ @media (min-width: 576px) {
84
+ text-align: right;
85
+ }
86
+ }
@@ -0,0 +1,69 @@
1
+ @import "tiny-slider";
2
+
3
+ .browse-group-categories-block {
4
+ padding-bottom: $spacer * .75;
5
+ padding-top: $spacer * .75;
6
+
7
+ .spotlight-flexbox.browse-categories .box {
8
+ display: flex;
9
+ }
10
+
11
+ .browse-group-categories-controls {
12
+ list-style: none;
13
+ li {
14
+ display: inline-block;
15
+ cursor: pointer;
16
+ }
17
+
18
+ .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right {
19
+ display: inline-block;
20
+ fill: $gray-600;
21
+ height: 44px;
22
+ width: 44px;
23
+
24
+ &:hover,&:focus {
25
+ fill: $gray-700;
26
+ }
27
+ }
28
+
29
+ li[aria-disabled="true"] {
30
+ cursor: auto;
31
+ }
32
+
33
+ [aria-disabled="true"] {
34
+ .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right {
35
+ fill: $gray-400;
36
+
37
+ &:hover,&:focus {
38
+ fill: $gray-400;
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ // Coming from tiny-slider, make sure these disappear when navigating via turbolinks
45
+ .tns-controls {
46
+ display: none;
47
+ }
48
+
49
+ @media screen and (min-width: breakpoint-min("md")) {
50
+ .browse-group-categories-controls {
51
+ .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right {
52
+ height: 32px;
53
+ width: 32px;
54
+ }
55
+ }
56
+
57
+ &[data-browse-group-categories-count="2"],&[data-browse-group-categories-count="3"] {
58
+ .browse-group-categories-controls {
59
+ display: none !important;
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ [dir="rtl"] {
66
+ .browse-group-categories-block .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right{
67
+ transform: rotate(180deg);
68
+ }
69
+ }
@@ -31,8 +31,7 @@ module Spotlight
31
31
  private
32
32
 
33
33
  def element_label(element)
34
- label = compute_name(element)
35
- @context.truncate(label, escape: !label.html_safe?, length: 30, separator: ' ')
34
+ @context.content_tag(:span, class: 'truncated-value') { compute_name(element) }
36
35
  end
37
36
  end
38
37
  end
@@ -4,15 +4,9 @@ module Spotlight
4
4
  # ...
5
5
  module SearchHelper
6
6
  def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {})
7
- search_service_class.new(config: blacklight_config, user_params: user_params, **search_service_context)
8
- end
7
+ klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService
9
8
 
10
- def search_service_class
11
- if defined?(super)
12
- super
13
- else
14
- Blacklight::SearchService
15
- end
9
+ klass.new(config: blacklight_config, user_params: user_params, **search_service_context)
16
10
  end
17
11
 
18
12
  # @return [Hash] a hash of context information to pass through to the search service
@@ -30,17 +30,5 @@ module Spotlight
30
30
  masthead_attributes: featured_image_params,
31
31
  thumbnail_attributes: featured_image_params)
32
32
  end
33
-
34
- def featured_image_params
35
- %i[
36
- iiif_region iiif_tilesource
37
- iiif_manifest_url iiif_canvas_id
38
- iiif_image_id
39
- display
40
- source
41
- image
42
- document_global_id
43
- ]
44
- end
45
33
  end
46
34
  end
@@ -9,7 +9,8 @@ module Spotlight
9
9
  include Spotlight::Catalog
10
10
  include Blacklight::Facet
11
11
 
12
- load_and_authorize_resource :search, except: :index, through: :exhibit, parent: false
12
+ load_and_authorize_resource :group, through: :exhibit
13
+ load_and_authorize_resource :search, through: %i[group exhibit], parent: false
13
14
  before_action :attach_breadcrumbs
14
15
  before_action :attach_search_breadcrumb, only: :show
15
16
  record_search_parameters only: :show
@@ -20,10 +21,12 @@ module Spotlight
20
21
 
21
22
  before_action do
22
23
  blacklight_config.track_search_session = false
24
+ blacklight_config.view.gallery.classes = 'row-cols-2 row-cols-md-4'
23
25
  end
24
26
 
25
27
  def index
26
- @searches = @exhibit.searches.published
28
+ @groups = @exhibit.groups.published
29
+ @searches = @searches.published
27
30
  end
28
31
 
29
32
  def show
@@ -66,10 +69,11 @@ module Spotlight
66
69
  def attach_breadcrumbs
67
70
  add_breadcrumb t(:'spotlight.curation.nav.home', title: @exhibit.title), @exhibit
68
71
  add_breadcrumb(@exhibit.main_navigations.browse.label_or_default, exhibit_browse_index_path(@exhibit))
72
+ add_breadcrumb(@group.title, exhibit_browse_groups_path(@exhibit, @group)) if @group.present?
69
73
  end
70
74
 
71
75
  def attach_search_breadcrumb
72
- add_breadcrumb @search.title, exhibit_browse_path(@exhibit, @search)
76
+ add_breadcrumb @search.full_title, (@group.present? ? exhibit_browse_group_path(@exhibit, @group, @search) : exhibit_browse_path(@exhibit, @search))
73
77
  end
74
78
 
75
79
  def _prefixes
@@ -127,7 +127,7 @@ module Spotlight
127
127
  # /exhibits/1?f%5Bgenre_sim%5D%5B%5D=map&q= is not the same as /exhibits/1
128
128
  # Otherwise the exhibit breadcrumb won't be a link.
129
129
  # see http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-current_page-3F
130
- if view_context.current_page?(action: :admin)
130
+ if view_context.current_page?({ action: :admin })
131
131
  add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), exhibit_root_path(@exhibit, q: '')
132
132
  else
133
133
  # When not on the admin page, get the translated value for the "Home" breadcrumb
@@ -38,7 +38,6 @@ module Spotlight
38
38
  end
39
39
  end
40
40
 
41
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
42
41
  def field_enabled?(field, *args)
43
42
  if !field.enabled
44
43
  false
@@ -52,7 +51,6 @@ module Spotlight
52
51
  field.send(document_index_view_type)
53
52
  end
54
53
  end
55
- # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
56
54
 
57
55
  private
58
56
 
@@ -82,6 +80,19 @@ module Spotlight
82
80
  def default_document_index_view_type
83
81
  document_index_views.select { |_k, config| config.respond_to?(:default) && config.default }.keys.first || document_index_views.keys.first
84
82
  end
83
+
84
+ def featured_image_params
85
+ %i[
86
+ iiif_region iiif_tilesource
87
+ iiif_manifest_url iiif_canvas_id
88
+ iiif_image_id
89
+ display
90
+ source
91
+ image
92
+ document_global_id
93
+ upload_id
94
+ ]
95
+ end
85
96
  end
86
97
  end
87
98
  end
@@ -27,8 +27,7 @@ module Spotlight
27
27
  end
28
28
 
29
29
  def process_import
30
- @exhibit.import(JSON.parse(import_exhibit_params.read))
31
- if @exhibit.save && @exhibit.reindex_later
30
+ if @exhibit.import(JSON.parse(import_exhibit_params.read)) && @exhibit.reindex_later
32
31
  redirect_to spotlight.exhibit_dashboard_path(@exhibit), notice: t(:'helpers.submit.exhibit.updated', model: @exhibit.class.model_name.human.downcase)
33
32
  else
34
33
  render action: :import
@@ -50,7 +49,7 @@ module Spotlight
50
49
  respond_to do |format|
51
50
  format.json do
52
51
  authorize! :export, @exhibit
53
- send_data JSON.pretty_generate(Spotlight::ExhibitExportSerializer.new(@exhibit).as_json),
52
+ send_data JSON.pretty_generate(Spotlight::ExhibitImportExportService.new(@exhibit).as_json),
54
53
  type: 'application/json',
55
54
  disposition: 'attachment',
56
55
  filename: "#{@exhibit.friendly_id}-export.json"
@@ -3,7 +3,7 @@
3
3
  module Spotlight
4
4
  # Handles requests to upload images for exhibit thumbnails
5
5
  class FeaturedImagesController < Spotlight::ApplicationController
6
- load_and_authorize_resource instance_name: :featured_image
6
+ load_and_authorize_resource instance_name: :featured_image, class: 'Spotlight::TemporaryImage'
7
7
 
8
8
  def create
9
9
  if @featured_image.save && @featured_image.file_present?
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ ##
5
+ # Base CRUD controller for groups
6
+ class GroupsController < Spotlight::ApplicationController
7
+ before_action :authenticate_user!
8
+ load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
9
+ load_and_authorize_resource through: :exhibit
10
+
11
+ def index
12
+ respond_to do |format|
13
+ format.json do
14
+ render json: @groups.as_json, root: false
15
+ end
16
+ end
17
+ end
18
+
19
+ # POST /exhibits/1/groups
20
+ def create
21
+ @group.attributes = group_params
22
+
23
+ if @group.save
24
+ redirect_to(
25
+ spotlight.exhibit_searches_path(anchor: 'browse-groups'),
26
+ notice: t(:'helpers.submit.group.created', model: human_name)
27
+ )
28
+ else
29
+ redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups')
30
+ end
31
+ end
32
+
33
+ # PATCH/PUT /groups/1
34
+ def update
35
+ @group.update(group_params)
36
+
37
+ redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups'), notice: t(:'helpers.submit.group.updated', model: human_name)
38
+ end
39
+
40
+ # DELETE /groups/1
41
+ def destroy
42
+ @group.destroy
43
+
44
+ redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups'), alert: t(:'helpers.submit.group.destroyed', model: human_name)
45
+ end
46
+
47
+ def update_all
48
+ notice = if @exhibit.update update_all_group_params
49
+ t(:'helpers.submit.group.batch_updated', model: human_name)
50
+ else
51
+ t(:'helpers.submit.group.batch_error', model: human_name)
52
+ end
53
+ redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups'), notice: notice
54
+ end
55
+
56
+ protected
57
+
58
+ def allowed_group_params
59
+ [:title]
60
+ end
61
+
62
+ private
63
+
64
+ def human_name
65
+ @human_name ||= @group ? @group.class.model_name.human.downcase : Spotlight::Group.model_name.human.pluralize
66
+ end
67
+
68
+ alias group_collection_name controller_name
69
+
70
+ def update_all_group_params
71
+ params.require(:exhibit).permit(
72
+ groups_attributes: %i[id title published weight]
73
+ )
74
+ end
75
+
76
+ def group_params
77
+ params.require(controller_name.singularize).permit(allowed_group_params)
78
+ end
79
+ end
80
+ end
@@ -19,6 +19,10 @@ module Spotlight
19
19
 
20
20
  helper_method :get_search_results, :search_results, :fetch, :page_collection_name, :presenter
21
21
 
22
+ before_action do
23
+ blacklight_config.view.gallery.classes = 'row-cols-2 row-cols-md-4' unless @page&.display_sidebar
24
+ end
25
+
22
26
  # GET /exhibits/1/pages
23
27
  def index
24
28
  # set up a model the inline "add a new page" form
@@ -70,7 +74,7 @@ module Spotlight
70
74
  @page.lock&.delete
71
75
 
72
76
  if @page.update(page_params.merge(last_edited_by: current_user))
73
- redirect_to [spotlight, @page.exhibit, @page], flash: { html_safe: true }, notice: undo_notice(:updated)
77
+ redirect_to [spotlight, @page.exhibit, @page, format: params.permit(:format)], flash: { html_safe: true }, notice: undo_notice(:updated)
74
78
  else
75
79
  render action: 'edit'
76
80
  end
@@ -146,14 +150,7 @@ module Spotlight
146
150
  end
147
151
 
148
152
  def allowed_page_params
149
- [:title, :content, thumbnail_attributes: featured_image_attributes]
150
- end
151
-
152
- def featured_image_attributes
153
- %i[
154
- source image document_global_id iiif_region iiif_tilesource
155
- iiif_manifest_url iiif_canvas_id iiif_image_id
156
- ]
153
+ [:title, :content, thumbnail_attributes: featured_image_params]
157
154
  end
158
155
 
159
156
  def human_name