blacklight-spotlight 5.2.4 → 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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -5
  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/assets/stylesheets/spotlight/_spotlight.scss +0 -2
  8. data/app/components/spotlight/analytics/aggregation_component.html.erb +1 -1
  9. data/app/components/spotlight/document_admin_table_component.html.erb +2 -2
  10. data/app/components/spotlight/edit_view_links_component.html.erb +1 -1
  11. data/app/components/spotlight/header_component.html.erb +1 -1
  12. data/app/components/spotlight/tag_list_form_component.html.erb +1 -1
  13. data/app/components/spotlight/tag_selector_component.html.erb +2 -2
  14. data/app/components/spotlight/translations/subheading_component.html.erb +1 -1
  15. data/app/controllers/spotlight/bulk_actions_controller.rb +2 -2
  16. data/app/controllers/spotlight/bulk_updates_controller.rb +2 -2
  17. data/app/controllers/spotlight/catalog_controller.rb +2 -2
  18. data/app/controllers/spotlight/contact_forms_controller.rb +1 -1
  19. data/app/controllers/spotlight/exhibits_controller.rb +1 -1
  20. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  21. data/app/controllers/spotlight/pages_controller.rb +1 -1
  22. data/app/controllers/spotlight/resources_controller.rb +1 -1
  23. data/app/controllers/spotlight/searches_controller.rb +3 -4
  24. data/app/controllers/spotlight/solr_controller.rb +1 -1
  25. data/app/controllers/spotlight/tags_controller.rb +1 -1
  26. data/app/controllers/spotlight/versions_controller.rb +1 -1
  27. data/app/javascript/spotlight/admin/add_another.js +22 -15
  28. data/app/javascript/spotlight/admin/add_image_selector.js +27 -25
  29. data/app/javascript/spotlight/admin/add_new_button.js +47 -43
  30. data/app/javascript/spotlight/admin/blacklight_configuration.js +52 -38
  31. data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +68 -60
  32. data/app/javascript/spotlight/admin/block_mixins/formable.js +55 -47
  33. data/app/javascript/spotlight/admin/block_mixins/plustextable.js +19 -20
  34. data/app/javascript/spotlight/admin/blocks/block.js +20 -16
  35. data/app/javascript/spotlight/admin/blocks/browse_block.js +42 -37
  36. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +33 -31
  37. data/app/javascript/spotlight/admin/blocks/iframe_block.js +14 -11
  38. data/app/javascript/spotlight/admin/blocks/link_to_search_block.js +4 -7
  39. data/app/javascript/spotlight/admin/blocks/oembed_block.js +13 -10
  40. data/app/javascript/spotlight/admin/blocks/pages_block.js +20 -13
  41. data/app/javascript/spotlight/admin/blocks/resources_block.js +150 -117
  42. data/app/javascript/spotlight/admin/blocks/rule_block.js +11 -10
  43. data/app/javascript/spotlight/admin/blocks/search_result_block.js +16 -17
  44. data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +123 -64
  45. data/app/javascript/spotlight/admin/blocks/solr_documents_block.js +8 -8
  46. data/app/javascript/spotlight/admin/blocks/solr_documents_carousel_block.js +63 -43
  47. data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +9 -9
  48. data/app/javascript/spotlight/admin/blocks/solr_documents_features_block.js +17 -16
  49. data/app/javascript/spotlight/admin/blocks/solr_documents_grid_block.js +6 -7
  50. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +84 -64
  51. data/app/javascript/spotlight/admin/crop.js +203 -156
  52. data/app/javascript/spotlight/admin/croppable.js +4 -4
  53. data/app/javascript/spotlight/admin/croppable_modal.js +59 -37
  54. data/app/javascript/spotlight/admin/edit_in_place.js +50 -47
  55. data/app/javascript/spotlight/admin/exhibits.js +52 -41
  56. data/app/javascript/spotlight/admin/form_observer.js +59 -53
  57. data/app/javascript/spotlight/admin/iiif.js +26 -25
  58. data/app/javascript/spotlight/admin/index.js +44 -47
  59. data/app/javascript/spotlight/admin/locks.js +14 -14
  60. data/app/javascript/spotlight/admin/multi_image_selector.js +127 -111
  61. data/app/javascript/spotlight/admin/pages.js +21 -21
  62. data/app/javascript/spotlight/admin/progress_monitor.js +67 -65
  63. data/app/javascript/spotlight/admin/readonly_checkbox.js +3 -3
  64. data/app/javascript/spotlight/admin/search_typeahead.js +55 -43
  65. data/app/javascript/spotlight/admin/select_related_input.js +17 -17
  66. data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +100 -84
  67. data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +36 -31
  68. data/app/javascript/spotlight/admin/sir-trevor/locales.js +52 -39
  69. data/app/javascript/spotlight/admin/spotlight_nestable.js +112 -90
  70. data/app/javascript/spotlight/admin/tabs.js +16 -3
  71. data/app/javascript/spotlight/admin/translation_progress.js +13 -7
  72. data/app/javascript/spotlight/admin/users.js +41 -41
  73. data/app/javascript/spotlight/admin/visibility_toggle.js +4 -4
  74. data/app/javascript/spotlight/controllers/clipboard_controller.js +14 -0
  75. data/app/javascript/spotlight/controllers/index.js +4 -2
  76. data/app/javascript/spotlight/controllers/tag_selector_controller.js +116 -79
  77. data/app/javascript/spotlight/core.js +18 -15
  78. data/app/javascript/spotlight/index.js +4 -4
  79. data/app/javascript/spotlight/user/browse_group_categories.js +24 -22
  80. data/app/javascript/spotlight/user/carousel.js +23 -19
  81. data/app/javascript/spotlight/user/clear_form_button.js +15 -15
  82. data/app/javascript/spotlight/user/index.js +4 -4
  83. data/app/javascript/spotlight/user/zpr_links.js +18 -18
  84. data/app/models/spotlight/analytics/ga.rb +0 -1
  85. data/app/models/spotlight/custom_field.rb +1 -1
  86. data/app/models/spotlight/resources/iiif_manifest_v3.rb +2 -2
  87. data/app/services/spotlight/exhibit_import_export_service.rb +0 -2
  88. data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
  89. data/app/views/catalog/_remove_tags.html.erb +1 -1
  90. data/app/views/layouts/spotlight/base.html.erb +1 -1
  91. data/app/views/shared/_header_navbar.html.erb +1 -1
  92. data/app/views/shared/_masthead.html.erb +2 -2
  93. data/app/views/shared/_site_sidebar.html.erb +1 -1
  94. data/app/views/shared/_user_util_links.html.erb +2 -2
  95. data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
  96. data/app/views/spotlight/accessibility/alt_text.html.erb +1 -1
  97. data/app/views/spotlight/admin_users/index.html.erb +11 -9
  98. data/app/views/spotlight/appearances/edit.html.erb +1 -1
  99. data/app/views/spotlight/browse/_search_box.html.erb +1 -1
  100. data/app/views/spotlight/bulk_updates/_download.html.erb +1 -1
  101. data/app/views/spotlight/bulk_updates/_progress_panel.html.erb +6 -6
  102. data/app/views/spotlight/bulk_updates/edit.html.erb +1 -1
  103. data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
  104. data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -1
  105. data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
  106. data/app/views/spotlight/catalog/_document.html.erb +2 -2
  107. data/app/views/spotlight/catalog/_document_admin_table.html.erb +1 -1
  108. data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
  109. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
  110. data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +6 -6
  111. data/app/views/spotlight/catalog/select_image.html.erb +1 -1
  112. data/app/views/spotlight/contact_mailer/report_problem.html.erb +2 -2
  113. data/app/views/spotlight/exhibits/_contact.html.erb +2 -2
  114. data/app/views/spotlight/exhibits/_delete.html.erb +2 -2
  115. data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
  116. data/app/views/spotlight/exhibits/_export.html.erb +1 -1
  117. data/app/views/spotlight/exhibits/_form.html.erb +2 -2
  118. data/app/views/spotlight/exhibits/_languages.html.erb +7 -7
  119. data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
  120. data/app/views/spotlight/locks/_lock.html.erb +2 -2
  121. data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
  122. data/app/views/spotlight/pages/_order_pages.html.erb +3 -3
  123. data/app/views/spotlight/pages/preview.html.erb +1 -1
  124. data/app/views/spotlight/pages/show.html.erb +2 -2
  125. data/app/views/spotlight/resources/_form.html.erb +1 -1
  126. data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
  127. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  128. data/app/views/spotlight/roles/index.html.erb +5 -5
  129. data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
  130. data/app/views/spotlight/search_configurations/edit.html.erb +1 -1
  131. data/app/views/spotlight/searches/index.html.erb +2 -2
  132. data/app/views/spotlight/shared/_configuration_sidebar.html.erb +1 -1
  133. data/app/views/spotlight/shared/_curation_sidebar.html.erb +1 -1
  134. data/app/views/spotlight/shared/_dd3_item.html.erb +1 -1
  135. data/app/views/spotlight/sir_trevor/_sir_trevor_block_array.html.erb +1 -1
  136. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
  137. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +1 -1
  138. data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +2 -2
  139. data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
  140. data/app/views/spotlight/sir_trevor/blocks/_rule_block.html.erb +1 -1
  141. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -1
  142. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +1 -1
  143. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +1 -1
  144. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
  145. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +1 -1
  146. data/app/views/spotlight/sites/edit_exhibits.html.erb +3 -3
  147. data/app/views/spotlight/translations/_browse_categories.html.erb +2 -2
  148. data/app/views/spotlight/translations/_general.html.erb +21 -21
  149. data/app/views/spotlight/translations/_groups.html.erb +1 -1
  150. data/app/views/spotlight/translations/_metadata.html.erb +8 -8
  151. data/app/views/spotlight/translations/_pages_table.html.erb +2 -2
  152. data/app/views/spotlight/translations/_search_fields.html.erb +13 -13
  153. data/app/views/spotlight/translations/edit.html.erb +5 -5
  154. data/config/importmap.rb +0 -1
  155. data/lib/generators/spotlight/assets/propshaft_generator.rb +0 -1
  156. data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -31
  157. data/lib/spotlight/version.rb +1 -1
  158. data/spec/factories/contact_images.rb +1 -1
  159. data/spec/factories/exhibit_thumbnails.rb +1 -1
  160. data/spec/factories/featured_images.rb +1 -1
  161. data/spec/support/features/test_features_helpers.rb +12 -3
  162. metadata +12 -64
  163. data/app/assets/stylesheets/spotlight/typeahead.scss +0 -77
  164. data/app/javascript/spotlight/admin/copy_email_addresses.js +0 -7
  165. data/vendor/assets/javascripts/jquery.waitforimages.min.js +0 -2
