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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- 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_block.js +55 -1
- 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/blocks/uploaded_items_block.js +7 -2
- data/app/assets/javascripts/spotlight/admin/crop.es6 +11 -0
- 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/block_controls.js +21 -12
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +11 -3
- 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/_accessibility.scss +1 -1
- data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
- data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
- data/app/assets/stylesheets/spotlight/_catalog.scss +6 -6
- data/app/assets/stylesheets/spotlight/_curation.scss +6 -0
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +214 -83
- data/app/assets/stylesheets/spotlight/_header.scss +1 -1
- data/app/assets/stylesheets/spotlight/_item_text_block.scss +6 -0
- data/app/assets/stylesheets/spotlight/_pages.scss +10 -5
- data/app/assets/stylesheets/spotlight/_report_a_problem.scss +5 -2
- data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
- data/app/assets/stylesheets/spotlight/_translations.scss +7 -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 -12
- 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/exhibits_controller.rb +2 -3
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/groups_controller.rb +80 -0
- data/app/controllers/spotlight/pages_controller.rb +6 -9
- data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +7 -19
- data/app/controllers/spotlight/translations_controller.rb +46 -0
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/crop_helper.rb +4 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
- data/app/helpers/spotlight/main_app_helpers.rb +1 -1
- data/app/jobs/spotlight/add_uploads_from_csv.rb +30 -5
- data/app/mailers/spotlight/indexing_complete_mailer.rb +3 -2
- data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
- data/app/models/concerns/spotlight/translatables.rb +17 -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 +3 -1
- data/app/models/spotlight/blacklight_configuration.rb +2 -1
- data/app/models/spotlight/contact.rb +1 -1
- data/app/models/spotlight/custom_field.rb +3 -3
- data/app/models/spotlight/exhibit.rb +18 -4
- data/app/models/spotlight/feature_page.rb +3 -1
- data/app/models/spotlight/featured_image.rb +29 -12
- data/app/models/spotlight/group.rb +22 -0
- data/app/models/spotlight/group_member.rb +11 -0
- data/app/models/spotlight/home_page.rb +3 -1
- data/app/models/spotlight/main_navigation.rb +2 -2
- data/app/models/spotlight/masthead.rb +1 -1
- data/app/models/spotlight/page.rb +5 -1
- data/app/models/spotlight/page_configurations.rb +6 -0
- data/app/models/spotlight/page_content.rb +2 -0
- data/app/models/spotlight/resources/csv_upload.rb +2 -1
- data/app/models/spotlight/resources/iiif_manifest.rb +8 -6
- data/app/models/spotlight/resources/upload.rb +1 -1
- data/app/models/spotlight/search.rb +10 -1
- data/app/models/spotlight/solr_document_sidecar.rb +7 -5
- data/app/models/spotlight/temporary_image.rb +8 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +482 -0
- data/app/services/spotlight/solr_document_builder.rb +1 -0
- data/app/values/custom_field_name.rb +1 -0
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/spotlight/about_pages/_empty.html.erb +5 -5
- data/app/views/spotlight/browse/_search.html.erb +5 -3
- data/app/views/spotlight/browse/_search_title.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/contacts/_form.html.erb +1 -1
- data/app/views/spotlight/feature_pages/_empty.html.erb +5 -5
- data/app/views/spotlight/featured_images/_form.html.erb +1 -1
- data/app/views/spotlight/featured_images/_upload_form.html.erb +1 -1
- data/app/views/spotlight/home_pages/_empty.html.erb +3 -3
- data/app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb +9 -0
- data/app/views/spotlight/pages/_form.html.erb +2 -2
- data/app/views/spotlight/searches/_form.html.erb +13 -0
- data/app/views/spotlight/searches/_group.html.erb +27 -0
- data/app/views/spotlight/searches/_search.html.erb +1 -0
- data/app/views/spotlight/searches/index.html.erb +58 -17
- data/app/views/spotlight/shared/_honeypot_field.html.erb +4 -0
- data/app/views/spotlight/shared/_report_a_problem.html.erb +7 -10
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +44 -0
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
- data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
- data/app/views/spotlight/translations/_general.html.erb +7 -7
- data/app/views/spotlight/translations/_groups.html.erb +34 -0
- data/app/views/spotlight/translations/_import.html.erb +24 -0
- data/app/views/spotlight/translations/_metadata.html.erb +1 -1
- data/app/views/spotlight/translations/_page.html.erb +5 -5
- data/app/views/spotlight/translations/_pages.html.erb +4 -4
- data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
- data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
- data/app/views/spotlight/translations/edit.html.erb +14 -6
- data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
- data/config/i18n-tasks.yml +7 -0
- data/config/locales/spotlight.ar.yml +47 -24
- data/config/locales/spotlight.en.yml +182 -127
- data/config/routes.rb +16 -1
- data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
- data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
- data/lib/generators/spotlight/install_generator.rb +23 -2
- data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +10 -0
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -1
- data/lib/spotlight/engine.rb +27 -3
- data/lib/spotlight/upload_field_config.rb +1 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +3 -3
- data/spec/controllers/spotlight/browse_controller_spec.rb +24 -1
- data/spec/controllers/spotlight/catalog_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
- 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/home_pages_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
- data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
- data/spec/examples.txt +1437 -1389
- data/spec/factories/featured_images.rb +4 -0
- data/spec/factories/group.rb +17 -0
- data/spec/factories/searches.rb +11 -1
- data/spec/features/add_contacts_spec.rb +1 -1
- data/spec/features/browse_category_admin_spec.rb +39 -7
- data/spec/features/browse_category_navigation_spec.rb +44 -0
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/catalog_spec.rb +2 -2
- data/spec/features/create_exhibit_spec.rb +5 -4
- data/spec/features/dashboard_spec.rb +7 -7
- data/spec/features/edit_search_fields_spec.rb +2 -2
- data/spec/features/exhibits/administration_spec.rb +3 -3
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +1 -1
- data/spec/features/exhibits/language_create_edit_spec.rb +3 -3
- data/spec/features/exhibits/translation_editing_spec.rb +57 -8
- data/spec/features/home_page_spec.rb +13 -4
- data/spec/features/item_admin_spec.rb +4 -4
- data/spec/features/javascript/about_page_admin_spec.rb +1 -1
- data/spec/features/javascript/block_controls_spec.rb +3 -1
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
- data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
- data/spec/features/javascript/edit_in_place_spec.rb +3 -3
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/features/javascript/search_config_admin_spec.rb +1 -1
- data/spec/features/report_a_problem_spec.rb +6 -5
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
- data/spec/helpers/spotlight/pages_helper_spec.rb +2 -2
- data/spec/i18n_spec.rb +0 -2
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +13 -1
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +11 -1
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
- data/spec/models/solr_document_spec.rb +2 -3
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -0
- data/spec/models/spotlight/exhibit_spec.rb +18 -2
- data/spec/models/spotlight/featured_image_spec.rb +27 -0
- data/spec/models/spotlight/group_spec.rb +19 -0
- data/spec/models/spotlight/main_navigation_spec.rb +1 -1
- data/spec/models/spotlight/page_spec.rb +6 -1
- data/spec/models/spotlight/resources/upload_spec.rb +43 -79
- data/spec/models/spotlight/role_spec.rb +3 -3
- data/spec/models/spotlight/search_spec.rb +30 -3
- data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +168 -23
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -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 -3
- 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/shared/_exhibit_navbar.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +6 -6
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
- data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +7 -8
- data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +46 -21
- data/vendor/assets/javascripts/tiny-slider.js +3218 -0
- data/vendor/assets/stylesheets/tiny-slider.css +1 -0
- metadata +399 -284
- data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
- data/app/serializers/spotlight/featured_image_representer.rb +0 -29
- data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
- data/app/serializers/spotlight/page_representer.rb +0 -33
- data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -58,13 +58,18 @@
|
|
58
58
|
}
|
59
59
|
|
60
60
|
.contact-properties {
|
61
|
-
padding-left:
|
62
|
-
|
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:
|
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 * .
|
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
|
@@ -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
|
-
|
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,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 :
|
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.
|
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::
|
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:
|
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
|