blacklight-spotlight 3.5.0.3 → 3.6.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/Rakefile +6 -7
- data/app/assets/config/spotlight/manifest.js +1 -0
- data/app/assets/javascripts/spotlight/application.js +14 -14
- data/app/assets/javascripts/spotlight/spotlight.esm.js +7148 -0
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -0
- data/app/assets/javascripts/spotlight/spotlight.js +7148 -15
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -0
- data/app/assets/stylesheets/spotlight/_catalog.scss +16 -0
- data/app/controllers/concerns/spotlight/base.rb +2 -1
- data/app/controllers/concerns/spotlight/controller.rb +10 -0
- data/app/controllers/spotlight/admin_users_controller.rb +4 -4
- data/app/controllers/spotlight/appearances_controller.rb +6 -6
- data/app/controllers/spotlight/browse_controller.rb +1 -1
- data/app/controllers/spotlight/catalog_controller.rb +20 -15
- data/app/controllers/spotlight/concerns/application_controller.rb +1 -0
- data/app/controllers/spotlight/concerns/catalog_search_context.rb +2 -2
- data/app/controllers/spotlight/contacts_controller.rb +6 -6
- data/app/controllers/spotlight/dashboards_controller.rb +2 -2
- data/app/controllers/spotlight/exhibits_controller.rb +19 -19
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/home_pages_controller.rb +7 -7
- data/app/controllers/spotlight/lock_controller.rb +1 -1
- data/app/controllers/spotlight/metadata_configurations_controller.rb +2 -2
- data/app/controllers/spotlight/pages_controller.rb +4 -3
- data/app/controllers/spotlight/search_configurations_controller.rb +6 -6
- data/app/controllers/spotlight/searches_controller.rb +22 -22
- data/app/controllers/spotlight/solr_controller.rb +1 -1
- data/app/controllers/spotlight/translations_controller.rb +8 -10
- data/app/controllers/spotlight/versions_controller.rb +2 -1
- data/app/helpers/spotlight/application_helper.rb +33 -17
- data/app/helpers/spotlight/crud_link_helpers.rb +12 -2
- data/app/helpers/spotlight/pages_helper.rb +1 -1
- data/app/helpers/spotlight/roles_helper.rb +2 -2
- data/app/helpers/spotlight/title_helper.rb +1 -1
- data/app/helpers/spotlight/translations_helper.rb +1 -3
- data/app/javascript/spotlight/admin/add_another.es6 +24 -0
- data/app/javascript/spotlight/admin/add_image_selector.es6 +38 -0
- data/app/javascript/spotlight/admin/add_new_button.es6 +77 -0
- data/app/javascript/spotlight/admin/appearance.es6 +22 -0
- data/app/javascript/spotlight/admin/blacklight_configuration.es6 +65 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/autocompleteable.js +8 -8
- data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/formable.js +1 -1
- data/app/javascript/spotlight/admin/block_mixins/plustextable.js +58 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/block.js +2 -1
- data/app/javascript/spotlight/admin/blocks/browse_block.js +86 -0
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/iframe_block.js +7 -11
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/link_to_search_block.js +0 -2
- data/app/javascript/spotlight/admin/blocks/oembed_block.js +41 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/pages_block.js +1 -1
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/resources_block.js +45 -42
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/rule_block.js +2 -4
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/search_result_block.js +7 -9
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_base_block.js +22 -22
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_block.js +7 -7
- data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_carousel_block.js +14 -15
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +147 -0
- data/app/javascript/spotlight/admin/checkbox_submit.es6 +75 -0
- data/app/javascript/spotlight/admin/copy_email_addresses.es6 +5 -0
- data/app/{assets/javascripts/spotlight/admin/crop.es6 → javascript/spotlight/admin/crop.js} +5 -4
- data/app/javascript/spotlight/admin/croppable.es6 +10 -0
- data/app/{assets/javascripts/spotlight/admin/edit_in_place.js → javascript/spotlight/admin/edit_in_place.es6} +6 -13
- data/app/javascript/spotlight/admin/exhibit_tag_autocomplete.es6 +39 -0
- data/app/javascript/spotlight/admin/exhibits.es6 +59 -0
- data/app/{assets/javascripts/spotlight/admin/form_observer.js → javascript/spotlight/admin/form_observer.es6} +23 -21
- data/app/javascript/spotlight/admin/index.js +85 -0
- data/app/javascript/spotlight/admin/locks.es6 +12 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/multi_image_selector.js +2 -1
- data/app/javascript/spotlight/admin/pages.es6 +42 -0
- data/app/{assets/javascripts/spotlight/admin/progress_monitor.js → javascript/spotlight/admin/progress_monitor.es6} +5 -9
- data/app/javascript/spotlight/admin/readonly_checkbox.es6 +8 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/search_typeahead.js +3 -46
- data/app/{assets/javascripts/spotlight/admin/select_related_input.js → javascript/spotlight/admin/select_related_input.es6} +6 -3
- data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_controls.js +6 -4
- data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_limits.js +2 -0
- data/app/{assets/javascripts → javascript}/spotlight/admin/spotlight_nestable.js +4 -8
- data/app/javascript/spotlight/admin/tabs.es6 +8 -0
- data/app/{assets/javascripts/spotlight/admin/translation_progress.js → javascript/spotlight/admin/translation_progress.es6} +6 -13
- data/app/{assets/javascripts/spotlight/admin/users.js → javascript/spotlight/admin/users.es6} +7 -17
- data/app/javascript/spotlight/admin/visibility_toggle.es6 +23 -0
- data/app/javascript/spotlight/index.js +10 -0
- data/app/javascript/spotlight/spotlight.js +32 -0
- data/app/{assets/javascripts/spotlight/user/analytics.js → javascript/spotlight/user/analytics.es6} +4 -4
- data/app/{assets/javascripts/spotlight/user/browse_group_categories.js → javascript/spotlight/user/browse_group_categories.es6} +4 -13
- data/app/javascript/spotlight/user/carousel.es6 +5 -0
- data/app/{assets/javascripts/spotlight/user/clear_form_button.js → javascript/spotlight/user/clear_form_button.es6} +5 -9
- data/app/javascript/spotlight/user/index.js +17 -0
- data/app/{assets/javascripts/spotlight/user/report_a_problem.js → javascript/spotlight/user/report_a_problem.es6} +6 -15
- data/app/javascript/spotlight/user/zpr_links.es6 +44 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -2
- data/app/models/concerns/spotlight/browse_category_search_builder.rb +1 -10
- data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
- data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
- data/app/models/concerns/spotlight/resources/web.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/finder.rb +2 -2
- data/app/models/concerns/spotlight/solr_document.rb +2 -2
- data/app/models/concerns/spotlight/translatables.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/displayable.rb +2 -2
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +17 -6
- data/app/models/spotlight/analytics/ga.rb +5 -5
- data/app/models/spotlight/blacklight_configuration.rb +12 -12
- data/app/models/spotlight/bulk_update.rb +1 -0
- data/app/models/spotlight/contact_email.rb +1 -1
- data/app/models/spotlight/contact_form.rb +1 -1
- data/app/models/spotlight/exhibit.rb +1 -1
- data/app/models/spotlight/featured_image.rb +1 -2
- data/app/models/spotlight/lock.rb +1 -1
- data/app/models/spotlight/main_navigation.rb +1 -5
- data/app/models/spotlight/page.rb +1 -1
- data/app/models/spotlight/resources/iiif_manifest.rb +4 -4
- data/app/models/spotlight/resources/iiif_service.rb +1 -1
- data/app/models/spotlight/resources/upload.rb +3 -6
- data/app/models/spotlight/search.rb +2 -2
- data/app/models/translation.rb +2 -0
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -1
- data/app/services/spotlight/iiif_resource_resolver.rb +10 -10
- data/app/uploaders/spotlight/bulk_updates_uploader.rb +1 -0
- data/app/views/layouts/spotlight/base.html.erb +1 -0
- data/app/views/shared/_exhibit_navbar.html.erb +6 -1
- data/app/views/spotlight/admin_users/index.html.erb +9 -3
- data/app/views/spotlight/browse/show.html.erb +2 -2
- data/app/views/spotlight/catalog/_admin_header.html.erb +3 -1
- data/app/views/spotlight/catalog/_document_visibility_control.html.erb +21 -2
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
- data/app/views/spotlight/exhibits/_confirmation_status.html.erb +3 -1
- data/app/views/spotlight/exhibits/_contact.html.erb +5 -1
- data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +2 -0
- data/app/views/spotlight/shared/_report_a_problem.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
- data/app/views/spotlight/translations/_page.html.erb +6 -1
- data/config/locales/spotlight.en.yml +4 -9
- data/lib/generators/spotlight/install_generator.rb +15 -23
- data/lib/generators/spotlight/scaffold_resource_generator.rb +12 -12
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -0
- data/lib/generators/spotlight/templates/solr/conf/_rest_managed.json +3 -0
- data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -0
- data/lib/generators/spotlight/templates/solr/conf/elevate.xml +36 -0
- data/lib/generators/spotlight/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/lib/generators/spotlight/templates/solr/conf/protwords.txt +21 -0
- data/lib/generators/spotlight/templates/solr/{config → conf}/schema.xml +17 -0
- data/lib/generators/spotlight/templates/solr/conf/scripts.conf +24 -0
- data/lib/generators/spotlight/templates/solr/{config → conf}/solrconfig.xml +55 -24
- data/lib/generators/spotlight/templates/solr/conf/spellings.txt +2 -0
- data/lib/generators/spotlight/templates/solr/conf/stopwords.txt +58 -0
- data/lib/generators/spotlight/templates/solr/conf/stopwords_en.txt +58 -0
- data/lib/generators/spotlight/templates/solr/conf/synonyms.txt +31 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/example.xsl +132 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/example_atom.xsl +67 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/example_rss.xsl +66 -0
- data/lib/generators/spotlight/templates/solr/conf/xslt/luke.xsl +337 -0
- data/lib/generators/spotlight/templates/spotlight.js +1 -1
- data/lib/migration/iiif.rb +3 -7
- data/lib/spotlight/engine.rb +18 -16
- data/lib/spotlight/riiif_service.rb +31 -0
- data/lib/spotlight/search_state.rb +19 -0
- data/lib/spotlight/upload_field_config.rb +1 -1
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +1 -1
- data/spec/factories/searches.rb +0 -12
- data/spec/fixtures/iiif_responses.rb +64 -64
- data/vendor/assets/javascripts/nestable.js +1 -1
- data/vendor/assets/javascripts/parameterize.js +2 -2
- data/vendor/assets/javascripts/sir-trevor.js +22460 -20591
- data/vendor/assets/stylesheets/sir-trevor/_icons.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/_variables.scss +16 -18
- data/vendor/assets/stylesheets/sir-trevor/base.scss +11 -0
- data/vendor/assets/stylesheets/sir-trevor/block-addition-top.scss +4 -1
- data/vendor/assets/stylesheets/sir-trevor/block-addition.scss +3 -2
- data/vendor/assets/stylesheets/sir-trevor/block-controls.scss +4 -0
- data/vendor/assets/stylesheets/sir-trevor/block-positioner.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/block-replacer.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/block-ui.scss +10 -0
- data/vendor/assets/stylesheets/sir-trevor/block.scss +19 -5
- data/vendor/assets/stylesheets/sir-trevor/errors.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/format-bar.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/inputs.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/main.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/patterns/ui-popup.scss +0 -0
- data/vendor/assets/stylesheets/sir-trevor/utils.scss +0 -0
- metadata +118 -117
- data/app/assets/javascripts/spotlight/admin/add_another.js +0 -22
- data/app/assets/javascripts/spotlight/admin/add_new_button.js +0 -81
- data/app/assets/javascripts/spotlight/admin/appearance.js +0 -24
- data/app/assets/javascripts/spotlight/admin/attachments.js +0 -2
- data/app/assets/javascripts/spotlight/admin/blacklight_configuration.js +0 -63
- data/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +0 -57
- data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +0 -87
- data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +0 -88
- data/app/assets/javascripts/spotlight/admin/blocks/oembed_block.js +0 -40
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +0 -145
- data/app/assets/javascripts/spotlight/admin/catalog_edit.js +0 -16
- data/app/assets/javascripts/spotlight/admin/copy_email_addresses.js +0 -9
- data/app/assets/javascripts/spotlight/admin/croppable.js +0 -25
- data/app/assets/javascripts/spotlight/admin/exhibit_tag_autocomplete.js +0 -37
- data/app/assets/javascripts/spotlight/admin/exhibits.js +0 -58
- data/app/assets/javascripts/spotlight/admin/index.js +0 -16
- data/app/assets/javascripts/spotlight/admin/locks.js +0 -12
- data/app/assets/javascripts/spotlight/admin/pages.js.erb +0 -40
- data/app/assets/javascripts/spotlight/admin/readonly_checkbox.js +0 -6
- data/app/assets/javascripts/spotlight/admin/tabs.js +0 -6
- data/app/assets/javascripts/spotlight/user/carousel.js +0 -3
- data/app/assets/javascripts/spotlight/user/index.js +0 -8
- data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +0 -45
- data/vendor/assets/javascripts/MutationObserver.js +0 -625
- data/vendor/assets/javascripts/eventable.js +0 -205
- data/vendor/assets/javascripts/polyfill.min.js +0 -4
- /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_embed_block.js +0 -0
- /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_features_block.js +0 -0
- /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_grid_block.js +0 -0
- /data/app/{assets/javascripts/spotlight/admin/iiif.es6 → javascript/spotlight/admin/iiif.js} +0 -0
- /data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/locales.js +0 -0
@@ -1,23 +1,16 @@
|
|
1
|
-
Spotlight.onLoad(function() {
|
2
|
-
$('[data-behavior="translation-progress"]').translationProgress();
|
3
|
-
});
|
4
|
-
|
5
1
|
// translationProgress is a plugin that updates the "3/14" progress
|
6
2
|
// counters in the tabs of the translation adminstration dashboard.
|
7
3
|
// This works by counting the number of progress items and translations
|
8
4
|
// present (indicated by data attributes) in each tab's content
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
$(translationTabs).each(function(){
|
5
|
+
export default class {
|
6
|
+
connect() {
|
7
|
+
$('[data-behavior="translation-progress"]').each(function(){
|
13
8
|
var currentTab = $(this);
|
14
9
|
var tabName = $(this).attr('aria-controls');
|
15
10
|
var translationFields = $('#' + tabName).find('[data-translation-progress-item="true"]');
|
16
11
|
var completedTranslations = $('#' + tabName).find('[data-translation-present="true"]');
|
17
12
|
|
18
13
|
currentTab.find('span').text(completedTranslations.length + '/' + translationFields.length);
|
19
|
-
})
|
20
|
-
|
21
|
-
|
22
|
-
};
|
23
|
-
})(jQuery);
|
14
|
+
})
|
15
|
+
}
|
16
|
+
}
|
data/app/{assets/javascripts/spotlight/admin/users.js → javascript/spotlight/admin/users.es6}
RENAMED
@@ -1,11 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$.fn.spotlight_users = function( options ) {
|
4
|
-
|
5
|
-
// Create some defaults, extending them with any options that were provided
|
6
|
-
var settings = $.extend( { }, options);
|
1
|
+
export default class {
|
2
|
+
connect() {
|
7
3
|
var container;
|
8
|
-
|
9
4
|
function edit_user(event) {
|
10
5
|
event.preventDefault();
|
11
6
|
$(this).closest('tr').hide();
|
@@ -54,13 +49,13 @@
|
|
54
49
|
}
|
55
50
|
|
56
51
|
function open_errors() {
|
57
|
-
edit_row = container.find('.has-error').closest('[data-edit-for]');
|
52
|
+
const edit_row = container.find('.has-error').closest('[data-edit-for]');
|
58
53
|
edit_row.show();
|
59
54
|
// The following row has the controls, so show it too.
|
60
55
|
edit_row.next().show();
|
61
56
|
}
|
62
57
|
|
63
|
-
|
58
|
+
$('.edit_exhibit, .admin-users').each(function() {
|
64
59
|
|
65
60
|
container = $(this);
|
66
61
|
$('[data-edit-for]', container).hide();
|
@@ -69,11 +64,6 @@
|
|
69
64
|
$("[data-behavior='cancel-edit']", container).on('click', cancel_edit);
|
70
65
|
$("[data-behavior='destroy-user']", container).on('click', destroy_user);
|
71
66
|
$("[data-behavior='new-user']", container).on('click', new_user);
|
72
|
-
})
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
Spotlight.onLoad(function() {
|
78
|
-
$('.edit_exhibit, .admin-users').spotlight_users();
|
79
|
-
});
|
67
|
+
})
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// Visibility toggle for items in an exhibit, based on Blacklight's bookmark toggle
|
2
|
+
// See: https://github.com/projectblacklight/blacklight/blob/main/app/javascript/blacklight/bookmark_toggle.js
|
3
|
+
|
4
|
+
import CheckboxSubmit from 'checkbox_submit'
|
5
|
+
|
6
|
+
const VisibilityToggle = (e) => {
|
7
|
+
if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
|
8
|
+
const form = e.target.closest('form')
|
9
|
+
if (form) {
|
10
|
+
new CheckboxSubmit(form).clicked(e)
|
11
|
+
|
12
|
+
// Add/remove the "private" label to the document row when visibility is toggled
|
13
|
+
const docRow = form.closest('tr')
|
14
|
+
if (docRow) docRow.classList.toggle('blacklight-private')
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
VisibilityToggle.selector = 'form.visibility-toggle'
|
20
|
+
|
21
|
+
document.addEventListener('click', VisibilityToggle)
|
22
|
+
|
23
|
+
export default VisibilityToggle
|
@@ -0,0 +1,32 @@
|
|
1
|
+
const Spotlight = function() {
|
2
|
+
var buffer = [];
|
3
|
+
return {
|
4
|
+
onLoad: function(func) {
|
5
|
+
buffer.push(func);
|
6
|
+
},
|
7
|
+
|
8
|
+
activate: function() {
|
9
|
+
for(var i = 0; i < buffer.length; i++) {
|
10
|
+
buffer[i].call();
|
11
|
+
}
|
12
|
+
},
|
13
|
+
csrfToken: function () {
|
14
|
+
return document.querySelector('meta[name=csrf-token]')?.content
|
15
|
+
},
|
16
|
+
ZprLinks: {
|
17
|
+
close: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"/></svg>",
|
18
|
+
zoomIn: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm.5-7H9v2H7v1h2v2h1v-2h2V9h-2z\"/></svg>\n",
|
19
|
+
zoomOut: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7V9z\"/></svg>\n"
|
20
|
+
}
|
21
|
+
};
|
22
|
+
}();
|
23
|
+
|
24
|
+
// This allows us to configure Spotlight in app/views/layouts/base.html.erb
|
25
|
+
window.Spotlight = Spotlight
|
26
|
+
|
27
|
+
export default Spotlight
|
28
|
+
|
29
|
+
Blacklight.onLoad(function() {
|
30
|
+
Spotlight.activate();
|
31
|
+
});
|
32
|
+
|
data/app/{assets/javascripts/spotlight/user/analytics.js → javascript/spotlight/user/analytics.es6}
RENAMED
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
export default class {
|
2
|
+
connect() {
|
3
3
|
if (window._gaq != null) {
|
4
4
|
return _gaq.push(['_trackPageview']);
|
5
5
|
} else if (window.pageTracker != null) {
|
6
6
|
return pageTracker._trackPageview();
|
7
7
|
}
|
8
|
-
}
|
9
|
-
}
|
8
|
+
}
|
9
|
+
}
|
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
$.fn.browseGroupCategories = function( options ) {
|
4
|
-
// Create some defaults, extending them with any options that were provided
|
5
|
-
var settings = $.extend( { }, options);
|
1
|
+
export default class {
|
2
|
+
connect() {
|
6
3
|
var $container, slider;
|
7
4
|
|
8
5
|
function init() {
|
@@ -44,16 +41,10 @@
|
|
44
41
|
return sidebar ? 3 : 4;
|
45
42
|
}
|
46
43
|
|
47
|
-
return
|
44
|
+
return $('[data-browse-group-categories-carousel]').each(function() {
|
48
45
|
$container = $(this);
|
49
46
|
init();
|
50
47
|
setupDestroy();
|
51
48
|
});
|
52
49
|
}
|
53
|
-
}
|
54
|
-
|
55
|
-
Spotlight.onLoad(function() {
|
56
|
-
$('[data-browse-group-categories-carousel]').each(function(i, el) {
|
57
|
-
$(el).browseGroupCategories();
|
58
|
-
});
|
59
|
-
});
|
50
|
+
}
|
@@ -1,10 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
(function($) {
|
6
|
-
$.fn.ClearFormButton = function() {
|
7
|
-
var $clearBtn = $(this);
|
1
|
+
export default class {
|
2
|
+
connect() {
|
3
|
+
var $clearBtn = $('.btn-reset');
|
8
4
|
var $input = $clearBtn.parent().prev('input');
|
9
5
|
var btnCheck = function(){
|
10
6
|
if ($input.val() !== '') {
|
@@ -23,5 +19,5 @@ Spotlight.onLoad(function() {
|
|
23
19
|
event.preventDefault();
|
24
20
|
$input.val('');
|
25
21
|
});
|
26
|
-
}
|
27
|
-
}
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import Analytics from 'analytics'
|
2
|
+
import BrowseGroupCateogries from 'browse_group_categories'
|
3
|
+
import Carousel from 'carousel'
|
4
|
+
import ClearFormButton from 'clear_form_button'
|
5
|
+
import ReportProblem from 'report_a_problem'
|
6
|
+
import ZprLinks from 'zpr_links'
|
7
|
+
|
8
|
+
export default class {
|
9
|
+
connect() {
|
10
|
+
new Analytics().connect()
|
11
|
+
new BrowseGroupCateogries().connect()
|
12
|
+
new Carousel().connect()
|
13
|
+
new ClearFormButton().connect()
|
14
|
+
new ReportProblem().connect()
|
15
|
+
new ZprLinks().connect()
|
16
|
+
}
|
17
|
+
}
|
@@ -1,12 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
// Create some defaults, extending them with any options that were provided
|
5
|
-
var settings = $.extend( { }, options);
|
6
|
-
var container, target, cancel;
|
1
|
+
export default class {
|
2
|
+
connect(){
|
3
|
+
var container, target;
|
7
4
|
|
8
5
|
function init() {
|
9
|
-
target_val = container.attr('data-target')
|
6
|
+
const target_val = container.attr('data-target')
|
10
7
|
if (!target_val)
|
11
8
|
return
|
12
9
|
|
@@ -25,15 +22,9 @@
|
|
25
22
|
target.slideUp('fast');
|
26
23
|
}
|
27
24
|
|
28
|
-
return
|
25
|
+
return $('[data-behavior="contact-link"]').each(function() {
|
29
26
|
container = $(this);
|
30
27
|
init();
|
31
28
|
});
|
32
29
|
}
|
33
|
-
}
|
34
|
-
|
35
|
-
Spotlight.onLoad(function() {
|
36
|
-
$('[data-behavior="contact-link"]').reportProblem();
|
37
|
-
});
|
38
|
-
|
39
|
-
|
30
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
export default class {
|
2
|
+
connect() {
|
3
|
+
$('.zpr-link').on('click', function() {
|
4
|
+
var modalDialog = $('#blacklight-modal .modal-dialog');
|
5
|
+
var modalContent = modalDialog.find('.modal-content')
|
6
|
+
modalDialog.removeClass('modal-lg')
|
7
|
+
modalDialog.addClass('modal-xl')
|
8
|
+
modalContent.html('<div id="osd-modal-container"></div>');
|
9
|
+
var controls = `<div class="controls d-flex justify-content-center justify-content-md-end">
|
10
|
+
<div class="custom-close-controls pr-3 pt-3">
|
11
|
+
<button type="button" class="btn btn-dark" data-dismiss="modal" aria-hidden="true">${Spotlight.ZprLinks.close}</button>
|
12
|
+
</div>
|
13
|
+
<div class="zoom-controls mb-3 mr-md-3">
|
14
|
+
<button id="osd-zoom-in" type="button" class="btn btn-dark">${Spotlight.ZprLinks.zoomIn}</button>
|
15
|
+
<button id="osd-zoom-out" type="button" class="btn btn-dark">${Spotlight.ZprLinks.zoomOut}</button>
|
16
|
+
</div>
|
17
|
+
<div id="empty-div-required-by-osd"></div>
|
18
|
+
</div>`
|
19
|
+
|
20
|
+
$('#osd-modal-container').append('<div id="osd-div"></div>');
|
21
|
+
$('#osd-modal-container').append(controls);
|
22
|
+
|
23
|
+
$('#blacklight-modal').modal('show');
|
24
|
+
|
25
|
+
$('#blacklight-modal').one('hidden.bs.modal', function (event) {
|
26
|
+
modalDialog.removeClass('modal-xl')
|
27
|
+
modalDialog.addClass('modal-lg')
|
28
|
+
});
|
29
|
+
|
30
|
+
OpenSeadragon({
|
31
|
+
id: 'osd-div',
|
32
|
+
zoomInButton: "osd-zoom-in",
|
33
|
+
zoomOutButton: "osd-zoom-out",
|
34
|
+
// This is a hack where OpenSeadragon (if using mapped buttons) requires you
|
35
|
+
// to map all of the buttons.
|
36
|
+
homeButton: "empty-div-required-by-osd",
|
37
|
+
fullPageButton: "empty-div-required-by-osd",
|
38
|
+
nextButton: "empty-div-required-by-osd",
|
39
|
+
previousButton: "empty-div-required-by-osd",
|
40
|
+
tileSources: [$(this).data('iiif-tilesource')]
|
41
|
+
})
|
42
|
+
});
|
43
|
+
}
|
44
|
+
}
|
@@ -31,21 +31,12 @@ module Spotlight
|
|
31
31
|
|
32
32
|
solr_params.append_query(query) if query.present?
|
33
33
|
|
34
|
-
# for a browse category formed from a saved search, the query syntax reads as two "must" values
|
35
|
-
# e.g. "json"=>{"query"=>{"bool"=>{"must"=>["savedsearchterm", "browsecategorysearchterm"]}}}}
|
36
|
-
must_values = solr_params.dig(:json, :query, :bool, :must)
|
37
|
-
|
38
|
-
return unless must_values&.any?
|
39
|
-
|
40
|
-
# this type of query must be parsed by lucene to function
|
41
|
-
solr_params[:defType] = 'lucene'
|
42
|
-
|
43
34
|
# This replicates existing spotlight 2.x search behavior, more or less. It
|
44
35
|
# doesn't take into account the possibility that the browse category query
|
45
36
|
# could use a different search field (which.. doesn't have an existing UI
|
46
37
|
# control.. and may require additional upstream work to properly encapsulate
|
47
38
|
# the two query parameters)
|
48
|
-
|
39
|
+
solr_params.dig(:json, :query, :bool, :must)&.map! do |q|
|
49
40
|
q.is_a?(String) ? { edismax: { query: q } } : q
|
50
41
|
end
|
51
42
|
end
|
@@ -8,7 +8,7 @@ module Spotlight
|
|
8
8
|
# filtered by the exhibit-specific solr field.
|
9
9
|
#
|
10
10
|
# @return [Enumerable<SolrDocument>]
|
11
|
-
def solr_documents
|
11
|
+
def solr_documents(&block)
|
12
12
|
return to_enum(:solr_documents) unless block_given?
|
13
13
|
|
14
14
|
start = 0
|
@@ -17,7 +17,7 @@ module Spotlight
|
|
17
17
|
response = repository.search(search_params.start(start).to_h)
|
18
18
|
|
19
19
|
while response.documents.present?
|
20
|
-
response.documents.each
|
20
|
+
response.documents.each(&block)
|
21
21
|
start += response.documents.length
|
22
22
|
response = repository.search(search_params.start(start).to_h)
|
23
23
|
end
|
@@ -19,7 +19,7 @@ module Spotlight
|
|
19
19
|
@index ||= blacklight_config.repository_class.new(blacklight_config)
|
20
20
|
end
|
21
21
|
|
22
|
-
def find_each
|
22
|
+
def find_each(&block)
|
23
23
|
return to_enum(:find_each) unless block_given?
|
24
24
|
|
25
25
|
start = 0
|
@@ -27,7 +27,7 @@ module Spotlight
|
|
27
27
|
response = index.search(search_params.merge(start: start))
|
28
28
|
|
29
29
|
while response.documents.present?
|
30
|
-
response.documents.each
|
30
|
+
response.documents.each(&block)
|
31
31
|
start += response.documents.length
|
32
32
|
response = index.search(search_params.merge(start: start))
|
33
33
|
end
|
@@ -25,7 +25,7 @@ module Spotlight
|
|
25
25
|
def reindex(id)
|
26
26
|
find(id).reindex
|
27
27
|
rescue Blacklight::Exceptions::RecordNotFound => e
|
28
|
-
Rails.logger.debug "Unable to find document #{id}: #{e}"
|
28
|
+
Rails.logger.debug { "Unable to find document #{id}: #{e}" }
|
29
29
|
end
|
30
30
|
|
31
31
|
def reindex_all
|
@@ -62,7 +62,7 @@ module Spotlight
|
|
62
62
|
|
63
63
|
sidecar(current_exhibit).update(custom_data) if custom_data
|
64
64
|
|
65
|
-
#
|
65
|
+
# NOTE: this causes a save
|
66
66
|
current_exhibit.tag(sidecar(current_exhibit), with: tags, on: :tags) if tags
|
67
67
|
|
68
68
|
update_exhibit_resource(resource_attributes) if uploaded_resource?
|
@@ -32,7 +32,7 @@ module Spotlight
|
|
32
32
|
define_method(:"translated_#{attr_name}") do |default: [], **options|
|
33
33
|
default = Array.wrap(default)
|
34
34
|
default.prepend(attr_translation(attr_name)) if I18n.locale == I18n.default_locale
|
35
|
-
I18n.
|
35
|
+
I18n.t(attr_name, scope: slug, default: default, **options).presence
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -10,11 +10,11 @@ module SirTrevorRails
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def item_ids
|
13
|
-
items.
|
13
|
+
items.pluck(:id)
|
14
14
|
end
|
15
15
|
|
16
16
|
def ordered_items
|
17
|
-
items.sort_by { |x| x[:weight].to_i }.
|
17
|
+
items.sort_by { |x| x[:weight].to_i }.pluck(:id)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
@@ -25,9 +25,14 @@ module SirTrevorRails
|
|
25
25
|
|
26
26
|
def documents
|
27
27
|
@documents ||= begin
|
28
|
-
doc_ids = items.
|
29
|
-
|
30
|
-
|
28
|
+
doc_ids = items.pluck(:id)
|
29
|
+
result = solr_helper.controller.send(:search_service).fetch(doc_ids)
|
30
|
+
|
31
|
+
if result.first.is_a? Blacklight::Solr::Response
|
32
|
+
result.last
|
33
|
+
else
|
34
|
+
result
|
35
|
+
end
|
31
36
|
end
|
32
37
|
end
|
33
38
|
|
@@ -49,7 +54,7 @@ module SirTrevorRails
|
|
49
54
|
return unless caption_field
|
50
55
|
return presenter.heading if caption_field == Spotlight::PageConfigurations::DOCUMENT_TITLE_KEY
|
51
56
|
|
52
|
-
presenter.field_value(solr_helper.blacklight_config.index_fields[caption_field] ||
|
57
|
+
presenter.field_value(solr_helper.blacklight_config.index_fields[caption_field] || null_display_field_class.new(caption_field))
|
53
58
|
end
|
54
59
|
|
55
60
|
def secondary_caption?
|
@@ -66,12 +71,18 @@ module SirTrevorRails
|
|
66
71
|
|
67
72
|
def primary_caption_field
|
68
73
|
val = send(:'primary-caption-field')
|
69
|
-
val
|
74
|
+
val.presence
|
70
75
|
end
|
71
76
|
|
72
77
|
def secondary_caption_field
|
73
78
|
val = send(:'secondary-caption-field')
|
74
|
-
val
|
79
|
+
val.presence
|
80
|
+
end
|
81
|
+
|
82
|
+
def null_display_field_class
|
83
|
+
return Blacklight::Configuration::NullDisplayField if defined?(Blacklight::Configuration::NullDisplayField)
|
84
|
+
|
85
|
+
Blacklight::Configuration::NullField
|
75
86
|
end
|
76
87
|
end
|
77
88
|
end
|
@@ -31,11 +31,11 @@ module Spotlight
|
|
31
31
|
|
32
32
|
def user(scope = 'https://www.googleapis.com/auth/analytics.readonly')
|
33
33
|
@user ||= begin
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
Legato::User.new(oauth_token(scope))
|
35
|
+
rescue StandardError => e
|
36
|
+
Rails.logger.info(e)
|
37
|
+
nil
|
38
|
+
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def site
|
@@ -27,7 +27,7 @@ module Spotlight
|
|
27
27
|
# get rid of empty values
|
28
28
|
before_validation do |model|
|
29
29
|
model.index_fields&.each do |_k, v|
|
30
|
-
v[:enabled] ||= v.any? { |_k1, v1|
|
30
|
+
v[:enabled] ||= v.any? { |_k1, v1| v1.present? }
|
31
31
|
|
32
32
|
default_blacklight_config.view.keys.each do |view|
|
33
33
|
v[view] &&= value_to_boolean(v[view])
|
@@ -82,8 +82,8 @@ module Spotlight
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
config.show.merge! show
|
86
|
-
config.index.merge! index
|
85
|
+
config.show.merge! show if show.present?
|
86
|
+
config.index.merge! index if index.present?
|
87
87
|
config.index.respond_to[:iiif_json] = true
|
88
88
|
|
89
89
|
config.index.thumbnail_field ||= Spotlight::Engine.config.thumbnail_field
|
@@ -165,7 +165,7 @@ module Spotlight
|
|
165
165
|
config.show_fields = config.index_fields
|
166
166
|
|
167
167
|
config.search_fields.merge! custom_search_fields(config)
|
168
|
-
|
168
|
+
if search_fields.present?
|
169
169
|
config.search_fields = Hash[config.search_fields.sort_by { |k, _v| field_weight(search_fields, k) }]
|
170
170
|
|
171
171
|
config.search_fields.each do |k, v|
|
@@ -179,7 +179,7 @@ module Spotlight
|
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
182
|
-
|
182
|
+
if sort_fields.present?
|
183
183
|
config.sort_fields = Hash[config.sort_fields.sort_by { |k, _v| field_weight(sort_fields, k) }]
|
184
184
|
|
185
185
|
config.sort_fields.each do |k, v|
|
@@ -194,7 +194,7 @@ module Spotlight
|
|
194
194
|
end
|
195
195
|
|
196
196
|
config.facet_fields.merge! custom_facet_fields
|
197
|
-
|
197
|
+
if facet_fields.present?
|
198
198
|
config.facet_fields = Hash[config.facet_fields.sort_by { |k, _v| field_weight(facet_fields, k) }]
|
199
199
|
|
200
200
|
config.facet_fields.each do |k, v|
|
@@ -209,9 +209,9 @@ module Spotlight
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
config.per_page = (config.per_page & per_page)
|
212
|
+
config.per_page = (config.per_page & per_page) if per_page.present?
|
213
213
|
|
214
|
-
|
214
|
+
if document_index_view_types.present?
|
215
215
|
config.view.each do |k, v|
|
216
216
|
v.original = v.dup
|
217
217
|
v.key = k
|
@@ -364,10 +364,10 @@ module Spotlight
|
|
364
364
|
|
365
365
|
# rubocop:disable Naming/AccessorMethodName
|
366
366
|
def set_index_field_defaults(field)
|
367
|
-
return
|
367
|
+
return if index_fields.present?
|
368
368
|
|
369
369
|
views = default_blacklight_config.view.keys | %i[show enabled]
|
370
|
-
field.merge!((views - field.keys).
|
370
|
+
field.merge!((views - field.keys).index_with { |v| !title_only_by_default?(v) })
|
371
371
|
end
|
372
372
|
|
373
373
|
# Check to see whether config.view.foobar.title_only_by_default is available
|
@@ -379,10 +379,10 @@ module Spotlight
|
|
379
379
|
end
|
380
380
|
|
381
381
|
def set_show_field_defaults(field)
|
382
|
-
return
|
382
|
+
return if index_fields.present?
|
383
383
|
|
384
384
|
views = default_blacklight_config.view.keys
|
385
|
-
field.merge!
|
385
|
+
field.merge! views.index_with { |_v| false }
|
386
386
|
field.enabled = true
|
387
387
|
field.show = true
|
388
388
|
end
|
@@ -26,7 +26,7 @@ module Spotlight
|
|
26
26
|
begin
|
27
27
|
parsed = Mail::Address.new(email)
|
28
28
|
rescue Mail::Field::ParseError => e
|
29
|
-
Rails.logger.debug "Failed to parse email #{email}: #{e}"
|
29
|
+
Rails.logger.debug { "Failed to parse email #{email}: #{e}" }
|
30
30
|
end
|
31
31
|
|
32
32
|
errors.add :email, 'is not valid' if parsed.nil? || parsed.address != email || parsed.local == email
|
@@ -8,7 +8,7 @@ module Spotlight
|
|
8
8
|
|
9
9
|
attr_accessor :current_exhibit, :name, :email, Spotlight::Engine.config.spambot_honeypot_email_field, :message, :current_url, :request
|
10
10
|
|
11
|
-
validates :email, format: { with: /\A([\w
|
11
|
+
validates :email, format: { with: /\A([\w.%+\-]+)@([\w\-]+\.)+(\w{2,})\z/i }
|
12
12
|
|
13
13
|
# the spambot_honeypot_email_field field is intended to be hidden visually from the user,
|
14
14
|
# in hope that a spam bot filling out the form will enter a value, whereas a human with a
|
@@ -37,7 +37,7 @@ module Spotlight
|
|
37
37
|
delegate :blacklight_config, to: :blacklight_configuration
|
38
38
|
serialize :facets, Array
|
39
39
|
|
40
|
-
#
|
40
|
+
# NOTE: friendly id associations need to be 'destroy'ed to reap the slug history
|
41
41
|
has_many :about_pages, -> { for_default_locale }, extend: FriendlyId::FinderMethods
|
42
42
|
has_many :attachments, dependent: :destroy
|
43
43
|
has_many :contact_emails, dependent: :delete_all # These are the contacts who get "Contact us" emails
|