@@ -1,39 +1,44 @@
1
- import Core from 'spotlight/core'
1
+ import Core from "spotlight/core"
2
2
 
3
- Core.BlockLimits = function(editor) {
4
- this.editor = editor;
5
- };
3
+ Core.BlockLimits = function (editor) {
4
+ this.editor = editor
5
+ }
6
6
 
7
- Core.BlockLimits.prototype.enforceLimits = function(editor) {
8
- this.addEditorCallbacks(editor);
9
- this.checkGlobalBlockTypeLimit()();
10
- };
7
+ Core.BlockLimits.prototype.enforceLimits = function (editor) {
8
+ this.addEditorCallbacks(editor)
9
+ this.checkGlobalBlockTypeLimit()()
10
+ }
11
11
 
12
- Core.BlockLimits.prototype.addEditorCallbacks = function(editor) {
13
- SirTrevor.EventBus.on('block:create:new', this.checkBlockTypeLimitOnAdd());
14
- SirTrevor.EventBus.on('block:remove', this.checkGlobalBlockTypeLimit());
15
- };
12
+ Core.BlockLimits.prototype.addEditorCallbacks = function (_editor) {
13
+ SirTrevor.EventBus.on("block:create:new", this.checkBlockTypeLimitOnAdd())
14
+ SirTrevor.EventBus.on("block:remove", this.checkGlobalBlockTypeLimit())
15
+ }
16
16
 
