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.
- checksums.yaml +4 -4
- data/app/assets/images/blacklight/add_circle.svg +1 -0
- data/app/assets/images/blacklight/arrow_back_ios.svg +1 -0
- data/app/assets/images/blacklight/arrow_forward_ios.svg +1 -0
- data/app/assets/images/blacklight/check.svg +1 -0
- data/app/assets/images/blacklight/check_circle.svg +1 -0
- data/app/assets/images/blacklight/chevron_right.svg +1 -0
- data/app/assets/images/blacklight/custom_fullscreen.svg +1 -0
- data/app/assets/images/blacklight/edit.svg +1 -0
- data/app/assets/images/blacklight/error.svg +1 -0
- data/app/assets/images/blacklight/info.svg +1 -0
- data/app/assets/images/blacklight/remove_circle.svg +1 -0
- data/app/assets/images/blacklight/remove_circle_outline.svg +1 -0
- data/app/assets/images/blacklight/resize_small.svg +1 -0
- data/app/assets/images/blacklight/warning.svg +1 -0
- data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +1 -1
- data/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +2 -2
- data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/admin/blocks/resources_block.js +7 -7
- data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +3 -3
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -7
- data/app/assets/javascripts/spotlight/admin/catalog_edit.js +2 -2
- data/app/assets/javascripts/spotlight/admin/multi_image_selector.js +2 -2
- data/app/assets/javascripts/spotlight/admin/reindex_monitor.js +1 -1
- data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
- data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +1 -1
- data/app/assets/javascripts/spotlight/admin/users.js +1 -1
- data/app/assets/javascripts/spotlight/user/index.js +1 -0
- data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +6 -6
- data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +44 -4
- data/app/assets/stylesheets/spotlight/_blacklight_overrides.scss +4 -8
- data/app/assets/stylesheets/spotlight/_bootstrap_overrides.scss +31 -14
- data/app/assets/stylesheets/spotlight/_browse.scss +16 -13
- data/app/assets/stylesheets/spotlight/_catalog.scss +13 -7
- data/app/assets/stylesheets/spotlight/_collapse_toggle.scss +10 -14
- data/app/assets/stylesheets/spotlight/_curation.scss +34 -32
- data/app/assets/stylesheets/spotlight/_exhibit_admin.scss +4 -29
- data/app/assets/stylesheets/spotlight/_exhibits_index.scss +16 -14
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +22 -20
- data/app/assets/stylesheets/spotlight/_footer.scss +2 -2
- data/app/assets/stylesheets/spotlight/_header.scss +18 -39
- data/app/assets/stylesheets/spotlight/_item_text_block.scss +1 -24
- data/app/assets/stylesheets/spotlight/_mixins.scss +3 -8
- data/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +1 -1
- data/app/assets/stylesheets/spotlight/_nestable.scss +1 -2
- data/app/assets/stylesheets/spotlight/_pages.scss +33 -54
- data/app/assets/stylesheets/spotlight/_report_a_problem.scss +7 -1
- data/app/assets/stylesheets/spotlight/_sir-trevor_overrides.scss +9 -9
- data/app/assets/stylesheets/spotlight/_slideshow_block.scss +13 -11
- data/app/assets/stylesheets/spotlight/_spotlight.scss +0 -1
- data/app/assets/stylesheets/spotlight/_translations.scss +12 -12
- data/app/assets/stylesheets/spotlight/_variables.scss +14 -15
- data/app/assets/stylesheets/spotlight/_variables_bootstrap.scss +7 -7
- data/app/assets/stylesheets/spotlight/typeahead.css +1 -1
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +3 -2
- data/app/controllers/concerns/spotlight/catalog.rb +1 -1
- data/app/controllers/concerns/spotlight/controller.rb +3 -3
- data/app/controllers/concerns/spotlight/search_helper.rb +23 -0
- data/app/controllers/spotlight/browse_controller.rb +18 -4
- data/app/controllers/spotlight/catalog_controller.rb +13 -17
- data/app/controllers/spotlight/dashboards_controller.rb +5 -1
- data/app/controllers/spotlight/exhibits_controller.rb +1 -1
- data/app/controllers/spotlight/home_pages_controller.rb +32 -3
- data/app/controllers/spotlight/pages_controller.rb +19 -1
- data/app/controllers/spotlight/search_configurations_controller.rb +3 -3
- data/app/controllers/spotlight/searches_controller.rb +4 -1
- data/app/controllers/spotlight/solr_controller.rb +1 -2
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/browse_helper.rb +1 -1
- data/app/helpers/spotlight/crud_link_helpers.rb +19 -0
- data/app/helpers/spotlight/pages_helper.rb +1 -1
- data/app/mailers/spotlight/contact_mailer.rb +1 -1
- data/app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb +2 -2
- data/app/models/concerns/spotlight/exhibit_analytics.rb +1 -3
- data/app/models/concerns/spotlight/exhibit_documents.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +11 -3
- data/app/models/spotlight/ability.rb +1 -1
- data/app/models/spotlight/analytics/ga.rb +25 -35
- data/app/models/spotlight/analytics/ga_model.rb +29 -0
- data/app/models/spotlight/blacklight_configuration.rb +5 -3
- data/app/models/spotlight/contact_form.rb +11 -4
- data/app/models/spotlight/exhibit.rb +0 -4
- data/app/models/spotlight/field_metadata.rb +3 -9
- data/app/models/spotlight/page.rb +0 -3
- data/app/models/spotlight/page_configurations.rb +1 -1
- data/app/models/spotlight/role.rb +0 -4
- data/app/models/spotlight/search.rb +3 -17
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +5 -1
- data/app/serializers/spotlight/exhibit_export_serializer.rb +69 -28
- data/app/serializers/spotlight/page_representer.rb +1 -1
- data/app/views/catalog/_save_search.html.erb +6 -4
- data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
- data/app/views/layouts/spotlight/base.html.erb +48 -0
- data/app/views/layouts/spotlight/spotlight.html.erb +16 -54
- data/app/views/shared/_about_navbar.html.erb +2 -2
- data/app/views/shared/_browse_navbar.html.erb +2 -2
- data/app/views/shared/_curated_features_navbar.html.erb +4 -4
- data/app/views/shared/_exhibit_navbar.html.erb +5 -5
- data/app/views/shared/_header_navbar.html.erb +8 -13
- data/app/views/shared/_masthead.html.erb +1 -1
- data/app/views/shared/_site_sidebar.html.erb +6 -6
- data/app/views/shared/_user_util_links.html.erb +47 -0
- data/app/views/spotlight/about_pages/_contact.html.erb +3 -4
- data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
- data/app/views/spotlight/about_pages/_sidebar.html.erb +3 -5
- data/app/views/spotlight/about_pages/index.html.erb +7 -6
- data/app/views/spotlight/admin_users/index.html.erb +78 -79
- data/app/views/spotlight/appearances/edit.html.erb +26 -23
- data/app/views/spotlight/browse/_search.html.erb +2 -2
- data/app/views/spotlight/browse/_search_box.html.erb +9 -6
- data/app/views/spotlight/browse/_search_title.html.erb +1 -1
- data/app/views/spotlight/browse/_sort_and_per_page.html.erb +3 -5
- data/app/views/spotlight/browse/index.html.erb +4 -6
- data/app/views/spotlight/browse/show.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_header.html.erb +2 -2
- data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_document_admin_table.html.erb +4 -4
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -2
- data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +3 -5
- data/app/views/spotlight/catalog/admin.html.erb +12 -12
- data/app/views/spotlight/contact_forms/new.html.erb +1 -3
- data/app/views/spotlight/contacts/edit.html.erb +6 -5
- data/app/views/spotlight/contacts/new.html.erb +6 -5
- data/app/views/spotlight/custom_fields/edit.html.erb +6 -5
- data/app/views/spotlight/custom_fields/new.html.erb +6 -5
- data/app/views/spotlight/dashboards/_analytics.html.erb +3 -3
- data/app/views/spotlight/dashboards/_page.html.erb +6 -6
- data/app/views/spotlight/dashboards/_page_activity.html.erb +5 -5
- data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +12 -12
- data/app/views/spotlight/dashboards/analytics.html.erb +11 -11
- data/app/views/spotlight/dashboards/show.html.erb +13 -13
- data/app/views/spotlight/exhibits/_confirmation_status.html.erb +3 -4
- data/app/views/spotlight/exhibits/_contact.html.erb +3 -3
- data/app/views/spotlight/exhibits/_delete.html.erb +7 -5
- data/app/views/spotlight/exhibits/_exhibit_card.html.erb +2 -2
- data/app/views/spotlight/exhibits/_exhibit_card_front.html.erb +2 -2
- data/app/views/spotlight/exhibits/_form.html.erb +5 -5
- data/app/views/spotlight/exhibits/_languages.html.erb +2 -2
- data/app/views/spotlight/exhibits/_new_exhibit_form.html.erb +0 -2
- data/app/views/spotlight/exhibits/edit.html.erb +43 -42
- data/app/views/spotlight/exhibits/index.html.erb +40 -41
- data/app/views/spotlight/exhibits/new.html.erb +4 -5
- data/app/views/spotlight/feature_pages/_header.html.erb +12 -14
- data/app/views/spotlight/feature_pages/_sidebar.html.erb +2 -4
- data/app/views/spotlight/featured_images/_form.html.erb +4 -4
- data/app/views/spotlight/filters/_form.html.erb +1 -1
- data/app/views/spotlight/home_pages/_edit_page_link.html.erb +1 -1
- data/app/views/spotlight/home_pages/_sidebar.html.erb +1 -3
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +4 -4
- data/app/views/spotlight/metadata_configurations/edit.html.erb +5 -4
- data/app/views/spotlight/pages/_edit_page_link.html.erb +1 -1
- data/app/views/spotlight/pages/_form.html.erb +7 -7
- data/app/views/spotlight/pages/_order_pages.html.erb +2 -2
- data/app/views/spotlight/pages/_page.html.erb +11 -11
- data/app/views/spotlight/pages/_view_type_group.html.erb +1 -1
- data/app/views/spotlight/pages/edit.html.erb +2 -4
- data/app/views/spotlight/pages/index.html.erb +5 -4
- data/app/views/spotlight/pages/show.html.erb +5 -4
- data/app/views/spotlight/resources/_external_resources_form.html.erb +2 -2
- data/app/views/spotlight/resources/_form.html.erb +1 -1
- data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
- data/app/views/spotlight/resources/iiif/_form.html.erb +1 -1
- data/app/views/spotlight/resources/json_upload/_form.html.erb +1 -1
- data/app/views/spotlight/resources/new.html.erb +25 -23
- data/app/views/spotlight/resources/upload/_form.html.erb +2 -2
- data/app/views/spotlight/roles/index.html.erb +60 -57
- data/app/views/spotlight/search_configurations/_facet_metadata.html.erb +3 -1
- data/app/views/spotlight/search_configurations/_facets.html.erb +19 -18
- data/app/views/spotlight/search_configurations/_search_fields.html.erb +6 -6
- data/app/views/spotlight/search_configurations/_sort.html.erb +6 -6
- data/app/views/spotlight/search_configurations/edit.html.erb +42 -40
- data/app/views/spotlight/searches/_form.html.erb +15 -10
- data/app/views/spotlight/searches/_search.html.erb +29 -22
- data/app/views/spotlight/searches/edit.html.erb +6 -5
- data/app/views/spotlight/searches/index.html.erb +32 -31
- data/app/views/spotlight/shared/_configuration_sidebar.html.erb +6 -6
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +8 -9
- data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +6 -8
- data/app/views/spotlight/shared/_locale_picker.html.erb +3 -3
- data/app/views/spotlight/shared/_report_a_problem.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_oembed_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +8 -8
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +8 -8
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb +3 -4
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +32 -31
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +5 -5
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +8 -10
- data/app/views/spotlight/sites/edit.html.erb +31 -34
- data/app/views/spotlight/sites/edit_exhibits.html.erb +28 -29
- data/app/views/spotlight/tags/index.html.erb +25 -24
- data/app/views/spotlight/translations/_browse_categories.html.erb +20 -15
- data/app/views/spotlight/translations/_general.html.erb +69 -91
- data/app/views/spotlight/translations/_metadata.html.erb +18 -14
- data/app/views/spotlight/translations/_page.html.erb +2 -2
- data/app/views/spotlight/translations/_search_fields.html.erb +26 -20
- data/app/views/spotlight/translations/edit.html.erb +16 -14
- data/config/locales/spotlight.en.yml +3 -0
- data/config/routes.rb +1 -1
- data/lib/generators/spotlight/install_generator.rb +2 -2
- data/lib/generators/spotlight/scaffold_resource_generator.rb +1 -1
- data/lib/generators/spotlight/templates/spotlight.scss +0 -1
- data/lib/spotlight/engine.rb +12 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/browse_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/catalog_controller_spec.rb +13 -13
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +2 -1
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +1 -1
- data/spec/examples.txt +50 -1489
- data/spec/features/add_items_spec.rb +2 -2
- data/spec/features/browse_category_admin_spec.rb +3 -3
- data/spec/features/browse_category_spec.rb +3 -3
- data/spec/features/catalog_spec.rb +1 -1
- data/spec/features/exhibits/translation_editing_spec.rb +21 -21
- data/spec/features/feature_page_spec.rb +1 -1
- data/spec/features/home_page_spec.rb +3 -3
- data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +1 -1
- data/spec/features/javascript/blocks/link_to_search_block_spec.rb +1 -1
- data/spec/features/javascript/blocks/search_result_block_spec.rb +9 -4
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +23 -15
- data/spec/features/javascript/blocks/solr_documents_carousel_block_spec.rb +29 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +2 -2
- data/spec/features/javascript/edit_in_place_spec.rb +1 -0
- data/spec/features/javascript/feature_page_admin_spec.rb +11 -11
- data/spec/features/javascript/locale_selector_spec.rb +0 -1
- data/spec/features/javascript/multi_image_select_spec.rb +3 -3
- data/spec/features/javascript/reindex_monitor_spec.rb +2 -2
- data/spec/features/javascript/roles_admin_spec.rb +2 -2
- data/spec/features/javascript/search_context_spec.rb +4 -6
- data/spec/features/site_users_management_spec.rb +1 -1
- data/spec/helpers/spotlight/application_helper_spec.rb +2 -1
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +19 -0
- data/spec/helpers/spotlight/languages_helper_spec.rb +1 -0
- data/spec/lib/spotlight/controller_spec.rb +2 -2
- data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +38 -0
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +7 -6
- data/spec/models/spotlight/analytics/ga_spec.rb +16 -1
- data/spec/models/spotlight/contact_form_spec.rb +37 -5
- data/spec/models/spotlight/exhibit_spec.rb +8 -4
- data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +4 -0
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +15 -11
- data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +60 -0
- data/spec/test_app_templates/Gemfile.extra +3 -0
- data/spec/test_app_templates/catalog_controller.rb +4 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
- data/spec/views/shared/_header_navbar.html.erb_spec.rb +1 -1
- data/spec/views/shared/_masthead.html.erb_spec.rb +1 -1
- data/spec/views/{_user_util_links.html.erb_spec.rb → shared/_user_util_links.html.erb_spec.rb} +1 -1
- data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/browse/_sort_and_per_page.html.erb_spec.rb +2 -13
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +5 -5
- data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +7 -7
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -2
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/translations/_page.html.erb_spec.rb +2 -2
- data/vendor/assets/javascripts/bootstrap-tagsinput.js +1 -1
- data/vendor/assets/stylesheets/sir-trevor/_variables.scss +15 -8
- metadata +31 -28
- data/app/assets/stylesheets/spotlight/_navbar.scss +0 -48
- data/app/views/_user_util_links.html.erb +0 -50
- data/app/views/shared/_modal.html.erb +0 -6
@@ -8,11 +8,13 @@ module Spotlight
|
|
8
8
|
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
|
9
9
|
|
10
10
|
include Spotlight::Base
|
11
|
+
include Spotlight::SearchHelper
|
11
12
|
|
12
13
|
before_action only: [:show] do
|
13
14
|
blacklight_config.view.reject! { |_k, _v| true }
|
14
15
|
blacklight_config.view.admin_table.partials = ['index_compact']
|
15
16
|
blacklight_config.view.admin_table.document_actions = []
|
17
|
+
blacklight_config.track_search_session = false
|
16
18
|
end
|
17
19
|
|
18
20
|
def show
|
@@ -49,7 +51,9 @@ module Spotlight
|
|
49
51
|
|
50
52
|
def load_recent_solr_documents(count)
|
51
53
|
solr_params = { sort: "#{blacklight_config.index.timestamp_field} desc" }
|
52
|
-
@response, docs = search_results
|
54
|
+
@response, docs = search_service.search_results do |builder|
|
55
|
+
builder.merge(solr_params)
|
56
|
+
end
|
53
57
|
docs.take(count)
|
54
58
|
end
|
55
59
|
end
|
@@ -4,9 +4,9 @@ module Spotlight
|
|
4
4
|
##
|
5
5
|
# Administrative CRUD actions for an exhibit
|
6
6
|
class ExhibitsController < Spotlight::ApplicationController
|
7
|
+
include Spotlight::SearchHelper
|
7
8
|
before_action :authenticate_user!, except: [:index]
|
8
9
|
before_action :set_tab, only: [:edit, :update]
|
9
|
-
include Blacklight::SearchHelper
|
10
10
|
|
11
11
|
load_and_authorize_resource
|
12
12
|
|
@@ -4,13 +4,14 @@ module Spotlight
|
|
4
4
|
##
|
5
5
|
# CRUD actions for the exhibit home page
|
6
6
|
class HomePagesController < Spotlight::PagesController
|
7
|
-
include Blacklight::SearchHelper
|
8
7
|
include Spotlight::Catalog
|
9
8
|
|
10
9
|
load_and_authorize_resource through: :exhibit, singleton: true, instance_name: 'page'
|
11
10
|
|
12
11
|
before_action :attach_breadcrumbs, except: :show
|
13
12
|
|
13
|
+
helper_method :facet_limit_for
|
14
|
+
|
14
15
|
def edit
|
15
16
|
add_breadcrumb t(:'spotlight.curation.sidebar.feature_pages'), exhibit_feature_pages_path(@exhibit)
|
16
17
|
add_breadcrumb @page.title, [:edit, @exhibit, @page]
|
@@ -22,7 +23,7 @@ module Spotlight
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def show
|
25
|
-
@response, @document_list = search_results
|
26
|
+
@response, @document_list = search_service.search_results if @page.display_sidebar?
|
26
27
|
|
27
28
|
if @page.nil? || !@page.published?
|
28
29
|
render '/catalog/index'
|
@@ -37,10 +38,38 @@ module Spotlight
|
|
37
38
|
super
|
38
39
|
end
|
39
40
|
|
41
|
+
# Copied from blacklight to avoid bringing in all of Blacklight::Catalog
|
42
|
+
DEFAULT_FACET_LIMIT = 10
|
43
|
+
|
44
|
+
# Look up facet limit for given facet_field. Will look at config, and
|
45
|
+
# if config is 'true' will look up from Solr @response if available. If
|
46
|
+
# no limit is available, returns nil. Used from #add_facetting_to_solr
|
47
|
+
# to supply f.fieldname.facet.limit values in solr request (no @response
|
48
|
+
# available), and used in display (with @response available) to create
|
49
|
+
# a facet paginator with the right limit.
|
50
|
+
def facet_limit_for(facet_field)
|
51
|
+
facet = blacklight_config.facet_fields[facet_field]
|
52
|
+
return if facet.blank?
|
53
|
+
|
54
|
+
if facet.limit && @response && @response.aggregations[facet.field]
|
55
|
+
limit = @response.aggregations[facet.field].limit
|
56
|
+
|
57
|
+
if limit.nil? # we didn't get or a set a limit, so infer one.
|
58
|
+
facet.limit if facet.limit != true
|
59
|
+
elsif limit == -1 # limit -1 is solr-speak for unlimited
|
60
|
+
nil
|
61
|
+
else
|
62
|
+
limit.to_i - 1 # we added 1 to find out if we needed to paginate
|
63
|
+
end
|
64
|
+
elsif facet.limit
|
65
|
+
facet.limit == true ? DEFAULT_FACET_LIMIT : facet.limit
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
40
69
|
private
|
41
70
|
|
42
71
|
alias search_action_url exhibit_search_action_url
|
43
|
-
alias
|
72
|
+
alias search_facet_path exhibit_search_facet_path
|
44
73
|
|
45
74
|
def load_locale_specific_page
|
46
75
|
@page = Spotlight::HomePage.for_locale.find_by(exhibit: current_exhibit)
|
@@ -13,10 +13,15 @@ module Spotlight
|
|
13
13
|
load_and_authorize_resource through: :exhibit, instance_name: 'page', only: [:index]
|
14
14
|
|
15
15
|
helper Openseadragon::OpenseadragonHelper
|
16
|
+
include Spotlight::SearchHelper
|
16
17
|
include Spotlight::Base
|
17
18
|
include Blacklight::SearchContext
|
18
19
|
|
19
|
-
helper_method :get_search_results, :search_results, :fetch, :page_collection_name
|
20
|
+
helper_method :get_search_results, :search_results, :fetch, :page_collection_name, :presenter
|
21
|
+
|
22
|
+
before_action do
|
23
|
+
blacklight_config.track_search_session = false
|
24
|
+
end
|
20
25
|
|
21
26
|
# GET /exhibits/1/pages
|
22
27
|
def index
|
@@ -111,8 +116,17 @@ module Spotlight
|
|
111
116
|
@_prefixes ||= super + ['catalog']
|
112
117
|
end
|
113
118
|
|
119
|
+
# Add a Page specific search_results method that takes user params as
|
120
|
+
# an option and passes that off to the search service to get results
|
121
|
+
# @param [Hash] the query parameters
|
122
|
+
# @return [Object] the search results object from the configured search service
|
123
|
+
def search_results(user_params)
|
124
|
+
search_service(user_params).search_results
|
125
|
+
end
|
126
|
+
|
114
127
|
def undo_link
|
115
128
|
return unless can? :manage, @page
|
129
|
+
return if @page.versions.blank?
|
116
130
|
|
117
131
|
view_context.link_to(t(:'spotlight.versions.undo'), revert_version_path(@page.versions.last), method: :post)
|
118
132
|
end
|
@@ -197,6 +211,10 @@ module Spotlight
|
|
197
211
|
raise ActiveRecord::RecordNotFound
|
198
212
|
end
|
199
213
|
end
|
214
|
+
|
215
|
+
def presenter(document)
|
216
|
+
view_context.index_presenter(document)
|
217
|
+
end
|
200
218
|
end
|
201
219
|
# rubocop:enable Metrics/ClassLength
|
202
220
|
end
|
@@ -4,12 +4,12 @@ module Spotlight
|
|
4
4
|
##
|
5
5
|
# CRUD actions for Blacklight search configuration
|
6
6
|
class SearchConfigurationsController < Spotlight::ApplicationController
|
7
|
+
include Spotlight::SearchHelper
|
8
|
+
|
7
9
|
before_action :authenticate_user!
|
8
10
|
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
|
9
11
|
load_and_authorize_resource :blacklight_configuration, through: :exhibit, singleton: true, parent: false
|
10
12
|
|
11
|
-
include Blacklight::SearchHelper
|
12
|
-
|
13
13
|
def show
|
14
14
|
respond_to do |format|
|
15
15
|
format.json do
|
@@ -23,7 +23,7 @@ module Spotlight
|
|
23
23
|
add_breadcrumb t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
24
24
|
add_breadcrumb t(:'spotlight.configuration.sidebar.search_configuration'), edit_exhibit_search_configuration_path(@exhibit)
|
25
25
|
|
26
|
-
@field_metadata = Spotlight::FieldMetadata.new(current_exhibit, repository, @blacklight_configuration.blacklight_config)
|
26
|
+
@field_metadata = Spotlight::FieldMetadata.new(current_exhibit, blacklight_config.repository, @blacklight_configuration.blacklight_config)
|
27
27
|
end
|
28
28
|
|
29
29
|
def update
|
@@ -13,6 +13,7 @@ module Spotlight
|
|
13
13
|
before_action :attach_breadcrumbs, only: [:index, :edit], unless: -> { request.format.json? }
|
14
14
|
|
15
15
|
include Spotlight::Base
|
16
|
+
include Spotlight::SearchHelper
|
16
17
|
|
17
18
|
def create
|
18
19
|
@search.assign_attributes(search_params.except((:title unless @search.new_record?)))
|
@@ -37,7 +38,9 @@ module Spotlight
|
|
37
38
|
|
38
39
|
def autocomplete
|
39
40
|
search_params = autocomplete_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)
|
40
|
-
(_, document_list) = search_results
|
41
|
+
(_, document_list) = search_service.search_results do |builder|
|
42
|
+
builder.with(search_params)
|
43
|
+
end
|
41
44
|
|
42
45
|
respond_to do |format|
|
43
46
|
format.json do
|
@@ -8,8 +8,7 @@ module Spotlight
|
|
8
8
|
# This is an example of how you could integrate external indexing
|
9
9
|
# workflows with exhibit-specific content
|
10
10
|
class SolrController < Spotlight::ApplicationController
|
11
|
-
include
|
12
|
-
|
11
|
+
include Spotlight::SearchHelper
|
13
12
|
before_action :authenticate_user!
|
14
13
|
before_action :validate_writable_index!
|
15
14
|
|
@@ -121,7 +121,7 @@ module Spotlight
|
|
121
121
|
def select_deselect_button
|
122
122
|
button_tag(
|
123
123
|
t(:".deselect_all"),
|
124
|
-
class: 'btn btn-
|
124
|
+
class: 'btn btn-secondary btn-sm metadata-select',
|
125
125
|
data: {
|
126
126
|
behavior: 'metadata-select',
|
127
127
|
'deselect-text' => t(:".deselect_all"),
|
@@ -62,6 +62,25 @@ module Spotlight
|
|
62
62
|
action_default_value model, action
|
63
63
|
end
|
64
64
|
|
65
|
+
def nav_link(name = nil, options = nil, html_options = nil, &block)
|
66
|
+
# rubocop:disable Style/ParallelAssignment
|
67
|
+
# (Note: this is copied from upstream in Rails)
|
68
|
+
html_options, options, name = options, name, block if block_given?
|
69
|
+
# rubocop:enable Style/ParallelAssignment
|
70
|
+
|
71
|
+
html_options ||= {}
|
72
|
+
|
73
|
+
nav_link_html_options = html_options.merge(class: [html_options[:class], 'nav-link', ('active' if current_page?(options))].join(' '))
|
74
|
+
|
75
|
+
content_tag(:li, class: 'nav-item') do
|
76
|
+
if block_given?
|
77
|
+
link_to(options, nav_link_html_options, &block)
|
78
|
+
else
|
79
|
+
link_to(name, options, nav_link_html_options, &block)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
65
84
|
private
|
66
85
|
|
67
86
|
# rubocop:disable Metrics/MethodLength
|
@@ -30,7 +30,7 @@ module Spotlight
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def available_index_fields
|
33
|
-
fields = blacklight_config.index_fields.map { |k, _v| { key: k, label: index_field_label(
|
33
|
+
fields = blacklight_config.index_fields.map { |k, _v| { key: k, label: index_field_label(blacklight_config.document_model.new, k) } }
|
34
34
|
fields.unshift(key: document_show_link_field, label: t(:'spotlight.pages.form.title_placeholder')) unless index_fields.include? document_show_link_field
|
35
35
|
|
36
36
|
fields
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Spotlight
|
4
4
|
# Mailer for reporting problems to the application contact and/or exhibit administrator
|
5
|
-
class ContactMailer <
|
5
|
+
class ContactMailer < ApplicationMailer
|
6
6
|
def report_problem(contact_form)
|
7
7
|
@contact_form = contact_form
|
8
8
|
mail(@contact_form.headers)
|
@@ -12,7 +12,7 @@ module Spotlight
|
|
12
12
|
# Adds a filter that excludes resources that have been marked as not-visible
|
13
13
|
def apply_permissive_visibility_filter(solr_params)
|
14
14
|
return unless current_exhibit
|
15
|
-
return if scope
|
15
|
+
return if !blacklight_params[:public] && scope&.context&.key?(:current_ability) && scope.context[:current_ability].can?(:curate, current_exhibit)
|
16
16
|
|
17
17
|
solr_params.append_filter_query "-#{blacklight_config.document_model.visibility_field(current_exhibit)}:false"
|
18
18
|
end
|
@@ -30,7 +30,7 @@ module Spotlight
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def current_exhibit
|
33
|
-
|
33
|
+
blacklight_config.current_exhibit
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -30,7 +30,7 @@ module Spotlight
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def exhibit_search_builder_context
|
33
|
-
OpenStruct.new(blacklight_config: blacklight_config
|
33
|
+
OpenStruct.new(blacklight_config: blacklight_config.tap { |x| x.current_exhibit = self })
|
34
34
|
end
|
35
35
|
|
36
36
|
def repository
|
@@ -26,7 +26,7 @@ module SirTrevorRails
|
|
26
26
|
def documents
|
27
27
|
@documents ||= begin
|
28
28
|
doc_ids = items.map { |v| v[:id] }
|
29
|
-
_, documents = solr_helper.fetch(doc_ids)
|
29
|
+
_, documents = solr_helper.controller.send(:search_service).fetch(doc_ids)
|
30
30
|
documents
|
31
31
|
end
|
32
32
|
end
|
@@ -36,11 +36,19 @@ module SirTrevorRails
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def primary_caption?
|
39
|
-
primary_caption_field.present? &&
|
39
|
+
primary_caption_field.present? && show_primary_caption?
|
40
|
+
end
|
41
|
+
|
42
|
+
def show_primary_caption?
|
43
|
+
ActiveModel::Type::Boolean.new.cast(send(:'show-primary-caption'))
|
40
44
|
end
|
41
45
|
|
42
46
|
def secondary_caption?
|
43
|
-
secondary_caption_field.present? &&
|
47
|
+
secondary_caption_field.present? && show_secondary_caption?
|
48
|
+
end
|
49
|
+
|
50
|
+
def show_secondary_caption?
|
51
|
+
ActiveModel::Type::Boolean.new.cast(send(:'show-secondary-caption'))
|
44
52
|
end
|
45
53
|
|
46
54
|
def zpr_link?
|
@@ -19,7 +19,7 @@ module Spotlight
|
|
19
19
|
can :manage, [Spotlight::BlacklightConfiguration, Spotlight::ContactEmail, Spotlight::Language], exhibit_id: user.admin_roles.pluck(:resource_id)
|
20
20
|
can :manage, Spotlight::Role, resource_id: user.admin_roles.pluck(:resource_id), resource_type: 'Spotlight::Exhibit'
|
21
21
|
|
22
|
-
can :manage, PaperTrail::Version if user.roles.any?
|
22
|
+
can :manage, [PaperTrail::Version, Spotlight::FeaturedImage] if user.roles.any?
|
23
23
|
|
24
24
|
# exhibit curator
|
25
25
|
can :manage, [
|
@@ -10,21 +10,26 @@ module Spotlight
|
|
10
10
|
class Ga
|
11
11
|
extend Legato::Model
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
metrics :sessions, :users, :pageviews
|
16
|
-
|
17
|
-
def self.enabled?
|
13
|
+
def enabled?
|
18
14
|
user && site
|
19
15
|
end
|
20
16
|
|
21
|
-
|
22
|
-
|
17
|
+
delegate :metrics, to: :model
|
18
|
+
|
19
|
+
def exhibit_data(exhibit, options)
|
20
|
+
model.context(exhibit).results(site, Spotlight::Engine.config.ga_analytics_options.merge(options)).to_a.first || exhibit_data_unavailable
|
23
21
|
end
|
24
22
|
|
25
|
-
|
23
|
+
def page_data(exhibit, options)
|
24
|
+
options[:sort] ||= '-pageviews'
|
25
|
+
query = model.context(exhibit).results(site, Spotlight::Engine.config.ga_page_analytics_options.merge(options))
|
26
|
+
query.dimensions << :page_path
|
27
|
+
query.dimensions << :page_title
|
28
|
+
|
29
|
+
query.to_a
|
30
|
+
end
|
26
31
|
|
27
|
-
def
|
32
|
+
def user(scope = 'https://www.googleapis.com/auth/analytics.readonly')
|
28
33
|
@user ||= begin
|
29
34
|
Legato::User.new(oauth_token(scope))
|
30
35
|
rescue => e
|
@@ -33,52 +38,37 @@ module Spotlight
|
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
36
|
-
def
|
37
|
-
@site ||= user.accounts.first.profiles.
|
41
|
+
def site
|
42
|
+
@site ||= user.accounts.first.profiles.find { |x| x.web_property_id == Spotlight::Engine.config.ga_web_property_id }
|
38
43
|
end
|
39
44
|
|
40
|
-
|
41
|
-
context(exhibit).results(site, Spotlight::Engine.config.ga_analytics_options.merge(options)).to_a.first || exhibit_data_unavailable
|
42
|
-
end
|
45
|
+
private
|
43
46
|
|
44
|
-
def
|
45
|
-
|
47
|
+
def model
|
48
|
+
Spotlight::Analytics::GaModel
|
46
49
|
end
|
47
50
|
|
48
|
-
def
|
49
|
-
|
50
|
-
query = context(exhibit).results(site, Spotlight::Engine.config.ga_page_analytics_options.merge(options))
|
51
|
-
query.dimensions << :page_path
|
52
|
-
query.dimensions << :page_title
|
53
|
-
|
54
|
-
query.to_a
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.context(exhibit)
|
58
|
-
if exhibit.is_a? Spotlight::Exhibit
|
59
|
-
for_exhibit(exhibit)
|
60
|
-
else
|
61
|
-
path(exhibit)
|
62
|
-
end
|
51
|
+
def exhibit_data_unavailable
|
52
|
+
OpenStruct.new(pageviews: 'n/a', users: 'n/a', sessions: 'n/a')
|
63
53
|
end
|
64
54
|
|
65
|
-
def
|
55
|
+
def oauth_token(scope)
|
66
56
|
require 'oauth2'
|
67
57
|
|
68
58
|
access_token = auth_client(scope).fetch_access_token!
|
69
59
|
OAuth2::AccessToken.new(oauth_client, access_token['access_token'], expires_in: access_token['expires_in'])
|
70
60
|
end
|
71
61
|
|
72
|
-
def
|
62
|
+
def oauth_client
|
73
63
|
OAuth2::Client.new('', '', authorize_url: 'https://accounts.google.com/o/oauth2/auth',
|
74
64
|
token_url: 'https://accounts.google.com/o/oauth2/token')
|
75
65
|
end
|
76
66
|
|
77
|
-
def
|
67
|
+
def signing_key
|
78
68
|
@signing_key ||= OpenSSL::PKCS12.new(File.read(Spotlight::Engine.config.ga_pkcs12_key_path), 'notasecret').key
|
79
69
|
end
|
80
70
|
|
81
|
-
def
|
71
|
+
def auth_client(scope)
|
82
72
|
Signet::OAuth2::Client.new token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
|
83
73
|
audience: 'https://accounts.google.com/o/oauth2/token',
|
84
74
|
scope: scope,
|