blacklight-spotlight 5.3.0 → 5.3.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/README.md +18 -1
- data/app/assets/javascripts/spotlight/spotlight.esm.js +1679 -1228
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +1682 -1231
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/components/spotlight/analytics/aggregation_component.html.erb +1 -1
- data/app/components/spotlight/document_admin_table_component.html.erb +2 -2
- data/app/components/spotlight/edit_view_links_component.html.erb +1 -1
- data/app/components/spotlight/header_component.html.erb +1 -1
- data/app/components/spotlight/tag_list_form_component.html.erb +1 -1
- data/app/components/spotlight/tag_selector_component.html.erb +2 -2
- data/app/components/spotlight/translations/subheading_component.html.erb +1 -1
- data/app/controllers/spotlight/resources_controller.rb +1 -1
- data/app/javascript/spotlight/admin/add_another.js +22 -15
- data/app/javascript/spotlight/admin/add_image_selector.js +27 -25
- data/app/javascript/spotlight/admin/add_new_button.js +47 -43
- data/app/javascript/spotlight/admin/blacklight_configuration.js +52 -38
- data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +68 -60
- data/app/javascript/spotlight/admin/block_mixins/formable.js +55 -47
- data/app/javascript/spotlight/admin/block_mixins/plustextable.js +19 -20
- data/app/javascript/spotlight/admin/blocks/block.js +20 -16
- data/app/javascript/spotlight/admin/blocks/browse_block.js +42 -37
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +33 -31
- data/app/javascript/spotlight/admin/blocks/iframe_block.js +14 -11
- data/app/javascript/spotlight/admin/blocks/link_to_search_block.js +4 -7
- data/app/javascript/spotlight/admin/blocks/oembed_block.js +13 -10
- data/app/javascript/spotlight/admin/blocks/pages_block.js +20 -13
- data/app/javascript/spotlight/admin/blocks/resources_block.js +150 -117
- data/app/javascript/spotlight/admin/blocks/rule_block.js +11 -10
- data/app/javascript/spotlight/admin/blocks/search_result_block.js +16 -17
- data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +123 -64
- data/app/javascript/spotlight/admin/blocks/solr_documents_block.js +8 -8
- data/app/javascript/spotlight/admin/blocks/solr_documents_carousel_block.js +63 -43
- data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +9 -9
- data/app/javascript/spotlight/admin/blocks/solr_documents_features_block.js +17 -16
- data/app/javascript/spotlight/admin/blocks/solr_documents_grid_block.js +6 -7
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +84 -64
- data/app/javascript/spotlight/admin/crop.js +203 -156
- data/app/javascript/spotlight/admin/croppable.js +4 -4
- data/app/javascript/spotlight/admin/croppable_modal.js +59 -37
- data/app/javascript/spotlight/admin/edit_in_place.js +50 -47
- data/app/javascript/spotlight/admin/exhibits.js +52 -41
- data/app/javascript/spotlight/admin/form_observer.js +59 -53
- data/app/javascript/spotlight/admin/iiif.js +26 -25
- data/app/javascript/spotlight/admin/index.js +44 -47
- data/app/javascript/spotlight/admin/locks.js +14 -14
- data/app/javascript/spotlight/admin/multi_image_selector.js +127 -111
- data/app/javascript/spotlight/admin/pages.js +21 -21
- data/app/javascript/spotlight/admin/progress_monitor.js +67 -65
- data/app/javascript/spotlight/admin/readonly_checkbox.js +3 -3
- data/app/javascript/spotlight/admin/search_typeahead.js +55 -43
- data/app/javascript/spotlight/admin/select_related_input.js +17 -17
- data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +100 -84
- data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +36 -31
- data/app/javascript/spotlight/admin/sir-trevor/locales.js +52 -39
- data/app/javascript/spotlight/admin/spotlight_nestable.js +112 -90
- data/app/javascript/spotlight/admin/tabs.js +16 -3
- data/app/javascript/spotlight/admin/translation_progress.js +13 -7
- data/app/javascript/spotlight/admin/users.js +41 -41
- data/app/javascript/spotlight/admin/visibility_toggle.js +4 -4
- data/app/javascript/spotlight/controllers/clipboard_controller.js +14 -0
- data/app/javascript/spotlight/controllers/index.js +4 -2
- data/app/javascript/spotlight/controllers/tag_selector_controller.js +116 -79
- data/app/javascript/spotlight/core.js +18 -15
- data/app/javascript/spotlight/index.js +4 -4
- data/app/javascript/spotlight/user/browse_group_categories.js +24 -22
- data/app/javascript/spotlight/user/carousel.js +23 -19
- data/app/javascript/spotlight/user/clear_form_button.js +15 -15
- data/app/javascript/spotlight/user/index.js +4 -4
- data/app/javascript/spotlight/user/zpr_links.js +18 -18
- data/app/models/spotlight/analytics/ga.rb +0 -1
- data/app/models/spotlight/resources/iiif_manifest_v3.rb +2 -2
- data/app/services/spotlight/exhibit_import_export_service.rb +0 -2
- data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
- data/app/views/catalog/_remove_tags.html.erb +1 -1
- data/app/views/layouts/spotlight/base.html.erb +1 -1
- data/app/views/shared/_header_navbar.html.erb +1 -1
- data/app/views/shared/_masthead.html.erb +2 -2
- data/app/views/shared/_site_sidebar.html.erb +1 -1
- data/app/views/shared/_user_util_links.html.erb +2 -2
- data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
- data/app/views/spotlight/accessibility/alt_text.html.erb +1 -1
- data/app/views/spotlight/admin_users/index.html.erb +11 -9
- data/app/views/spotlight/appearances/edit.html.erb +1 -1
- data/app/views/spotlight/browse/_search_box.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_download.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_progress_panel.html.erb +6 -6
- data/app/views/spotlight/bulk_updates/edit.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_document.html.erb +2 -2
- data/app/views/spotlight/catalog/_document_admin_table.html.erb +1 -1
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +6 -6
- data/app/views/spotlight/catalog/select_image.html.erb +1 -1
- data/app/views/spotlight/contact_mailer/report_problem.html.erb +2 -2
- data/app/views/spotlight/exhibits/_contact.html.erb +2 -2
- data/app/views/spotlight/exhibits/_delete.html.erb +2 -2
- data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
- data/app/views/spotlight/exhibits/_export.html.erb +1 -1
- data/app/views/spotlight/exhibits/_form.html.erb +2 -2
- data/app/views/spotlight/exhibits/_languages.html.erb +7 -7
- data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
- data/app/views/spotlight/locks/_lock.html.erb +2 -2
- data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
- data/app/views/spotlight/pages/_order_pages.html.erb +3 -3
- data/app/views/spotlight/pages/preview.html.erb +1 -1
- data/app/views/spotlight/pages/show.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/upload/_form.html.erb +1 -1
- data/app/views/spotlight/roles/index.html.erb +5 -5
- data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
- data/app/views/spotlight/search_configurations/edit.html.erb +1 -1
- data/app/views/spotlight/searches/index.html.erb +2 -2
- data/app/views/spotlight/shared/_configuration_sidebar.html.erb +1 -1
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +1 -1
- data/app/views/spotlight/shared/_dd3_item.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/_sir_trevor_block_array.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_rule_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +1 -1
- data/app/views/spotlight/sites/edit_exhibits.html.erb +3 -3
- data/app/views/spotlight/translations/_browse_categories.html.erb +2 -2
- data/app/views/spotlight/translations/_general.html.erb +21 -21
- data/app/views/spotlight/translations/_groups.html.erb +1 -1
- data/app/views/spotlight/translations/_metadata.html.erb +8 -8
- data/app/views/spotlight/translations/_pages_table.html.erb +2 -2
- data/app/views/spotlight/translations/_search_fields.html.erb +13 -13
- data/app/views/spotlight/translations/edit.html.erb +5 -5
- data/config/importmap.rb +0 -1
- data/lib/generators/spotlight/assets/propshaft_generator.rb +0 -1
- data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -31
- data/lib/spotlight/version.rb +1 -1
- data/spec/factories/contact_images.rb +1 -1
- data/spec/factories/exhibit_thumbnails.rb +1 -1
- data/spec/factories/featured_images.rb +1 -1
- data/spec/support/features/test_features_helpers.rb +10 -1
- metadata +4 -61
- data/app/javascript/spotlight/admin/copy_email_addresses.js +0 -7
- data/vendor/assets/javascripts/jquery.waitforimages.min.js +0 -2
|
@@ -1,56 +1,53 @@
|
|
|
1
|
-
import AddAnother from
|
|
2
|
-
import AddNewButton from
|
|
3
|
-
import BlacklightConfiguration from
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import Users from 'spotlight/admin/users'
|
|
1
|
+
import AddAnother from "spotlight/admin/add_another"
|
|
2
|
+
import AddNewButton from "spotlight/admin/add_new_button"
|
|
3
|
+
import BlacklightConfiguration from "spotlight/admin/blacklight_configuration"
|
|
4
|
+
import Croppable from "spotlight/admin/croppable"
|
|
5
|
+
import EditInPlace from "spotlight/admin/edit_in_place"
|
|
6
|
+
import Exhibits from "spotlight/admin/exhibits"
|
|
7
|
+
import FormObserver from "spotlight/admin/form_observer"
|
|
8
|
+
import Locks from "spotlight/admin/locks"
|
|
9
|
+
import "spotlight/admin/multi_image_selector"
|
|
10
|
+
import Pages from "spotlight/admin/pages"
|
|
11
|
+
import ProgressMonitor from "spotlight/admin/progress_monitor"
|
|
12
|
+
import ReadonlyCheckbox from "spotlight/admin/readonly_checkbox"
|
|
13
|
+
import { addAutocompletetoFeaturedImage } from "spotlight/admin/search_typeahead"
|
|
14
|
+
import SelectRelatedInput from "spotlight/admin/select_related_input"
|
|
15
|
+
import SpotlightNestable from "spotlight/admin/spotlight_nestable"
|
|
16
|
+
import Tabs from "spotlight/admin/tabs"
|
|
17
|
+
import TranslationProgress from "spotlight/admin/translation_progress"
|
|
18
|
+
import "spotlight/admin/visibility_toggle"
|
|
19
|
+
import Users from "spotlight/admin/users"
|
|
21
20
|
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
21
|
+
import "spotlight/admin/block_mixins/autocompleteable"
|
|
22
|
+
import "spotlight/admin/block_mixins/formable"
|
|
23
|
+
import "spotlight/admin/block_mixins/plustextable"
|
|
25
24
|
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
|
|
44
|
-
import 'spotlight/admin/sir-trevor/block_controls'
|
|
45
|
-
import 'spotlight/admin/sir-trevor/block_limits'
|
|
46
|
-
import 'spotlight/admin/sir-trevor/locales'
|
|
25
|
+
import "spotlight/admin/blocks/block"
|
|
26
|
+
import "spotlight/admin/blocks/resources_block" // This is a base class of several other blocks, so must come first
|
|
27
|
+
import "spotlight/admin/blocks/browse_block"
|
|
28
|
+
import "spotlight/admin/blocks/browse_group_categories_block"
|
|
29
|
+
import "spotlight/admin/blocks/iframe_block"
|
|
30
|
+
import "spotlight/admin/blocks/link_to_search_block"
|
|
31
|
+
import "spotlight/admin/blocks/oembed_block"
|
|
32
|
+
import "spotlight/admin/blocks/pages_block"
|
|
33
|
+
import "spotlight/admin/blocks/rule_block"
|
|
34
|
+
import "spotlight/admin/blocks/search_result_block"
|
|
35
|
+
import "spotlight/admin/blocks/solr_documents_base_block"
|
|
36
|
+
import "spotlight/admin/blocks/solr_documents_block"
|
|
37
|
+
import "spotlight/admin/blocks/solr_documents_carousel_block"
|
|
38
|
+
import "spotlight/admin/blocks/solr_documents_embed_block"
|
|
39
|
+
import "spotlight/admin/blocks/solr_documents_features_block"
|
|
40
|
+
import "spotlight/admin/blocks/solr_documents_grid_block"
|
|
41
|
+
import "spotlight/admin/blocks/uploaded_items_block"
|
|
47
42
|
|
|
43
|
+
import "spotlight/admin/sir-trevor/block_controls"
|
|
44
|
+
import "spotlight/admin/sir-trevor/block_limits"
|
|
45
|
+
import "spotlight/admin/sir-trevor/locales"
|
|
48
46
|
|
|
49
47
|
export default class {
|
|
50
48
|
connect() {
|
|
51
49
|
new AddAnother().connect()
|
|
52
50
|
new AddNewButton().connect()
|
|
53
|
-
new CopyEmailAddress().connect()
|
|
54
51
|
new Croppable().connect()
|
|
55
52
|
new EditInPlace().connect()
|
|
56
53
|
new Exhibits().connect()
|
|
@@ -65,6 +62,6 @@ export default class {
|
|
|
65
62
|
new TranslationProgress().connect()
|
|
66
63
|
new Users().connect()
|
|
67
64
|
addAutocompletetoFeaturedImage()
|
|
68
|
-
SpotlightNestable.init()
|
|
65
|
+
SpotlightNestable.init()
|
|
69
66
|
}
|
|
70
|
-
}
|
|
67
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export default class {
|
|
2
2
|
delete_lock(el) {
|
|
3
|
-
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content
|
|
4
|
-
|
|
3
|
+
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content
|
|
4
|
+
|
|
5
5
|
fetch(el.dataset.lock, {
|
|
6
|
-
method:
|
|
6
|
+
method: "DELETE",
|
|
7
7
|
headers: {
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
el.removeAttribute(
|
|
8
|
+
"X-CSRF-Token": csrfToken,
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
el.removeAttribute("data-lock")
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
connect() {
|
|
16
|
-
document.querySelectorAll(
|
|
17
|
-
element.addEventListener(
|
|
18
|
-
this.delete_lock(e.target)
|
|
19
|
-
})
|
|
20
|
-
})
|
|
16
|
+
document.querySelectorAll("[data-lock]").forEach((element) => {
|
|
17
|
+
element.addEventListener("click", (e) => {
|
|
18
|
+
this.delete_lock(e.target)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
}
|
|
@@ -1,159 +1,175 @@
|
|
|
1
1
|
// Module to add multi-image selector to widget panels
|
|
2
2
|
|
|
3
|
-
(function(){
|
|
4
|
-
$.fn.multiImageSelector = function(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
;(function () {
|
|
4
|
+
$.fn.multiImageSelector = function (
|
|
5
|
+
image_versions,
|
|
6
|
+
clickCallback,
|
|
7
|
+
activeImageId,
|
|
8
|
+
) {
|
|
9
|
+
var changeLink = $("<a href='javascript:;'>Change</a>"),
|
|
10
|
+
thumbsListContainer = $(
|
|
11
|
+
"<div class='thumbs-list' style='display:none'></div>",
|
|
12
|
+
),
|
|
13
|
+
thumbList = $("<ul></ul>"),
|
|
14
|
+
panel
|
|
15
|
+
|
|
16
|
+
var imageIds = $.map(image_versions, function (e) {
|
|
17
|
+
return e["imageId"]
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
return init(this)
|
|
13
21
|
|
|
14
22
|
function init(el) {
|
|
15
|
-
panel = el
|
|
23
|
+
panel = el
|
|
16
24
|
|
|
17
|
-
destroyExistingImageSelector()
|
|
18
|
-
if(image_versions && image_versions.length > 1) {
|
|
19
|
-
addChangeLink()
|
|
20
|
-
addThumbsList()
|
|
25
|
+
destroyExistingImageSelector()
|
|
26
|
+
if (image_versions && image_versions.length > 1) {
|
|
27
|
+
addChangeLink()
|
|
28
|
+
addThumbsList()
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
function addChangeLink() {
|
|
24
|
-
$(
|
|
25
|
-
.html(
|
|
32
|
+
$("[data-panel-image-pagination]", panel)
|
|
33
|
+
.html(
|
|
34
|
+
"Image <span data-current-image='true'>" +
|
|
35
|
+
indexOf(activeImageId) +
|
|
36
|
+
"</span> of " +
|
|
37
|
+
image_versions.length,
|
|
38
|
+
)
|
|
26
39
|
.show()
|
|
27
40
|
.append(" ")
|
|
28
|
-
.append(changeLink)
|
|
29
|
-
addChangeLinkBehavior()
|
|
41
|
+
.append(changeLink)
|
|
42
|
+
addChangeLinkBehavior()
|
|
30
43
|
}
|
|
31
44
|
|
|
32
45
|
function destroyExistingImageSelector() {
|
|
33
|
-
var pagination = $(
|
|
34
|
-
pagination.html(
|
|
35
|
-
pagination.next(
|
|
46
|
+
var pagination = $("[data-panel-image-pagination]", panel)
|
|
47
|
+
pagination.html("")
|
|
48
|
+
pagination.next("." + thumbsListContainer.attr("class")).remove()
|
|
36
49
|
}
|
|
37
50
|
|
|
38
|
-
function indexOf(thumb){
|
|
51
|
+
function indexOf(thumb) {
|
|
39
52
|
const index = imageIds.indexOf(thumb)
|
|
40
53
|
if (index > -1) {
|
|
41
|
-
return index + 1
|
|
54
|
+
return index + 1
|
|
42
55
|
} else {
|
|
43
|
-
return 1
|
|
56
|
+
return 1
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
59
|
function addChangeLinkBehavior() {
|
|
47
|
-
changeLink.on(
|
|
48
|
-
thumbsListContainer.slideToggle()
|
|
49
|
-
updateThumbListWidth()
|
|
50
|
-
addScrollBehavior()
|
|
51
|
-
scrollToActiveThumb()
|
|
52
|
-
loadVisibleThumbs()
|
|
53
|
-
swapChangeLinkText($(this))
|
|
54
|
-
})
|
|
60
|
+
changeLink.on("click", function () {
|
|
61
|
+
thumbsListContainer.slideToggle()
|
|
62
|
+
updateThumbListWidth()
|
|
63
|
+
addScrollBehavior()
|
|
64
|
+
scrollToActiveThumb()
|
|
65
|
+
loadVisibleThumbs()
|
|
66
|
+
swapChangeLinkText($(this))
|
|
67
|
+
})
|
|
55
68
|
}
|
|
56
69
|
function updateThumbListWidth() {
|
|
57
|
-
var width = 0
|
|
58
|
-
$(
|
|
59
|
-
width += $(this).outerWidth()
|
|
60
|
-
})
|
|
61
|
-
thumbList.width(width + 5)
|
|
70
|
+
var width = 0
|
|
71
|
+
$("li", thumbList).each(function () {
|
|
72
|
+
width += $(this).outerWidth()
|
|
73
|
+
})
|
|
74
|
+
thumbList.width(width + 5)
|
|
62
75
|
}
|
|
63
|
-
function loadVisibleThumbs(){
|
|
64
|
-
var viewportWidth = thumbsListContainer.width()
|
|
65
|
-
var width = 0
|
|
66
|
-
$(
|
|
67
|
-
var thisThumb
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if(position >= 0 && position < viewportWidth) {
|
|
73
|
-
image.prop(
|
|
76
|
+
function loadVisibleThumbs() {
|
|
77
|
+
var viewportWidth = thumbsListContainer.width()
|
|
78
|
+
var width = 0
|
|
79
|
+
$("li", thumbList).each(function () {
|
|
80
|
+
var thisThumb = $(this),
|
|
81
|
+
image = $("img", thisThumb),
|
|
82
|
+
totalWidth = (width += thisThumb.width()),
|
|
83
|
+
position = thumbList.position().left + totalWidth - thisThumb.width()
|
|
84
|
+
|
|
85
|
+
if (position >= 0 && position < viewportWidth) {
|
|
86
|
+
image.prop("src", image.data("src"))
|
|
74
87
|
}
|
|
75
|
-
})
|
|
88
|
+
})
|
|
76
89
|
}
|
|
77
|
-
function addScrollBehavior(){
|
|
78
|
-
thumbsListContainer.scrollStop(function(){
|
|
79
|
-
loadVisibleThumbs()
|
|
80
|
-
})
|
|
90
|
+
function addScrollBehavior() {
|
|
91
|
+
thumbsListContainer.scrollStop(function () {
|
|
92
|
+
loadVisibleThumbs()
|
|
93
|
+
})
|
|
81
94
|
}
|
|
82
|
-
function scrollToActiveThumb(){
|
|
83
|
-
var halfContainerWidth
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
function scrollToActiveThumb() {
|
|
96
|
+
var halfContainerWidth = thumbsListContainer.width() / 2,
|
|
97
|
+
activeThumbLeftPosition = (
|
|
98
|
+
$(".active", thumbList).position() ||
|
|
99
|
+
$("li", thumbList).first().position()
|
|
100
|
+
).left,
|
|
101
|
+
halfActiveThumbWidth = $(".active", thumbList).width() / 2
|
|
86
102
|
thumbsListContainer.scrollLeft(
|
|
87
|
-
|
|
88
|
-
)
|
|
103
|
+
activeThumbLeftPosition - halfContainerWidth + halfActiveThumbWidth,
|
|
104
|
+
)
|
|
89
105
|
}
|
|
90
106
|
function addThumbsList() {
|
|
91
|
-
addThumbsToList()
|
|
92
|
-
updateActiveThumb()
|
|
93
|
-
$(
|
|
94
|
-
thumbsListContainer.append(
|
|
95
|
-
thumbList
|
|
96
|
-
)
|
|
97
|
-
);
|
|
107
|
+
addThumbsToList()
|
|
108
|
+
updateActiveThumb()
|
|
109
|
+
$(".card-header", panel).append(thumbsListContainer.append(thumbList))
|
|
98
110
|
}
|
|
99
|
-
function updateActiveThumb(){
|
|
100
|
-
$(
|
|
101
|
-
var item = $(this)
|
|
102
|
-
if($(
|
|
103
|
-
item.addClass(
|
|
111
|
+
function updateActiveThumb() {
|
|
112
|
+
$("li", thumbList).each(function () {
|
|
113
|
+
var item = $(this)
|
|
114
|
+
if ($("img", item).data("image-id") == activeImageId) {
|
|
115
|
+
item.addClass("active")
|
|
104
116
|
}
|
|
105
|
-
})
|
|
117
|
+
})
|
|
106
118
|
}
|
|
107
|
-
function swapChangeLinkText(link){
|
|
108
|
-
link.text(
|
|
109
|
-
link.text() == 'Change' ? 'Close' : 'Change'
|
|
110
|
-
)
|
|
119
|
+
function swapChangeLinkText(link) {
|
|
120
|
+
link.text(link.text() == "Change" ? "Close" : "Change")
|
|
111
121
|
}
|
|
112
122
|
|
|
113
|
-
function addThumbsToList(){
|
|
114
|
-
$.each(image_versions, function(i){
|
|
115
|
-
var listItem = $(
|
|
116
|
-
|
|
123
|
+
function addThumbsToList() {
|
|
124
|
+
$.each(image_versions, function (i) {
|
|
125
|
+
var listItem = $(
|
|
126
|
+
'<li data-index="' +
|
|
127
|
+
i +
|
|
128
|
+
'"><a href="javascript:;"><img src="' +
|
|
129
|
+
image_versions[i]["thumb"] +
|
|
130
|
+
'" data-image-id="' +
|
|
131
|
+
image_versions[i]["imageId"] +
|
|
132
|
+
'" /></a></li>',
|
|
133
|
+
)
|
|
134
|
+
listItem.on("click", function () {
|
|
117
135
|
// get the current image id
|
|
118
|
-
var
|
|
119
|
-
var src = $('img', $(this)).attr('src');
|
|
136
|
+
var src = $("img", $(this)).attr("src")
|
|
120
137
|
|
|
121
|
-
if (typeof clickCallback ===
|
|
122
|
-
clickCallback(image_versions[i])
|
|
138
|
+
if (typeof clickCallback === "function") {
|
|
139
|
+
clickCallback(image_versions[i])
|
|
123
140
|
}
|
|
124
141
|
|
|
125
142
|
// mark the current selection as active
|
|
126
|
-
$(
|
|
127
|
-
$(this).addClass(
|
|
143
|
+
$("li.active", thumbList).removeClass("active")
|
|
144
|
+
$(this).addClass("active")
|
|
128
145
|
|
|
129
146
|
// update the multi-image selector image
|
|
130
|
-
$(".pic img.img-thumbnail", panel).attr("src", src)
|
|
131
|
-
|
|
132
|
-
$(
|
|
133
|
-
$(
|
|
134
|
-
)
|
|
135
|
-
scrollToActiveThumb()
|
|
136
|
-
})
|
|
137
|
-
$("img", listItem).on(
|
|
138
|
-
updateThumbListWidth()
|
|
139
|
-
})
|
|
140
|
-
thumbList.append(listItem)
|
|
141
|
-
})
|
|
147
|
+
$(".pic img.img-thumbnail", panel).attr("src", src)
|
|
148
|
+
|
|
149
|
+
$("[data-panel-image-pagination] [data-current-image]", panel).text(
|
|
150
|
+
$("li", thumbList).index($(this)) + 1,
|
|
151
|
+
)
|
|
152
|
+
scrollToActiveThumb()
|
|
153
|
+
})
|
|
154
|
+
$("img", listItem).on("load", function () {
|
|
155
|
+
updateThumbListWidth()
|
|
156
|
+
})
|
|
157
|
+
thumbList.append(listItem)
|
|
158
|
+
})
|
|
142
159
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
})(jQuery);
|
|
160
|
+
}
|
|
161
|
+
})(jQuery)
|
|
146
162
|
|
|
147
163
|
// source: http://stackoverflow.com/questions/14035083/jquery-bind-event-on-scroll-stops
|
|
148
|
-
jQuery.fn.scrollStop = function(callback) {
|
|
149
|
-
$(this).scroll(function() {
|
|
150
|
-
var self
|
|
151
|
-
|
|
164
|
+
jQuery.fn.scrollStop = function (callback) {
|
|
165
|
+
$(this).scroll(function () {
|
|
166
|
+
var self = this,
|
|
167
|
+
$this = $(self)
|
|
152
168
|
|
|
153
|
-
if ($this.data(
|
|
154
|
-
clearTimeout($this.data(
|
|
169
|
+
if ($this.data("scrollTimeout")) {
|
|
170
|
+
clearTimeout($this.data("scrollTimeout"))
|
|
155
171
|
}
|
|
156
172
|
|
|
157
|
-
$this.data(
|
|
158
|
-
})
|
|
159
|
-
}
|
|
173
|
+
$this.data("scrollTimeout", setTimeout(callback, 250, self))
|
|
174
|
+
})
|
|
175
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
// Place all the behaviors and hooks related to the matching controller here.
|
|
2
2
|
// All this logic will automatically be available in application.js.
|
|
3
|
-
import Core from
|
|
3
|
+
import Core from "spotlight/core"
|
|
4
4
|
|
|
5
5
|
export default class {
|
|
6
|
-
connect(){
|
|
6
|
+
connect() {
|
|
7
7
|
SirTrevor.setDefaults({
|
|
8
8
|
iconUrl: Spotlight.sirTrevorIcon,
|
|
9
|
-
uploadUrl: $(
|
|
9
|
+
uploadUrl: $("[data-attachment-endpoint]").data("attachment-endpoint"),
|
|
10
10
|
ajaxOptions: {
|
|
11
11
|
headers: {
|
|
12
|
-
|
|
12
|
+
"X-CSRF-Token": Core.csrfToken() || "",
|
|
13
13
|
},
|
|
14
|
-
credentials:
|
|
15
|
-
}
|
|
16
|
-
})
|
|
14
|
+
credentials: "same-origin",
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
17
|
|
|
18
|
-
SirTrevor.Blocks.Heading.prototype.toolbarEnabled = true
|
|
19
|
-
SirTrevor.Blocks.Quote.prototype.toolbarEnabled = true
|
|
20
|
-
SirTrevor.Blocks.Text.prototype.toolbarEnabled = true
|
|
18
|
+
SirTrevor.Blocks.Heading.prototype.toolbarEnabled = true
|
|
19
|
+
SirTrevor.Blocks.Quote.prototype.toolbarEnabled = true
|
|
20
|
+
SirTrevor.Blocks.Text.prototype.toolbarEnabled = true
|
|
21
21
|
|
|
22
|
-
var instance = $(
|
|
22
|
+
var instance = $(".js-st-instance").first()
|
|
23
23
|
|
|
24
24
|
if (instance.length) {
|
|
25
25
|
var editor = new SirTrevor.Editor({
|
|
26
26
|
el: instance[0],
|
|
27
|
-
blockTypes: instance.data(
|
|
28
|
-
altTextSettings: instance.data(
|
|
29
|
-
defaultType:["Text"],
|
|
30
|
-
onEditorRender: function() {
|
|
31
|
-
$.SerializedForm()
|
|
27
|
+
blockTypes: instance.data("blockTypes"),
|
|
28
|
+
altTextSettings: instance.data("altTextSettings"),
|
|
29
|
+
defaultType: ["Text"],
|
|
30
|
+
onEditorRender: function () {
|
|
31
|
+
$.SerializedForm()
|
|
32
32
|
},
|
|
33
33
|
blockTypeLimits: {
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
})
|
|
34
|
+
SearchResults: 1,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
37
|
|
|
38
|
-
editor.blockControls = Core.BlockControls.create(editor)
|
|
38
|
+
editor.blockControls = Core.BlockControls.create(editor)
|
|
39
39
|
|
|
40
|
-
new Core.BlockLimits(editor).enforceLimits(editor)
|
|
40
|
+
new Core.BlockLimits(editor).enforceLimits(editor)
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|