17
- Core.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function() {
18
- var editor = this.editor;
17
+ Core.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function () {
18
+ var editor = this.editor
19
19
 
20
- return function(block) {
21
- var control = $(".st-block-controls__button[data-type='" + block.type + "']", editor.blockControls.el);
20
+ return function (block) {
21
+ var control = $(
22
+ ".st-block-controls__button[data-type='" + block.type + "']",
23
+ editor.blockControls.el,
24
+ )
22
25
 
23
- control.prop("disabled", !editor.blockManager.canCreateBlock(block.class()));
24
- };
25
- };
26
+ control.prop("disabled", !editor.blockManager.canCreateBlock(block.class()))
27
+ }
28
+ }
26
29
 
27
- Core.BlockLimits.prototype.checkGlobalBlockTypeLimit = function() {
30
+ Core.BlockLimits.prototype.checkGlobalBlockTypeLimit = function () {
28
31
  // we don't know what type of block was created or removed.. So, try them all.
29
- var editor = this.editor;
30
-
31
- return function() {
32
- $.each(editor.blockManager.blockTypes, function(i, type) {
33
- var block_type = SirTrevor.Blocks[type].prototype;
34
-
35
- var control = $(editor.blockControls.el).find(".st-block-controls__button[data-type='" + block_type.type + "']");
36
- control.prop("disabled", !editor.blockManager.canCreateBlock(type));
37
- });
38
- };
39
- };
32
+ var editor = this.editor
33
+
34
+ return function () {
35
+ $.each(editor.blockManager.blockTypes, function (i, type) {
36
+ var block_type = SirTrevor.Blocks[type].prototype
37
+
38
+ var control = $(editor.blockControls.el).find(
39
+ ".st-block-controls__button[data-type='" + block_type.type + "']",
40
+ )
41
+ control.prop("disabled", !editor.blockManager.canCreateBlock(type))
42
+ })
43
+ }
44
+ }
@@ -1,111 +1,123 @@
1
1
  SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
2
2
  autocompleteable: {
3
- placeholder: "Enter a title..."
3
+ placeholder: "Enter a title...",
4
4
  },
