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.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/app/assets/javascripts/spotlight/spotlight.esm.js +1679 -1228
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  5. data/app/assets/javascripts/spotlight/spotlight.js +1682 -1231
  6. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  7. data/app/components/spotlight/analytics/aggregation_component.html.erb +1 -1
  8. data/app/components/spotlight/document_admin_table_component.html.erb +2 -2
  9. data/app/components/spotlight/edit_view_links_component.html.erb +1 -1
  10. data/app/components/spotlight/header_component.html.erb +1 -1
  11. data/app/components/spotlight/tag_list_form_component.html.erb +1 -1
  12. data/app/components/spotlight/tag_selector_component.html.erb +2 -2
  13. data/app/components/spotlight/translations/subheading_component.html.erb +1 -1
  14. data/app/controllers/spotlight/resources_controller.rb +1 -1
  15. data/app/javascript/spotlight/admin/add_another.js +22 -15
  16. data/app/javascript/spotlight/admin/add_image_selector.js +27 -25
  17. data/app/javascript/spotlight/admin/add_new_button.js +47 -43
  18. data/app/javascript/spotlight/admin/blacklight_configuration.js +52 -38
  19. data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +68 -60
  20. data/app/javascript/spotlight/admin/block_mixins/formable.js +55 -47
  21. data/app/javascript/spotlight/admin/block_mixins/plustextable.js +19 -20
  22. data/app/javascript/spotlight/admin/blocks/block.js +20 -16
  23. data/app/javascript/spotlight/admin/blocks/browse_block.js +42 -37
  24. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +33 -31
  25. data/app/javascript/spotlight/admin/blocks/iframe_block.js +14 -11
  26. data/app/javascript/spotlight/admin/blocks/link_to_search_block.js +4 -7
  27. data/app/javascript/spotlight/admin/blocks/oembed_block.js +13 -10
  28. data/app/javascript/spotlight/admin/blocks/pages_block.js +20 -13
  29. data/app/javascript/spotlight/admin/blocks/resources_block.js +150 -117
  30. data/app/javascript/spotlight/admin/blocks/rule_block.js +11 -10
  31. data/app/javascript/spotlight/admin/blocks/search_result_block.js +16 -17
  32. data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +123 -64
  33. data/app/javascript/spotlight/admin/blocks/solr_documents_block.js +8 -8
  34. data/app/javascript/spotlight/admin/blocks/solr_documents_carousel_block.js +63 -43
  35. data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +9 -9
  36. data/app/javascript/spotlight/admin/blocks/solr_documents_features_block.js +17 -16
  37. data/app/javascript/spotlight/admin/blocks/solr_documents_grid_block.js +6 -7
  38. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +84 -64
  39. data/app/javascript/spotlight/admin/crop.js +203 -156
  40. data/app/javascript/spotlight/admin/croppable.js +4 -4
  41. data/app/javascript/spotlight/admin/croppable_modal.js +59 -37
  42. data/app/javascript/spotlight/admin/edit_in_place.js +50 -47
  43. data/app/javascript/spotlight/admin/exhibits.js +52 -41
  44. data/app/javascript/spotlight/admin/form_observer.js +59 -53
  45. data/app/javascript/spotlight/admin/iiif.js +26 -25
  46. data/app/javascript/spotlight/admin/index.js +44 -47
  47. data/app/javascript/spotlight/admin/locks.js +14 -14
  48. data/app/javascript/spotlight/admin/multi_image_selector.js +127 -111
  49. data/app/javascript/spotlight/admin/pages.js +21 -21
  50. data/app/javascript/spotlight/admin/progress_monitor.js +67 -65
  51. data/app/javascript/spotlight/admin/readonly_checkbox.js +3 -3
  52. data/app/javascript/spotlight/admin/search_typeahead.js +55 -43
  53. data/app/javascript/spotlight/admin/select_related_input.js +17 -17
  54. data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +100 -84
  55. data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +36 -31
  56. data/app/javascript/spotlight/admin/sir-trevor/locales.js +52 -39
  57. data/app/javascript/spotlight/admin/spotlight_nestable.js +112 -90
  58. data/app/javascript/spotlight/admin/tabs.js +16 -3
  59. data/app/javascript/spotlight/admin/translation_progress.js +13 -7
  60. data/app/javascript/spotlight/admin/users.js +41 -41
  61. data/app/javascript/spotlight/admin/visibility_toggle.js +4 -4
  62. data/app/javascript/spotlight/controllers/clipboard_controller.js +14 -0
  63. data/app/javascript/spotlight/controllers/index.js +4 -2
  64. data/app/javascript/spotlight/controllers/tag_selector_controller.js +116 -79
  65. data/app/javascript/spotlight/core.js +18 -15
  66. data/app/javascript/spotlight/index.js +4 -4
  67. data/app/javascript/spotlight/user/browse_group_categories.js +24 -22
  68. data/app/javascript/spotlight/user/carousel.js +23 -19
  69. data/app/javascript/spotlight/user/clear_form_button.js +15 -15
  70. data/app/javascript/spotlight/user/index.js +4 -4
  71. data/app/javascript/spotlight/user/zpr_links.js +18 -18
  72. data/app/models/spotlight/analytics/ga.rb +0 -1
  73. data/app/models/spotlight/resources/iiif_manifest_v3.rb +2 -2
  74. data/app/services/spotlight/exhibit_import_export_service.rb +0 -2
  75. data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
  76. data/app/views/catalog/_remove_tags.html.erb +1 -1
  77. data/app/views/layouts/spotlight/base.html.erb +1 -1
  78. data/app/views/shared/_header_navbar.html.erb +1 -1
  79. data/app/views/shared/_masthead.html.erb +2 -2
  80. data/app/views/shared/_site_sidebar.html.erb +1 -1
  81. data/app/views/shared/_user_util_links.html.erb +2 -2
  82. data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
  83. data/app/views/spotlight/accessibility/alt_text.html.erb +1 -1
  84. data/app/views/spotlight/admin_users/index.html.erb +11 -9
  85. data/app/views/spotlight/appearances/edit.html.erb +1 -1
  86. data/app/views/spotlight/browse/_search_box.html.erb +1 -1
  87. data/app/views/spotlight/bulk_updates/_download.html.erb +1 -1
  88. data/app/views/spotlight/bulk_updates/_progress_panel.html.erb +6 -6
  89. data/app/views/spotlight/bulk_updates/edit.html.erb +1 -1
  90. data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
  91. data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -1
  92. data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
  93. data/app/views/spotlight/catalog/_document.html.erb +2 -2
  94. data/app/views/spotlight/catalog/_document_admin_table.html.erb +1 -1
  95. data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
  96. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
  97. data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +6 -6
  98. data/app/views/spotlight/catalog/select_image.html.erb +1 -1
  99. data/app/views/spotlight/contact_mailer/report_problem.html.erb +2 -2
  100. data/app/views/spotlight/exhibits/_contact.html.erb +2 -2
  101. data/app/views/spotlight/exhibits/_delete.html.erb +2 -2
  102. data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
  103. data/app/views/spotlight/exhibits/_export.html.erb +1 -1
  104. data/app/views/spotlight/exhibits/_form.html.erb +2 -2
  105. data/app/views/spotlight/exhibits/_languages.html.erb +7 -7
  106. data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
  107. data/app/views/spotlight/locks/_lock.html.erb +2 -2
  108. data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
  109. data/app/views/spotlight/pages/_order_pages.html.erb +3 -3
  110. data/app/views/spotlight/pages/preview.html.erb +1 -1
  111. data/app/views/spotlight/pages/show.html.erb +2 -2
  112. data/app/views/spotlight/resources/_form.html.erb +1 -1
  113. data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
  114. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  115. data/app/views/spotlight/roles/index.html.erb +5 -5
  116. data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
  117. data/app/views/spotlight/search_configurations/edit.html.erb +1 -1
  118. data/app/views/spotlight/searches/index.html.erb +2 -2
  119. data/app/views/spotlight/shared/_configuration_sidebar.html.erb +1 -1
  120. data/app/views/spotlight/shared/_curation_sidebar.html.erb +1 -1
  121. data/app/views/spotlight/shared/_dd3_item.html.erb +1 -1
  122. data/app/views/spotlight/sir_trevor/_sir_trevor_block_array.html.erb +1 -1
  123. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
  124. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +1 -1
  125. data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +2 -2
  126. data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
  127. data/app/views/spotlight/sir_trevor/blocks/_rule_block.html.erb +1 -1
  128. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -1
  129. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +1 -1
  130. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +1 -1
  131. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
  132. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +1 -1
  133. data/app/views/spotlight/sites/edit_exhibits.html.erb +3 -3
  134. data/app/views/spotlight/translations/_browse_categories.html.erb +2 -2
  135. data/app/views/spotlight/translations/_general.html.erb +21 -21
  136. data/app/views/spotlight/translations/_groups.html.erb +1 -1
  137. data/app/views/spotlight/translations/_metadata.html.erb +8 -8
  138. data/app/views/spotlight/translations/_pages_table.html.erb +2 -2
  139. data/app/views/spotlight/translations/_search_fields.html.erb +13 -13
  140. data/app/views/spotlight/translations/edit.html.erb +5 -5
  141. data/config/importmap.rb +0 -1
  142. data/lib/generators/spotlight/assets/propshaft_generator.rb +0 -1
  143. data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -31
  144. data/lib/spotlight/version.rb +1 -1
  145. data/spec/factories/contact_images.rb +1 -1
  146. data/spec/factories/exhibit_thumbnails.rb +1 -1
  147. data/spec/factories/featured_images.rb +1 -1
  148. data/spec/support/features/test_features_helpers.rb +10 -1
  149. metadata +4 -61
  150. data/app/javascript/spotlight/admin/copy_email_addresses.js +0 -7
  151. data/vendor/assets/javascripts/jquery.waitforimages.min.js +0 -2
