blacklight-spotlight 3.0.0.rc2 → 3.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
- data/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
- data/app/assets/javascripts/spotlight/admin/{add_new_page_button.js → add_new_button.js} +7 -0
- data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +4 -4
- data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/croppable.js +1 -1
- data/app/assets/javascripts/spotlight/admin/index.js +0 -2
- data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +7 -0
- data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
- data/app/assets/javascripts/spotlight/user/index.js +1 -0
- data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +34 -1
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
- data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +69 -0
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
- data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
- data/app/controllers/spotlight/appearances_controller.rb +0 -13
- data/app/controllers/spotlight/browse_controller.rb +7 -3
- data/app/controllers/spotlight/catalog_controller.rb +1 -1
- data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
- data/app/controllers/spotlight/groups_controller.rb +80 -0
- data/app/controllers/spotlight/pages_controller.rb +5 -8
- data/app/controllers/spotlight/searches_controller.rb +4 -17
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
- data/app/helpers/spotlight/main_app_helpers.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
- data/app/models/spotlight/ability.rb +2 -0
- data/app/models/spotlight/about_page.rb +1 -1
- data/app/models/spotlight/blacklight_configuration.rb +2 -1
- data/app/models/spotlight/exhibit.rb +14 -2
- data/app/models/spotlight/feature_page.rb +1 -1
- data/app/models/spotlight/featured_image.rb +1 -1
- data/app/models/spotlight/group.rb +22 -0
- data/app/models/spotlight/group_member.rb +11 -0
- data/app/models/spotlight/home_page.rb +1 -1
- data/app/models/spotlight/page.rb +2 -2
- data/app/models/spotlight/page_configurations.rb +5 -0
- data/app/models/spotlight/resources/iiif_manifest.rb +6 -6
- data/app/models/spotlight/search.rb +5 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +50 -22
- data/app/views/spotlight/browse/_search.html.erb +2 -1
- data/app/views/spotlight/browse/index.html.erb +13 -0
- data/app/views/spotlight/catalog/_document.html.erb +2 -4
- data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
- data/app/views/spotlight/searches/_form.html.erb +12 -0
- data/app/views/spotlight/searches/_group.html.erb +27 -0
- data/app/views/spotlight/searches/index.html.erb +58 -17
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +44 -0
- data/app/views/spotlight/translations/_groups.html.erb +34 -0
- data/app/views/spotlight/translations/edit.html.erb +6 -0
- data/config/i18n-tasks.yml +5 -0
- data/config/locales/spotlight.en.yml +37 -1
- data/config/routes.rb +10 -0
- data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
- data/lib/generators/spotlight/install_generator.rb +3 -3
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +1 -1
- data/lib/spotlight/engine.rb +4 -3
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/browse_controller_spec.rb +23 -0
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
- data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
- data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
- data/spec/examples.txt +1437 -136
- data/spec/factories/group.rb +17 -0
- data/spec/factories/searches.rb +10 -0
- data/spec/features/browse_category_admin_spec.rb +36 -4
- data/spec/features/browse_category_navigation_spec.rb +44 -0
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/exhibits/translation_editing_spec.rb +49 -0
- data/spec/features/home_page_spec.rb +4 -4
- data/spec/features/javascript/about_page_admin_spec.rb +1 -1
- data/spec/features/javascript/block_controls_spec.rb +1 -1
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
- data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
- data/spec/features/javascript/edit_in_place_spec.rb +2 -2
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
- data/spec/models/spotlight/exhibit_spec.rb +8 -0
- data/spec/models/spotlight/group_spec.rb +19 -0
- data/spec/models/spotlight/role_spec.rb +1 -1
- data/spec/models/spotlight/search_spec.rb +30 -3
- data/spec/services/spotlight/exhibit_import_export_service_spec.rb +48 -1
- data/spec/services/spotlight/solr_document_builder_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/features/test_features_helpers.rb +15 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/catalog_controller.rb +6 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
- data/vendor/assets/javascripts/tiny-slider.js +3218 -0
- data/vendor/assets/stylesheets/tiny-slider.css +1 -0
- metadata +339 -263
- data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -31,8 +31,7 @@ module Spotlight
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def element_label(element)
|
34
|
-
|
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
|
-
|
8
|
-
end
|
7
|
+
klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService
|
9
8
|
|
10
|
-
|
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,18 +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
|
-
upload_id
|
44
|
-
]
|
45
|
-
end
|
46
33
|
end
|
47
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 :
|
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
|
-
@
|
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.full_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
|
@@ -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
|
@@ -146,14 +150,7 @@ module Spotlight
|
|
146
150
|
end
|
147
151
|
|
148
152
|
def allowed_page_params
|
149
|
-
[:title, :content, thumbnail_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
|
@@ -5,9 +5,8 @@ module Spotlight
|
|
5
5
|
# CRUD actions for curating browse categories (see
|
6
6
|
# {Spotlight::BrowseController} for the end-user read and index actions)
|
7
7
|
class SearchesController < Spotlight::ApplicationController
|
8
|
-
|
8
|
+
load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit', parent_action: :curate
|
9
9
|
before_action :authenticate_user!
|
10
|
-
before_action :only_curators!
|
11
10
|
before_action :create_or_load_resource, only: [:create]
|
12
11
|
load_and_authorize_resource through: :exhibit
|
13
12
|
before_action :attach_breadcrumbs, only: %i[index edit], unless: -> { request.format.json? }
|
@@ -28,6 +27,7 @@ module Spotlight
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def index
|
30
|
+
@groups = @exhibit.groups
|
31
31
|
respond_to do |format|
|
32
32
|
format.html
|
33
33
|
format.json do
|
@@ -50,6 +50,7 @@ module Spotlight
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def edit
|
53
|
+
@groups = @exhibit.groups
|
53
54
|
add_breadcrumb @search.full_title, edit_exhibit_search_path(@search.exhibit, @search)
|
54
55
|
@exhibit = @search.exhibit
|
55
56
|
end
|
@@ -109,6 +110,7 @@ module Spotlight
|
|
109
110
|
:long_description,
|
110
111
|
:search_box,
|
111
112
|
:default_index_view_type,
|
113
|
+
group_ids: [],
|
112
114
|
masthead_attributes: featured_image_params,
|
113
115
|
thumbnail_attributes: featured_image_params
|
114
116
|
)
|
@@ -118,21 +120,6 @@ module Spotlight
|
|
118
120
|
params.to_unsafe_h.with_indifferent_access.except(:exhibit_id, :search, *blacklisted_search_session_params).reject { |_k, v| v.blank? }
|
119
121
|
end
|
120
122
|
|
121
|
-
def featured_image_params
|
122
|
-
%i[
|
123
|
-
iiif_region iiif_tilesource
|
124
|
-
iiif_manifest_url iiif_canvas_id iiif_image_id
|
125
|
-
display
|
126
|
-
source
|
127
|
-
image
|
128
|
-
document_global_id
|
129
|
-
]
|
130
|
-
end
|
131
|
-
|
132
|
-
def only_curators!
|
133
|
-
authorize! :curate, @exhibit if @exhibit
|
134
|
-
end
|
135
|
-
|
136
123
|
def blacklisted_search_session_params
|
137
124
|
%i[id commit counter total search_id page per_page authenticity_token utf8 action controller]
|
138
125
|
end
|
@@ -132,7 +132,7 @@ module Spotlight
|
|
132
132
|
|
133
133
|
def uploaded_field_label(config)
|
134
134
|
solr_field = Array(config.solr_field || config.field_name).first.to_s
|
135
|
-
blacklight_config.index_fields[solr_field]
|
135
|
+
blacklight_config.index_fields[solr_field]&.label || config.label || t(".#{solr_field}")
|
136
136
|
end
|
137
137
|
|
138
138
|
def available_view_fields
|
@@ -112,7 +112,7 @@ module Spotlight
|
|
112
112
|
defaults << :"helpers.action.#{object_name}.#{key}"
|
113
113
|
defaults << :"helpers.action.#{key}"
|
114
114
|
defaults << "#{key.to_s.humanize} #{model}"
|
115
|
-
I18n.t(defaults.shift, model: model, default: defaults)
|
115
|
+
I18n.t(defaults.shift, model: model.downcase, default: defaults)
|
116
116
|
end
|
117
117
|
# rubocop:enable Metrics/MethodLength
|
118
118
|
end
|
@@ -24,7 +24,7 @@ module Spotlight
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def link_back_to_catalog(opts = { label: nil })
|
27
|
-
opts[:route_set] ||= spotlight if (current_search_session
|
27
|
+
opts[:route_set] ||= spotlight if (current_search_session&.query_params || {}).fetch(:controller, '').starts_with? 'spotlight'
|
28
28
|
super
|
29
29
|
end
|
30
30
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SirTrevorRails
|
4
|
+
module Blocks
|
5
|
+
##
|
6
|
+
# Browese Group Categories
|
7
|
+
class BrowseGroupCategoriesBlock < SirTrevorRails::Block
|
8
|
+
include Displayable
|
9
|
+
|
10
|
+
def display_item_counts?
|
11
|
+
send(:'display-item-counts') == 'true'
|
12
|
+
end
|
13
|
+
|
14
|
+
def groups
|
15
|
+
@groups ||= parent.exhibit.groups.published.where(slug: item_ids).sort do |a, b|
|
16
|
+
ordered_items.index(a.slug) <=> ordered_items.index(b.slug)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def groups?
|
21
|
+
!groups.empty?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -25,6 +25,7 @@ module Spotlight
|
|
25
25
|
can :manage, [
|
26
26
|
Spotlight::Attachment,
|
27
27
|
Spotlight::Search,
|
28
|
+
Spotlight::Group,
|
28
29
|
Spotlight::Resource,
|
29
30
|
Spotlight::Page,
|
30
31
|
Spotlight::Contact,
|
@@ -43,6 +44,7 @@ module Spotlight
|
|
43
44
|
can :read, Spotlight::Exhibit, published: true
|
44
45
|
can :read, Spotlight::Page, published: true
|
45
46
|
can :read, Spotlight::Search, published: true
|
47
|
+
can :read, Spotlight::Group, published: true
|
46
48
|
can :read, Spotlight::Language, public: true
|
47
49
|
end
|
48
50
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
@@ -6,7 +6,7 @@ module Spotlight
|
|
6
6
|
class AboutPage < Spotlight::Page
|
7
7
|
extend FriendlyId
|
8
8
|
friendly_id :title, use: %i[slugged scoped finders history], scope: %i[exhibit locale] do |config|
|
9
|
-
config.reserved_words
|
9
|
+
config.reserved_words&.concat(%w[update_all contacts])
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -76,6 +76,7 @@ module Spotlight
|
|
76
76
|
|
77
77
|
config.show.merge! show unless show.blank?
|
78
78
|
config.index.merge! index unless index.blank?
|
79
|
+
config.index.respond_to[:iiif_json] = true
|
79
80
|
|
80
81
|
config.index.thumbnail_field ||= Spotlight::Engine.config.thumbnail_field
|
81
82
|
|
@@ -353,7 +354,7 @@ module Spotlight
|
|
353
354
|
def title_only_by_default?(view)
|
354
355
|
return false if %i[show enabled].include?(view)
|
355
356
|
|
356
|
-
title_only = default_blacklight_config.view.send(:[], view)
|
357
|
+
title_only = default_blacklight_config.view.send(:[], view)&.title_only_by_default
|
357
358
|
title_only.nil? ? false : title_only
|
358
359
|
end
|
359
360
|
|
@@ -4,6 +4,7 @@ require 'mail'
|
|
4
4
|
module Spotlight
|
5
5
|
##
|
6
6
|
# Spotlight exhibit
|
7
|
+
# rubocop:disable Metrics/ClassLength
|
7
8
|
class Exhibit < ActiveRecord::Base
|
8
9
|
class_attribute :themes_selector
|
9
10
|
include Spotlight::ExhibitAnalytics
|
@@ -22,11 +23,16 @@ module Spotlight
|
|
22
23
|
paginates_per 48
|
23
24
|
|
24
25
|
extend FriendlyId
|
25
|
-
friendly_id :title, use: %i[slugged finders]
|
26
|
+
friendly_id :title, use: %i[slugged finders] do |config|
|
27
|
+
config.reserved_words&.concat(%w[site])
|
28
|
+
end
|
29
|
+
|
26
30
|
validates :title, presence: true, if: -> { I18n.locale == I18n.default_locale }
|
27
31
|
validates :slug, uniqueness: true
|
28
32
|
validates :theme, inclusion: { in: Spotlight::Engine.config.exhibit_themes }, allow_blank: true
|
29
33
|
|
34
|
+
after_validation :move_friendly_id_error_to_slug
|
35
|
+
|
30
36
|
acts_as_tagger
|
31
37
|
acts_as_taggable
|
32
38
|
delegate :blacklight_config, to: :blacklight_configuration
|
@@ -50,6 +56,7 @@ module Spotlight
|
|
50
56
|
has_many :custom_search_fields, dependent: :delete_all
|
51
57
|
|
52
58
|
has_many :feature_pages, -> { for_default_locale }, extend: FriendlyId::FinderMethods
|
59
|
+
has_many :groups, dependent: :delete_all
|
53
60
|
has_many :main_navigations, dependent: :delete_all
|
54
61
|
has_many :reindexing_log_entries, dependent: :destroy
|
55
62
|
has_many :resources
|
@@ -70,7 +77,7 @@ module Spotlight
|
|
70
77
|
belongs_to :masthead, dependent: :destroy, optional: true
|
71
78
|
belongs_to :thumbnail, class_name: 'Spotlight::ExhibitThumbnail', dependent: :destroy, optional: true
|
72
79
|
|
73
|
-
accepts_nested_attributes_for :about_pages, :attachments, :contacts, :custom_fields, :feature_pages, :languages,
|
80
|
+
accepts_nested_attributes_for :about_pages, :attachments, :contacts, :custom_fields, :feature_pages, :groups, :languages,
|
74
81
|
:main_navigations, :owned_taggings, :pages, :resources, :searches, :solr_document_sidecars, :translations
|
75
82
|
accepts_nested_attributes_for :blacklight_configuration, :home_page, :filters, update_only: true
|
76
83
|
accepts_nested_attributes_for :masthead, :thumbnail, update_only: true, reject_if: proc { |attr| attr['iiif_tilesource'].blank? }
|
@@ -151,5 +158,10 @@ module Spotlight
|
|
151
158
|
def current_reindexing_log_entry
|
152
159
|
reindexing_log_entries.started_or_completed.first || reindexing_log_entries.build
|
153
160
|
end
|
161
|
+
|
162
|
+
def move_friendly_id_error_to_slug
|
163
|
+
errors.add :slug, *errors.delete(:friendly_id) if errors[:friendly_id].present?
|
164
|
+
end
|
154
165
|
end
|
166
|
+
# rubocop:enable Metrics/ClassLength
|
155
167
|
end
|