5
5
 
6
6
  browse: {
7
7
  title: "Browse Categories",
8
- description: "This widget highlights browse categories. Each highlighted category links to the corresponding browse category results page.",
9
- item_counts: "Include item counts?"
8
+ description:
9
+ "This widget highlights browse categories. Each highlighted category links to the corresponding browse category results page.",
10
+ item_counts: "Include item counts?",
10
11
  },
11
12
 
12
13
  browse_group_categories: {
13
14
  autocomplete: "Enter a browse group title...",
14
15
  title: "Browse Group Categories",
15
- description: "This widget displays all browse categories associated with a selected browse group as a horizontally-scrolling row. Each selected browse group is displayed as a separate row. Each displayed category in a group links to the corresponding browse category results page.",
16
- item_counts: "Include category item counts?"
16
+ description:
17
+ "This widget displays all browse categories associated with a selected browse group as a horizontally-scrolling row. Each selected browse group is displayed as a separate row. Each displayed category in a group links to the corresponding browse category results page.",
18
+ item_counts: "Include category item counts?",
17
19
  },
18
20
 
19
21
  link_to_search: {
20
22
  title: "Saved Searches",
21
- description: "This widget highlights saved searches. Each highlighted saved search links to the search results page generated by the saved search parameters. Any saved search listed on the Curation > Browse categories page, whether published or not, can be highlighted as a saved search.",
22
- item_counts: "Include item counts?"
23
+ description:
24
+ "This widget highlights saved searches. Each highlighted saved search links to the search results page generated by the saved search parameters. Any saved search listed on the Curation > Browse categories page, whether published or not, can be highlighted as a saved search.",
25
+ item_counts: "Include item counts?",
23
26
  },
24
27
 
25
28
  iframe: {
26
- title: "IFrame",
29
+ title: "IFrame",
27
30
  description: "This widget embeds iframe-based embed code into pages",
28
- placeholder: "Enter embed code here. It should begin with e.g. '<iframe'"
31
+ placeholder: "Enter embed code here. It should begin with e.g. '<iframe'",
29
32
  },
30
33
 
31
34
  oembed: {
32
35
  title: "Embed + Text",
33
- description: "This widget embeds an oEmbed-supported web resource and a text block to the left or right of it. Examples of oEmbed-supported resources include those from YouTube, Twitter, Flickr, and SlideShare.",
36
+ description:
37
+ "This widget embeds an oEmbed-supported web resource and a text block to the left or right of it. Examples of oEmbed-supported resources include those from YouTube, Twitter, Flickr, and SlideShare.",
34
38
  url: "URL",
35
39
  },
36
40
 
37
41
  uploaded_items: {
38
42
  title: "Uploaded Item Row",
39
- description: "This widget displays uploaded items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items. The item caption and link URL fields are also optional.",
40
- caption: 'Caption',
41
- link: 'Link URL'
43
+ description:
44
+ "This widget displays uploaded items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items. The item caption and link URL fields are also optional.",
45
+ caption: "Caption",
46
+ link: "Link URL",
42
47
  },
43
48
 
44
49
  featured_pages: {
45
- title: "Pages",
46
- description: "This widget highlights pages from this exhibit. Each highlighted item links to the corresponding page."
50
+ title: "Pages",
51
+ description:
52
+ "This widget highlights pages from this exhibit. Each highlighted item links to the corresponding page.",
47
53
  },
48
54
 
49
55
  resources: {
50
56
  panel: {
51
57
  drag: "Drag",
52
58
  display: "Display?",
53
- remove: "Remove"
59
+ remove: "Remove",
54
60
  },
55
61
  alt_text: {
56
62
  decorative: "Decorative",
57
63
  alternative_text: "Alternative text",
58
- placeholder: "Enter alt text for this item..."
59
- }
64
+ placeholder: "Enter alt text for this item...",
65
+ },
60
66
  },
61
67
 
62
68
  rule: {
63
- title: "Horizontal Rule"
69
+ title: "Horizontal Rule",
64
70
  },
65
71
 
66
72
  search_results: {
67
73
  title: "Search Results",
68
- description: "This widget displays a set of search results on a page. Specify a search result set by selecting an existing browse category. You can also select the view types that are available to the user when viewing the result set."
74
+ description:
75
+ "This widget displays a set of search results on a page. Specify a search result set by selecting an existing browse category. You can also select the view types that are available to the user when viewing the result set.",
69
76
  },
70
77
 
71
78
  solr_documents: {
72
79
  title: "Item Row",
73
- description: "This widget displays exhibit items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items.",
80
+ description:
81
+ "This widget displays exhibit items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items.",
74
82
  caption: {
75
83
  placeholder: "Select...",
76
84
  primary: "Primary caption",
77
- secondary: "Secondary caption"
85
+ secondary: "Secondary caption",
78
86
  },
79
87
  zpr: {
80
- title: 'Offer "View larger" option'
81
- }
88
+ title: 'Offer "View larger" option',
89
+ },
82
90
  },