@@ -1,68 +1,90 @@
1
- import Crop from 'spotlight/admin/crop';
1
+ import Crop from "spotlight/admin/crop"
2
2
 
3
3
  export default class CroppableModal {
4
-
5
4
  attachModalHandlers() {
6
5
  // Attach handler for when modal first loads, to show the cropper
7
- this.attachModalLoadBehavior();
6
+ this.attachModalLoadBehavior()
8
7
  // Attach handler for save by checking if clicking in the modal is on a save button
9
- this.attachModalSaveHandler();
8
+ this.attachModalSaveHandler()
10
9
  }
11
10
 
12
11
  attachModalLoadBehavior() {
13
12
  // Listen for event thrown when modal is displayed with content
14
- document.addEventListener('loaded.blacklight.blacklight-modal', function(e) {
15
- var dataCropperDiv = $('#blacklight-modal [data-behavior="iiif-cropper"]');
16
-
17
- if(dataCropperDiv) {
18
- new Crop(dataCropperDiv, false).render();
19
- }
20
- });
13
+ document.addEventListener(
14
+ "loaded.blacklight.blacklight-modal",
15
+ function () {
16
+ var dataCropperDiv = $(
17
+ '#blacklight-modal [data-behavior="iiif-cropper"]',
18
+ )
19
+
20
+ if (dataCropperDiv) {
21
+ new Crop(dataCropperDiv, false).render()
22
+ }
23
+ },
24
+ )
21
25
  }
22
26
 
23
27
  // Field names are of the format item[item_0][iiif_image_id]
24
28
  iiifInputField(itemIndex, fieldName, parentElement) {
25
- var itemPrefix = 'item[' + itemIndex + ']';
26
- var selector = 'input[name="' + itemPrefix + '[' + fieldName + ']"]';
27
- return $(selector, parentElement);
29
+ var itemPrefix = "item[" + itemIndex + "]"
30
+ var selector = 'input[name="' + itemPrefix + "[" + fieldName + ']"]'
31
+ return $(selector, parentElement)
28
32
  }
29
33
 
30
34
  attachModalSaveHandler() {
31
- var context = this;
32
-
33
- document.addEventListener('show.blacklight.blacklight-modal', function(e) {
34
- $('#save-cropping-selection').on('click', () => {
35
- context.saveCroppedRegion();
36
- });
37
- });
35
+ var context = this
36
+
37
+ document.addEventListener("show.blacklight.blacklight-modal", function () {
38
+ $("#save-cropping-selection").on("click", () => {
39
+ context.saveCroppedRegion()
40
+ })
41
+ })
38
42
  }
39
43
 
40
44
  saveCroppedRegion() {
41
45
  //On hitting "save changes", we need to copy over the value
42
46
  //to the iiif thumbnail url input field as well as the image source itself
43
- var context = this;
44
- var dataCropperDiv = $('#blacklight-modal [data-behavior="iiif-cropper"]');
47
+ var context = this
48
+ var dataCropperDiv = $('#blacklight-modal [data-behavior="iiif-cropper"]')
45
49
 
46
- if(dataCropperDiv) {
47
- var dataCropperKey = dataCropperDiv.data("cropper-key");
48
- var itemIndex = dataCropperDiv.data("index-id");
50
+ if (dataCropperDiv) {
51
+ var dataCropperKey = dataCropperDiv.data("cropper-key")
52
+ var itemIndex = dataCropperDiv.data("index-id")
49
53
  // Get the element on the main edit page whose select image link opened up the modal
50
- var itemElement = $('[data-cropper="' + dataCropperKey + '"]');
54
+ var itemElement = $('[data-cropper="' + dataCropperKey + '"]')
51
55
  // Get the hidden input field on the main edit page corresponding to this item
52
- var thumbnailSaveField = context.iiifInputField(itemIndex, 'thumbnail_image_url', itemElement);
53
- var fullimageSaveField = context.iiifInputField(itemIndex, 'full_image_url', itemElement);
54
- var iiifTilesource = context.iiifInputField(itemIndex, 'iiif_tilesource', itemElement).val();
55
- var regionValue = context.iiifInputField(itemIndex, 'iiif_region', itemElement).val();
56
+ var thumbnailSaveField = context.iiifInputField(
57
+ itemIndex,
58
+ "thumbnail_image_url",
59
+ itemElement,
60
+ )
61
+ var fullimageSaveField = context.iiifInputField(
62
+ itemIndex,
63
+ "full_image_url",
64
+ itemElement,
65
+ )
66
+ var iiifTilesource = context
67
+ .iiifInputField(itemIndex, "iiif_tilesource", itemElement)
68
+ .val()
69
+ var regionValue = context
70
+ .iiifInputField(itemIndex, "iiif_region", itemElement)
71
+ .val()
56
72
  // Extract the region string to incorporate into the thumbnail URL
57
- var urlPrefix = iiifTilesource.substring(0, iiifTilesource.lastIndexOf('/info.json'));
58
- var thumbnailUrl = urlPrefix + '/' + regionValue + '/!400,400/0/default.jpg';
73
+ var urlPrefix = iiifTilesource.substring(
74
+ 0,
75
+ iiifTilesource.lastIndexOf("/info.json"),
76
+ )
77
+ var thumbnailUrl =
78
+ urlPrefix + "/" + regionValue + "/!400,400/0/default.jpg"
59
79
  // Set the hidden input value to the thumbnail URL
60
80
  // Also set the full image - which is used by widgets like carousel or slideshow
61
- thumbnailSaveField.val(thumbnailUrl);
62
- fullimageSaveField.val(urlPrefix + '/' + regionValue + '/!800,800/0/default.jpg');
81
+ thumbnailSaveField.val(thumbnailUrl)
82
+ fullimageSaveField.val(
83
+ urlPrefix + "/" + regionValue + "/!800,800/0/default.jpg",
84
+ )
63
85
  // Also change img url for thumbnail image
64
- var itemImage = $('img.img-thumbnail', itemElement);
65
- itemImage.attr('src', thumbnailUrl);
86
+ var itemImage = $("img.img-thumbnail", itemElement)
87
+ itemImage.attr("src", thumbnailUrl)
66
88
  }
67
89
  }
68
90
  }
@@ -3,72 +3,75 @@
3
3
  */
4
4
  export default class {
5
5
  connect() {
6
- $('[data-in-place-edit-target]').each(function() {
7
- $(this).on('click.inplaceedit', function() {
8
- var $label = $(this).find($(this).data('in-place-edit-target'));
9
- var $input = $(this).find($(this).data('in-place-edit-field-target'));
6
+ $("[data-in-place-edit-target]").each(function () {
7
+ $(this).on("click.inplaceedit", function () {
8
+ var $label = $(this).find($(this).data("in-place-edit-target"))
9
+ var $input = $(this).find($(this).data("in-place-edit-field-target"))
10
10
 
11
11
  // hide the edit-in-place affordance icon while in edit mode
12
- $(this).addClass('hide-edit-icon');
13
- $label.hide();
14
- $input.val($label.text());
15
- $input.attr('type', 'text');
16
- $input.select();
17
- $input.focus();
12
+ $(this).addClass("hide-edit-icon")
13
+ $label.hide()
14
+ $input.val($label.text())
15
+ $input.attr("type", "text")
16
+ $input.select()
17
+ $input.focus()
18
18
 
19
- $input.on('keypress', function(e) {
20
- if(e.which == 13) {
21
- $input.trigger('blur.inplaceedit');
22
- return false;
19
+ $input.on("keypress", function (e) {
20
+ if (e.which == 13) {
21
+ $input.trigger("blur.inplaceedit")
22
+ return false
23
23
  }
24
- });
24
+ })
25
25
 
26
- $input.on('blur.inplaceedit', function() {
27
- var value = $input.val();
26
+ $input.on("blur.inplaceedit", function () {
27
+ var value = $input.val()
28
28
 
29
29
  if ($.trim(value).length == 0) {
30
- $input.val($label.text());
30
+ $input.val($label.text())
31
31
  } else {
32
- $label.text(value);
32
+ $label.text(value)
33
33
  }
34
34
 
35
- $label.show();
36
- $input.attr('type', 'hidden');
35
+ $label.show()
36
+ $input.attr("type", "hidden")
37
37
  // when leaving edit mode, should no longer hide edit-in-place affordance icon
38
- $("[data-in-place-edit-target]").removeClass('hide-edit-icon');
38
+ $("[data-in-place-edit-target]").removeClass("hide-edit-icon")
39
39
 
40
- return false;
41
- });
40
+ return false
41
+ })
42
42
 
43
- return false;
44
- });
43
+ return false
44
+ })
45
45
  })
46
46
 
47
- $("[data-behavior='restore-default']").each(function(){
48
- var hidden = $("[data-default-value]", $(this));
49
- var value = $($("[data-in-place-edit-target]", $(this)).data('in-place-edit-target'), $(this));
50
- var button = $("[data-restore-default]", $(this));
47
+ $("[data-behavior='restore-default']").each(function () {
48
+ var hidden = $("[data-default-value]", $(this))
49
+ var value = $(
50
+ $("[data-in-place-edit-target]", $(this)).data("in-place-edit-target"),
51
+ $(this),
52
+ )
53
+ var button = $("[data-restore-default]", $(this))
51
54
 
52
- hidden.on('keypress', function(e) {
53
- if(e.which == 13) {
54
- hidden.trigger('blur');
55
- return false;
55
+ hidden.on("keypress", function (e) {
56
+ if (e.which == 13) {
57
+ hidden.trigger("blur")
58
+ return false
56
59
  }
57
- });
60
+ })
58
61
 
59
- hidden.on('blur', function(){
60
- if( $(this).val() == $(this).data('default-value') ) {
61
- button.addClass('d-none');
62
+ hidden.on("blur", function () {
63
+ if ($(this).val() == $(this).data("default-value")) {
64
+ button.addClass("d-none")
62
65
  } else {
63
- button.removeClass('d-none');
66
+ button.removeClass("d-none")
64
67
  }
65
- });
66
- button.on('click', function(e){
67
- e.preventDefault();
68
- hidden.val(hidden.data('default-value'));
69
- value.text(hidden.data('default-value'));
70
- button.hide();
71
- });
72
- });
68
+ })
69
+ button.on("click", function (e) {
70
+ e.preventDefault()
71
+ hidden.val(hidden.data("default-value"))
72
+ value.text(hidden.data("default-value"))
73
+ button.hide()
74
+ })
75
+ })
73
76
  }
74
77
  }
@@ -1,66 +1,77 @@
1
- import { URLify } from 'parameterize';
1
+ import { URLify } from "parameterize"
2
2
 
3
3
  export default class {
4
4
  connect() {
5
5
  // auto-fill the exhibit slug on the new exhibit form
6
- $('#new_exhibit').each(function() {
7
- $('#exhibit_title').on('change keyup', function() {
8
- $('#exhibit_slug').attr('placeholder', URLify($(this).val(), $(this).val().length));
9
- });
6
+ $("#new_exhibit").each(function () {
7
+ $("#exhibit_title").on("change keyup", function () {
8
+ $("#exhibit_slug").attr(
9
+ "placeholder",
10
+ URLify($(this).val(), $(this).val().length),
11
+ )
12
+ })
10
13
 
11
- $('#exhibit_slug').on('focus', function() {
12
- if ($(this).val() === '') {
13
- $(this).val($(this).attr('placeholder'));
14
+ $("#exhibit_slug").on("focus", function () {
15
+ if ($(this).val() === "") {
16
+ $(this).val($(this).attr("placeholder"))
14
17
  }
15
- });
16
- });
18
+ })
19
+ })
17
20
 
18
- $("#another-email").on("click", function(e) {
19
- e.preventDefault();
21
+ $("#another-email").on("click", function (e) {
22
+ e.preventDefault()
20
23
 
21
- var container = $(this).closest('.form-group');
22
- var contacts = container.find('.contact');
23
- var inputContainer = contacts.first().clone();
24
+ var container = $(this).closest(".form-group")
25
+ var contacts = container.find(".contact")
26
+ var inputContainer = contacts.first().clone()
24
27
 
25
28
  // wipe out any values from the inputs
26
- inputContainer.find('input').each(function() {
27
- $(this).val('');
28
- $(this).attr('id', $(this).attr('id').replace('0', contacts.length));
29
- $(this).attr('name', $(this).attr('name').replace('0', contacts.length));
30
- if ($(this).attr('aria-label')) {
31
- $(this).attr('aria-label', $(this).attr('aria-label').replace('1', contacts.length + 1));
29
+ inputContainer.find("input").each(function () {
30
+ $(this).val("")
31
+ $(this).attr("id", $(this).attr("id").replace("0", contacts.length))
32
+ $(this).attr("name", $(this).attr("name").replace("0", contacts.length))
33
+ if ($(this).attr("aria-label")) {
34
+ $(this).attr(
35
+ "aria-label",
36
+ $(this)
37
+ .attr("aria-label")
38
+ .replace("1", contacts.length + 1),
39
+ )
32
40
  }
33
- });
41
+ })
34
42
 
35
- inputContainer.find('.contact-email-delete-wrapper').remove();
36
- inputContainer.find('.confirmation-status').remove();
43
+ inputContainer.find(".contact-email-delete-wrapper").remove()
44
+ inputContainer.find(".confirmation-status").remove()
37
45
 
38
46
  // bootstrap does not render input-groups with only one value in them correctly.
39
- inputContainer.find('.input-group input:only-child').closest('.input-group').removeClass('input-group');
47
+ inputContainer
48
+ .find(".input-group input:only-child")
49
+ .closest(".input-group")
50
+ .removeClass("input-group")
40
51
 
41
- $(inputContainer).insertAfter(contacts.last());
42
- });
52
+ $(inputContainer).insertAfter(contacts.last())
53
+ })
43
54
 
44
- if (document.getElementById('another-email')) {
45
- document.addEventListener('turbo:submit-end', this.contactToDeleteNotFoundHandler);
46
- }
47
-
48
- if ($.fn.tooltip) {
49
- $('.btn-with-tooltip').tooltip();
55
+ if (document.getElementById("another-email")) {
56
+ document.addEventListener(
57
+ "turbo:submit-end",
58
+ this.contactToDeleteNotFoundHandler,
59
+ )
50
60
  }
51
61
 
52
62
  // Put focus in saved search title input when Save this search modal is shown
53
- $('#save-modal').on('shown.bs.modal', function () {
54
- $('#search_title').focus();
55
- });
63
+ $("#save-modal").on("shown.bs.modal", function () {
64
+ $("#search_title").focus()
65
+ })
56
66
  }
57
67
 
58
68
  contactToDeleteNotFoundHandler(e) {
59
- const contact = e.detail.formSubmission?.delegate?.element?.querySelector('.contact')
69
+ const contact =
70
+ e.detail.formSubmission?.delegate?.element?.querySelector(".contact")
60
71
  if (contact && e.detail?.fetchResponse?.response?.status === 404) {
61
- const error = contact.querySelector('.contact-email-delete-error');
62
- error.style.display = 'block';
63
- error.querySelector('.error-msg').textContent = 'Not Found';
72
+ const error = contact.querySelector(".contact-email-delete-error")
73
+ error.style.display = "block"
74
+ error.querySelector(".error-msg").textContent = "Not Found"
64
75
  }
65
76
  }
66
- }
77
+ }
@@ -1,88 +1,94 @@
1
-
2
- (function($, _) {
3
- 'use strict';
1
+ ;(function ($, _) {
2
+ "use strict"
4
3
 
5
4
  /*
6
- * SerializedForm is built as a singleton jQuery plugin. It needs to be able to
7
- * handle instantiation from multiple sources, and use the [data-form-observer]
8
- * as global state object.
9
- */
5
+ * SerializedForm is built as a singleton jQuery plugin. It needs to be able to
6
+ * handle instantiation from multiple sources, and use the [data-form-observer]
7
+ * as global state object.
8
+ */
10
9
  $.SerializedForm = function () {
11
- var $serializedForm;
12
- var plugin = this;
10
+ var $serializedForm
11
+ var plugin = this
13
12
 
14
13
  // Store form serialization in data attribute
15
- function serializeFormStatus () {
16
- $serializedForm.data('serialized-form', formSerialization($serializedForm));
14
+ function serializeFormStatus() {
15
+ $serializedForm.data(
16
+ "serialized-form",
17
+ formSerialization($serializedForm),
18
+ )
17
19
  }
18
20
 
19
21
  // Do custom serialization of the sir-trevor form data. This needs to be a
20
22
  // passed in argument for comparison later on.
21
- function formSerialization (form) {
22
- var content_editable = [];
23
- var i = 0;
24
- $("[contenteditable='true']", form).each(function(){
25
- content_editable.push('&contenteditable_' + i + '=' + $(this).text());
26
- });
27
- return form.serialize() + content_editable.join();
23
+ function formSerialization(form) {
24
+ var content_editable = []
25
+ var i = 0
26
+ $("[contenteditable='true']", form).each(function () {
27
+ content_editable.push("&contenteditable_" + i + "=" + $(this).text())
28
+ })
29
+ return form.serialize() + content_editable.join()
28
30
  }
29
31
 
30
32
  // Unbind observing form on submit (which we have to do because of turbolinks)
31
- function unbindObservedFormSubmit () {
32
- $serializedForm.on('submit', function () {
33
- $(this).data('being-submitted', true);
34
- });
33
+ function unbindObservedFormSubmit() {
34
+ $serializedForm.on("submit", function () {
35
+ $(this).data("being-submitted", true)
36
+ })
35
37
  }
36
38
 
37
39
  // Get the stored serialized form status
38
- function serializedFormStatus () {
39
- return $serializedForm.data('serialized-form');
40
+ function serializedFormStatus() {
41
+ return $serializedForm.data("serialized-form")
40
42
  }
41
43
 
42
44
  // Check all observed forms on page for status change
43
45
  plugin.observedFormsStatusHasChanged = function () {
44
- var unsaved_changes = false;
45
- $('[data-form-observer]').each(function (){
46
- if ( !$(this).data("being-submitted") ) {
46
+ var unsaved_changes = false
47
+ $("[data-form-observer]").each(function () {
48
+ if (!$(this).data("being-submitted")) {
47
49
  if (serializedFormStatus() != formSerialization($(this))) {
48
- unsaved_changes = true;
50
+ unsaved_changes = true
49
51
  }
50
52
  }
51
- });
52
- return unsaved_changes;
53
+ })
54
+ return unsaved_changes
53
55
  }
54
56
 
55
- function init () {
56
- $serializedForm = $('[data-form-observer]');
57
- serializeFormStatus();
58
- unbindObservedFormSubmit();
57
+ function init() {
58
+ $serializedForm = $("[data-form-observer]")
59
+ serializeFormStatus()
60
+ unbindObservedFormSubmit()
59
61
  }
60
62
 
61
- init();
63
+ init()
62
64
 
63
- return plugin;
64
- };
65
- })(jQuery);
65
+ return plugin
66
+ }
67
+ })(jQuery)
66
68
 
67
69
  export default class {
68
70
  connect() {
69
71
  // Instantiate the singleton SerializedForm plugin
70
- var serializedForm = $.SerializedForm();
71
- $(window).on('beforeunload page:before-change turbolinks:before-visit turbo:before-visit', function(event) {
72
- // Don't handle the same event twice #turbolinks
73
- if (event.handled !== true) {
74
- if ( serializedForm.observedFormsStatusHasChanged() ) {
75
- event.handled = true;
76
- var message = "You have unsaved changes. Are you sure you want to leave this page?";
77
- // There are variations in how Webkit browsers may handle this:
78
- // https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload
79
- if ( event.type == "beforeunload" ) {
80
- return message;
81
- } else {
82
- return confirm(message)
72
+ var serializedForm = $.SerializedForm()
73
+ $(window).on(
74
+ "beforeunload page:before-change turbolinks:before-visit turbo:before-visit",
75
+ function (event) {
76
+ // Don't handle the same event twice #turbolinks
77
+ if (event.handled !== true) {
78
+ if (serializedForm.observedFormsStatusHasChanged()) {
79
+ event.handled = true
80
+ var message =
81
+ "You have unsaved changes. Are you sure you want to leave this page?"
82
+ // There are variations in how Webkit browsers may handle this:
83
+ // https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload
84
+ if (event.type == "beforeunload") {
85
+ return message
86
+ } else {
87
+ return confirm(message)
88
+ }
83
89
  }
84
90
  }
85
- }
86
- });
91
+ },
92
+ )
87
93
  }
88
94
  }
@@ -1,52 +1,53 @@
1
1
  export default class Iiif {
2
2
  constructor(manifestUrl, manifest) {
3
- this.manifestUrl = manifestUrl;
4
- this.manifest = manifest;
3
+ this.manifestUrl = manifestUrl
4
+ this.manifest = manifest
5
5
  }
6
6
 
7
7
  sequences() {
8
- var it = {};
9
- var context = this;
10
- it[Symbol.iterator] = function*() {
8
+ var it = {}
9
+ var context = this
10
+ it[Symbol.iterator] = function* () {
11
11
  for (let sequence of context.manifest.sequences) {
12
- yield sequence;
13
- };
12
+ yield sequence
13
+ }
14
14
  }
15
- return it;
15
+ return it
16
16
  }
17
17
 
18
18
  canvases() {
19
- var it = {};
20
- var context = this;
21
- it[Symbol.iterator] = function*() {
19
+ var it = {}
20
+ var context = this
21
+ it[Symbol.iterator] = function* () {
22
22
  for (let sequence of context.sequences()) {
23
23
  for (let canvas of sequence.canvases) {
24
- yield canvas;
24
+ yield canvas
25
25
  }
26
26
  }
27
27
  }
28
- return it;
28
+ return it
29
29
  }
30
30
 
31
31
  images() {
32
- var it = {};
33
- var context = this;
34
- it[Symbol.iterator] = function*() {
32
+ var it = {}
33
+ var context = this
34
+ it[Symbol.iterator] = function* () {
35
35
  for (let canvas of context.canvases()) {
36
36
  for (let image of canvas.images) {
37
- var iiifService = image.resource?.service || image.resource?.default?.service;
38
- var iiifServiceId = iiifService['@id'];
37
+ var iiifService =
38
+ image.resource?.service || image.resource?.default?.service
39
+ var iiifServiceId = iiifService["@id"]
39
40
  yield {
40
- 'thumb': iiifServiceId + '/full/!100,100/0/default.jpg',
41
- 'tilesource': iiifServiceId + '/info.json',
42
- 'manifest': context.manifestUrl,
43
- 'canvasId': canvas['@id'],
44
- 'imageId': image['@id']
45
- };
41
+ thumb: iiifServiceId + "/full/!100,100/0/default.jpg",
42
+ tilesource: iiifServiceId + "/info.json",
43
+ manifest: context.manifestUrl,
44
+ canvasId: canvas["@id"],
45
+ imageId: image["@id"],
46
+ }
46
47
  }
47
48
  }
48
49
  }
49
- return it;
50
+ return it
50
51
  }
51
52
 
52
53
  imagesArray() {