83
91
 
84
92
  solr_documents_carousel: {
85
93
  title: "Item Carousel",
86
- description: "This widget displays exhibit items in a carousel. You can configure the item captions, how the images are cycled, and the size of the carousel.",
94
+ description:
95
+ "This widget displays exhibit items in a carousel. You can configure the item captions, how the images are cycled, and the size of the carousel.",
87
96
  interval: {
88
97
  title: "Automatically cycle images",
89
- placeholder: "Select..."
98
+ placeholder: "Select...",
90
99
  },
91
100
  height: {
92
- title: "Maximum carousel height"
93
- }
101
+ title: "Maximum carousel height",
102
+ },
94
103
  },
95
104
 
96
105
  solr_documents_embed: {
97
106
  title: "Item Embed",
98
- description: "This widget embeds an exhibit item in a viewer on a page. Optionally, you can add a heading to be displayed above the viewer and/or text to be displayed adjacent to the viewer.",
107
+ description:
108
+ "This widget embeds an exhibit item in a viewer on a page. Optionally, you can add a heading to be displayed above the viewer and/or text to be displayed adjacent to the viewer.",
99
109
  },
100
110
 
101
111
  solr_documents_features: {
102
112
  title: "Item Slideshow",
103
- description: "This widget displays exhibit items in a static slideshow. The user will move between items in the slideshow using the field you select as the primary caption."
113
+ description:
114
+ "This widget displays exhibit items in a static slideshow. The user will move between items in the slideshow using the field you select as the primary caption.",
104
115
  },
105
116
 
106
117
  solr_documents_grid: {
107
118
  title: "Item Grid",
108
- description: "This widget displays exhibit items in a multi-row grid. Optionally, you can add a heading and/or text to be displayed adjacent to the items."
119
+ description:
120
+ "This widget displays exhibit items in a multi-row grid. Optionally, you can add a heading and/or text to be displayed adjacent to the items.",
109
121
  },
110
122
 
111
123
  textable: {
@@ -114,18 +126,19 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
114
126
  align: {
115
127
  title: "Display text on:",
116
128
  left: "Left",
117
- right: "Right"
118
- }
129
+ right: "Right",
130
+ },
119
131
  },
120
132
 
121
133
  group: {
122
134
  undefined: "Standard widgets",
123
- items: "Exhibit item widgets"
135
+ items: "Exhibit item widgets",
124
136
  },
125
137
 
126
138
  alt_text_guidelines: {
127
- intro: 'For each item, please enter alternative text or appropriately check the decorative box. ',
128
- link_label: 'Guidelines for writing alt text.',
129
- link_url: 'https://www.w3.org/WAI/tutorials/images/'
130
- }
131
- });
139
+ intro:
140
+ "For each item, please enter alternative text or appropriately check the decorative box. ",
141
+ link_label: "Guidelines for writing alt text.",
142
+ link_url: "https://www.w3.org/WAI/tutorials/images/",
143
+ },
144
+ })
@@ -1,11 +1,11 @@
1
- import Sortable from 'sortablejs';
1
+ import Sortable from "sortablejs"
2
2
 
3
- const Module = (function() {
4
- const nestableContainerSelector = '[data-behavior="nestable"]';
3
+ const Module = (function () {
4
+ const nestableContainerSelector = '[data-behavior="nestable"]'
5
5
  const sortableOptions = {
6
6
  animation: 150,
7
- draggable: '.dd-item',
8
- handle: '.dd-handle',
7
+ draggable: ".dd-item",
8
+ handle: ".dd-handle",
9
9
  fallbackOnBody: true,
10
10
  swapThreshold: 0.65,
11
11
  emptyInsertThreshold: 15,
@@ -13,56 +13,61 @@ const Module = (function() {
13
13
  onEnd: onEndHandler,
14
14
  onMove: onMoveHandler,
15
15
  }
16
- const draggableClass = 'dd-item';
17
- const nestedSortableClass = 'dd-list';
18
- const nestedSortableSelector = '.dd-list';
19
- const nestedSortableNodeName = 'ol';
20
- const findNode = (id, container) => container.querySelector(`[data-id="${id}"]`);
21
- const setWeight = (node, weight) => weightField(node).value = weight;
22
- const setParent = (node, parentId) => parentPageField(node).value = parentId;
23
- const weightField = node => findProperty(node, "weight");
24
- const parentPageField = node => findProperty(node, "parent_page");
25
- const findProperty = (node, property) => node.querySelector(`input[data-property="${property}"]`);
26
- let nestedId = 0;
16
+ const draggableClass = "dd-item"
17
+ const nestedSortableClass = "dd-list"
18
+ const nestedSortableSelector = ".dd-list"
19
+ const nestedSortableNodeName = "ol"
20
+ const findNode = (id, container) =>
21
+ container.querySelector(`[data-id="${id}"]`)
22
+ const setWeight = (node, weight) => (weightField(node).value = weight)
23
+ const setParent = (node, parentId) => (parentPageField(node).value = parentId)
24
+ const weightField = (node) => findProperty(node, "weight")
25
+ const parentPageField = (node) => findProperty(node, "parent_page")
26
+ const findProperty = (node, property) =>
27
+ node.querySelector(`input[data-property="${property}"]`)
28
+ let nestedId = 0
27
29
 
28
30
  return {
29
- init: function(nestedContainers) {
31
+ init: function (nestedContainers) {
30
32
  if (nestedContainers === undefined) {
31
- nestedContainers = document.querySelectorAll(nestableContainerSelector);
33
+ nestedContainers = document.querySelectorAll(nestableContainerSelector)
32
34
  }
33
35
 
34
36
  // nestedContainers could be a jQuery selector result, normalize to an array.
35
- const containersToInit = Array.from(nestedContainers);
37
+ const containersToInit = Array.from(nestedContainers)
36
38
  containersToInit.forEach((container) => {
37
39
  // Sir Trevor listens for drag and drop events and will error on Sortable events.
38
40
  // Don't let them bubble past the Sortable wrapper.
39
- container.addEventListener('drop', stopPropagationHandler);
40
-
41
+ container.addEventListener("drop", stopPropagationHandler)
42
+
41
43
  const nestedSortables = [
42
44
  ...(container.matches(nestedSortableSelector) ? [container] : []),
43
- ...Array.from(container.querySelectorAll(nestedSortableSelector))
44
- ];
45
- const group = `nested-${nestedId++}`;
46
-
47
- nestedSortables.forEach(sortable => {
48
- new Sortable(sortable, { ...sortableOptions, group: group });
49
- });
50
- });
51
- }
52
- };
45
+ ...Array.from(container.querySelectorAll(nestedSortableSelector)),
46
+ ]
47
+ const group = `nested-${nestedId++}`
48
+
49
+ nestedSortables.forEach((sortable) => {
50
+ new Sortable(sortable, { ...sortableOptions, group: group })
51
+ })
52
+ })
53
+ },
54
+ }
53
55
 
54
56
  function stopPropagationHandler(evt) {
55
- evt.stopPropagation();
57
+ evt.stopPropagation()
56
58
  }
57
59
 
58
60
  function onStartHandler(evt) {
59
- makeEmptyChildSortablesForEligibleParents(getNestableContainer(evt.item), getMaxNestingLevelSetting(evt.item));
61
+ makeEmptyChildSortablesForEligibleParents(
62
+ getNestableContainer(evt.item),
63
+ getMaxNestingLevelSetting(evt.item),
64
+ )
60
65
  }
61
66
 
62
67
  function onEndHandler(evt) {
63
- const nestableContainer = getNestableContainer(evt.item);
64
- removeEmptySortables(nestableContainer);
65
- updateWeightsAndRelationships(nestableContainer);
68
+ const nestableContainer = getNestableContainer(evt.item)
69
+ removeEmptySortables(nestableContainer)
70
+ updateWeightsAndRelationships(nestableContainer)
66
71
  }
67
72
 
68
73
  function onMoveHandler(evt) {
@@ -70,122 +75,139 @@ const Module = (function() {
70
75
  // E.g., data-max-depth=2 allows for one level of nesting.
71
76
  // evt.dragged is a draggable in a Sortable (e.g., a dd-item)
72
77
  // evt.to is the Sortable to insert into (e.g., a dd-list)
73
- const maxAllowedDepth = getMaxNestingLevelSetting(evt.to) - 1;
74
- const newDepth = getSortableDepth(evt.to) + getHeight(evt.dragged);
78
+ const maxAllowedDepth = getMaxNestingLevelSetting(evt.to) - 1
79
+ const newDepth = getSortableDepth(evt.to) + getHeight(evt.dragged)
75
80
 
76
81
  // Be careful here. Returning true is different than returning nothing in SortableJS.
77
82
  if (newDepth > maxAllowedDepth) {
78
- return false;
83
+ return false
79
84
  }
80
85
  }
81
86
 
82
87
  // Get the depth of the sortable element from the root container
83
88
  function getSortableDepth(sortableElement) {
84
- const originatingGroup = Sortable.get(sortableElement).options.group.name;
85
- let depth = 0;
86
- let parentSortableElement = sortableElement;
87
-
88
- while ((parentSortableElement = parentSortableElement.parentElement.closest(nestedSortableSelector))) {
89
- const parentSortable = Sortable.get(parentSortableElement);
89
+ const originatingGroup = Sortable.get(sortableElement).options.group.name
90
+ let depth = 0
91
+ let parentSortableElement = sortableElement
92
+
93
+ while (
94
+ (parentSortableElement = parentSortableElement.parentElement.closest(
95
+ nestedSortableSelector,
96
+ ))
97
+ ) {
98
+ const parentSortable = Sortable.get(parentSortableElement)
90
99
  if (parentSortable?.options.group.name === originatingGroup) {
91
- depth++;
100
+ depth++
92
101
  }
93
102
  }
94
103
 
95
- return depth;
104
+ return depth
96
105
  }
97
106
 
98
107
  // Find the max child depth in the tree, starting from the draggableElement
99
108
  function findMaxDepth(draggableElement) {
100
- const childSortableElement = draggableElement.querySelector(nestedSortableSelector);
109
+ const childSortableElement = draggableElement.querySelector(
110
+ nestedSortableSelector,
111
+ )
101
112
  if (!childSortableElement) {
102
- return 1;
113
+ return 1
103
114
  }
104
115
 
105
- const children = childSortableElement.querySelectorAll(`.${draggableClass}`);
106
- const childDepths = Array.from(children).map(findMaxDepth);
107
- return 1 + Math.max(0, ...childDepths);
116
+ const children = childSortableElement.querySelectorAll(`.${draggableClass}`)
117
+ const childDepths = Array.from(children).map(findMaxDepth)
118
+ return 1 + Math.max(0, ...childDepths)
108
119
  }
109
120
 
110
121
  function getHeight(draggableElement) {
111
- return findMaxDepth(draggableElement) - 1;
122
+ return findMaxDepth(draggableElement) - 1
112
123
  }
113
124
 
114
125
  function getNestableContainer(element) {
115
- return element.closest(nestableContainerSelector);
126
+ return element.closest(nestableContainerSelector)
116
127
  }
117
128
 
118
129
  function getMaxNestingLevelSetting(element) {
119
- return getNestableContainer(element).getAttribute('data-max-depth') || 1;
130
+ return getNestableContainer(element).getAttribute("data-max-depth") || 1
120
131
  }
121
132
 
122
133
  // Create empty child sortables for all potential parents as appropriate for the given nesting level
123
134
  function makeEmptyChildSortablesForEligibleParents(container, nestingLevel) {
124
135
  if (nestingLevel <= 1) {
125
- return;
136
+ return
126
137
  }
127
138
 
128
- const sortableElement = container.querySelector(nestedSortableSelector);
129
- const sortable = Sortable.get(sortableElement);
139
+ const sortableElement = container.querySelector(nestedSortableSelector)
140
+ const sortable = Sortable.get(sortableElement)
130
141
  if (!sortable) {
131
- return;
142
+ return
132
143
  }
133
144
 
134
- const group = sortable.options.group.name;
135
- const draggableElements = Array.from(sortableElement.children)
136
- .filter(child => child.classList.contains(draggableClass));
145
+ const group = sortable.options.group.name
146
+ const draggableElements = Array.from(sortableElement.children).filter(
147
+ (child) => child.classList.contains(draggableClass),
148
+ )
137
149
 
138
- draggableElements.forEach(draggableElement => {
150
+ draggableElements.forEach((draggableElement) => {
139
151
  if (!draggableElement.querySelector(nestedSortableSelector)) {
140
- const emptySortableElement = document.createElement(nestedSortableNodeName);
141
- emptySortableElement.className = nestedSortableClass;
142
- draggableElement.appendChild(emptySortableElement);
143
- new Sortable(emptySortableElement, { ...sortableOptions, group: group });
152
+ const emptySortableElement = document.createElement(
153
+ nestedSortableNodeName,
154
+ )
155
+ emptySortableElement.className = nestedSortableClass
156
+ draggableElement.appendChild(emptySortableElement)
157
+ new Sortable(emptySortableElement, {
158
+ ...sortableOptions,
159
+ group: group,
160
+ })
144
161
  }
145
- makeEmptyChildSortablesForEligibleParents(draggableElement, nestingLevel - 1);
146
- });
162
+ makeEmptyChildSortablesForEligibleParents(
163
+ draggableElement,
164
+ nestingLevel - 1,
165
+ )
166
+ })
147
167
  }
148
168
 
149
169
  // Remove any empty sortables within the container. They could be empty lists, which are invalid for accessibility.
150
170
  function removeEmptySortables(container) {
151
- const sortableElements = container.querySelectorAll(nestedSortableSelector);
152
- sortableElements.forEach(sortableElement => {
153
- if (sortableElement.innerHTML.trim() === '') {
154
- const sortable = Sortable.get(sortableElement);
171
+ const sortableElements = container.querySelectorAll(nestedSortableSelector)
172
+ sortableElements.forEach((sortableElement) => {
173
+ if (sortableElement.innerHTML.trim() === "") {
174
+ const sortable = Sortable.get(sortableElement)
155
175
  if (sortable) {
156
- sortable.destroy();
157
- sortableElement.remove();
176
+ sortable.destroy()
177
+ sortableElement.remove()
158
178
  }
159
179
  }
160
- });
180
+ })
161
181
  }
162
182
 
163
183
  // Traverse all sortables within a container and update the weight and parent_page inputs
164
184
  function updateWeightsAndRelationships(container) {
165
- const sortableElement = container.matches(nestedSortableSelector) ? container : container.querySelector(nestedSortableSelector);
166
- const nestingLevelSetting = getMaxNestingLevelSetting(sortableElement);
167
- const sortable = Sortable.get(sortableElement);
168
- const stack = [{nodes: sortable.toArray(), parentId: ''}];
169
- let weight = 0;
185
+ const sortableElement = container.matches(nestedSortableSelector)
186
+ ? container
187
+ : container.querySelector(nestedSortableSelector)
188
+ const nestingLevelSetting = getMaxNestingLevelSetting(sortableElement)
189
+ const sortable = Sortable.get(sortableElement)
190
+ const stack = [{ nodes: sortable.toArray(), parentId: "" }]
191
+ let weight = 0
170
192
 
171
193
  while (stack.length > 0) {
172
- const {nodes, parentId} = stack.pop();
194
+ const { nodes, parentId } = stack.pop()
173
195
 
174
196
  nodes.forEach((nodeId) => {
175
- const node = findNode(nodeId, container);
176
- setWeight(node, weight++);
197
+ const node = findNode(nodeId, container)
198
+ setWeight(node, weight++)
177
199
 
178
200
  if (nestingLevelSetting > 1) {
179
- setParent(node, parentId);
180
- const children = node.querySelector(nestedSortableSelector);
201
+ setParent(node, parentId)
202
+ const children = node.querySelector(nestedSortableSelector)
181
203
  if (children) {
182
- const sortableElement = Sortable.get(children);
183
- stack.push({nodes: sortableElement.toArray(), parentId: nodeId});
204
+ const sortableElement = Sortable.get(children)
205
+ stack.push({ nodes: sortableElement.toArray(), parentId: nodeId })
184
206
  }
185
207
  }
186
- });
208
+ })
187
209
  }
188
210
  }
189
- })();
211
+ })()
190
212
 
191
213
  export default Module
@@ -1,8 +1,21 @@
1
+ import bootstrap from "bootstrap"
2
+
1
3
  export default class {
2
4
  connect() {
3
- if ($('[role=tabpanel]').length > 0 && window.location.hash) {
4
- var tabpanel = $(window.location.hash).closest('[role=tabpanel]');
5
- $('a[role=tab][href="#'+tabpanel.attr('id')+'"]').tab('show');
5
+ if (document.querySelector("[role=tabpanel]") && window.location.hash) {
6
+ const targetId = window.location.hash.substring(1)
7
+ const targetElement = document.getElementById(targetId)
8
+ if (!targetElement) return
9
+
10
+ const tabpanel = targetElement.closest("[role=tabpanel]")
11
+ if (!tabpanel) return
12
+
13
+ const tabElement = document.querySelector(
14
+ `a[role=tab][href="#${tabpanel.id}"]`,
15
+ )
16
+ if (!tabElement) return
17
+
18
+ bootstrap.Tab.getOrCreateInstance(tabElement).show()
6
19
  }
7
20
  }
8
21
  }
@@ -4,13 +4,19 @@
4
4
  // present (indicated by data attributes) in each tab's content
5
5
  export default class {
6
6
  connect() {
7
- $('[data-behavior="translation-progress"]').each(function(){
8
- var currentTab = $(this);
9
- var tabName = $(this).attr('aria-controls');
10
- var translationFields = $('#' + tabName).find('[data-translation-progress-item="true"]');
11
- var completedTranslations = $('#' + tabName).find('[data-translation-present="true"]');
7
+ $('[data-behavior="translation-progress"]').each(function () {
8
+ var currentTab = $(this)
9
+ var tabName = $(this).attr("aria-controls")
10
+ var translationFields = $("#" + tabName).find(
11
+ '[data-translation-progress-item="true"]',
12
+ )
13
+ var completedTranslations = $("#" + tabName).find(
14
+ '[data-translation-present="true"]',
15
+ )
12
16
 
13
- currentTab.find('span').text(completedTranslations.length + '/' + translationFields.length);
17
+ currentTab
18
+ .find("span")
19
+ .text(completedTranslations.length + "/" + translationFields.length)
14
20
  })
15
21
  }
16
- }
22
+ }