blacklight-spotlight 5.3.0 → 5.3.2

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/app/assets/javascripts/spotlight/spotlight.esm.js +1696 -1229
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  5. data/app/assets/javascripts/spotlight/spotlight.js +1718 -1232
  6. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  7. data/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +1 -10
  8. data/app/assets/stylesheets/spotlight/_nestable.scss +18 -1
  9. data/app/assets/stylesheets/spotlight/_pages.scss +3 -3
  10. data/app/components/spotlight/analytics/aggregation_component.html.erb +1 -1
  11. data/app/components/spotlight/document_admin_table_component.html.erb +2 -2
  12. data/app/components/spotlight/edit_view_links_component.html.erb +1 -1
  13. data/app/components/spotlight/header_component.html.erb +1 -1
  14. data/app/components/spotlight/tag_list_form_component.html.erb +1 -1
  15. data/app/components/spotlight/tag_selector_component.html.erb +2 -2
  16. data/app/components/spotlight/translations/subheading_component.html.erb +1 -1
  17. data/app/controllers/spotlight/resources_controller.rb +1 -1
  18. data/app/javascript/spotlight/admin/add_another.js +22 -15
  19. data/app/javascript/spotlight/admin/add_image_selector.js +27 -25
  20. data/app/javascript/spotlight/admin/add_new_button.js +47 -43
  21. data/app/javascript/spotlight/admin/blacklight_configuration.js +52 -38
  22. data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +68 -60
  23. data/app/javascript/spotlight/admin/block_mixins/formable.js +55 -47
  24. data/app/javascript/spotlight/admin/block_mixins/plustextable.js +19 -20
  25. data/app/javascript/spotlight/admin/blocks/block.js +20 -16
  26. data/app/javascript/spotlight/admin/blocks/browse_block.js +42 -37
  27. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +33 -31
  28. data/app/javascript/spotlight/admin/blocks/iframe_block.js +14 -11
  29. data/app/javascript/spotlight/admin/blocks/link_to_search_block.js +4 -7
  30. data/app/javascript/spotlight/admin/blocks/oembed_block.js +13 -10
  31. data/app/javascript/spotlight/admin/blocks/pages_block.js +20 -13
  32. data/app/javascript/spotlight/admin/blocks/resources_block.js +150 -117
  33. data/app/javascript/spotlight/admin/blocks/rule_block.js +11 -10
  34. data/app/javascript/spotlight/admin/blocks/search_result_block.js +16 -17
  35. data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +123 -64
  36. data/app/javascript/spotlight/admin/blocks/solr_documents_block.js +8 -8
  37. data/app/javascript/spotlight/admin/blocks/solr_documents_carousel_block.js +63 -43
  38. data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +9 -9
  39. data/app/javascript/spotlight/admin/blocks/solr_documents_features_block.js +17 -16
  40. data/app/javascript/spotlight/admin/blocks/solr_documents_grid_block.js +6 -7
  41. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +84 -64
  42. data/app/javascript/spotlight/admin/crop.js +203 -156
  43. data/app/javascript/spotlight/admin/croppable.js +4 -4
  44. data/app/javascript/spotlight/admin/croppable_modal.js +59 -37
  45. data/app/javascript/spotlight/admin/edit_in_place.js +50 -47
  46. data/app/javascript/spotlight/admin/exhibits.js +52 -41
  47. data/app/javascript/spotlight/admin/form_observer.js +59 -53
  48. data/app/javascript/spotlight/admin/iiif.js +26 -25
  49. data/app/javascript/spotlight/admin/index.js +44 -47
  50. data/app/javascript/spotlight/admin/locks.js +14 -14
  51. data/app/javascript/spotlight/admin/multi_image_selector.js +127 -111
  52. data/app/javascript/spotlight/admin/pages.js +21 -21
  53. data/app/javascript/spotlight/admin/progress_monitor.js +67 -65
  54. data/app/javascript/spotlight/admin/readonly_checkbox.js +3 -3
  55. data/app/javascript/spotlight/admin/search_typeahead.js +55 -43
  56. data/app/javascript/spotlight/admin/select_related_input.js +17 -17
  57. data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +100 -84
  58. data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +36 -31
  59. data/app/javascript/spotlight/admin/sir-trevor/locales.js +52 -39
  60. data/app/javascript/spotlight/admin/spotlight_nestable.js +126 -91
  61. data/app/javascript/spotlight/admin/tabs.js +19 -3
  62. data/app/javascript/spotlight/admin/translation_progress.js +13 -7
  63. data/app/javascript/spotlight/admin/users.js +41 -41
  64. data/app/javascript/spotlight/admin/visibility_toggle.js +4 -4
  65. data/app/javascript/spotlight/controllers/clipboard_controller.js +14 -0
  66. data/app/javascript/spotlight/controllers/index.js +4 -2
  67. data/app/javascript/spotlight/controllers/tag_selector_controller.js +116 -79
  68. data/app/javascript/spotlight/core.js +18 -15
  69. data/app/javascript/spotlight/index.js +4 -4
  70. data/app/javascript/spotlight/user/browse_group_categories.js +24 -22
  71. data/app/javascript/spotlight/user/carousel.js +23 -19
  72. data/app/javascript/spotlight/user/clear_form_button.js +15 -15
  73. data/app/javascript/spotlight/user/index.js +4 -4
  74. data/app/javascript/spotlight/user/zpr_links.js +18 -18
  75. data/app/models/spotlight/analytics/ga.rb +0 -1
  76. data/app/models/spotlight/resources/iiif_manifest_v3.rb +2 -2
  77. data/app/services/spotlight/exhibit_import_export_service.rb +0 -2
  78. data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
  79. data/app/views/catalog/_remove_tags.html.erb +1 -1
  80. data/app/views/layouts/spotlight/base.html.erb +1 -1
  81. data/app/views/shared/_header_navbar.html.erb +1 -1
  82. data/app/views/shared/_masthead.html.erb +2 -2
  83. data/app/views/shared/_site_sidebar.html.erb +1 -1
  84. data/app/views/shared/_user_util_links.html.erb +2 -2
  85. data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
  86. data/app/views/spotlight/accessibility/alt_text.html.erb +1 -1
  87. data/app/views/spotlight/admin_users/index.html.erb +11 -9
  88. data/app/views/spotlight/appearances/edit.html.erb +1 -1
  89. data/app/views/spotlight/browse/_search_box.html.erb +1 -1
  90. data/app/views/spotlight/bulk_updates/_download.html.erb +1 -1
  91. data/app/views/spotlight/bulk_updates/_progress_panel.html.erb +6 -6
  92. data/app/views/spotlight/bulk_updates/edit.html.erb +1 -1
  93. data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
  94. data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -1
  95. data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
  96. data/app/views/spotlight/catalog/_document.html.erb +2 -2
  97. data/app/views/spotlight/catalog/_document_admin_table.html.erb +1 -1
  98. data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
  99. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
  100. data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +6 -6
  101. data/app/views/spotlight/catalog/select_image.html.erb +1 -1
  102. data/app/views/spotlight/contact_mailer/report_problem.html.erb +2 -2
  103. data/app/views/spotlight/exhibits/_contact.html.erb +2 -2
  104. data/app/views/spotlight/exhibits/_delete.html.erb +2 -2
  105. data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
  106. data/app/views/spotlight/exhibits/_export.html.erb +1 -1
  107. data/app/views/spotlight/exhibits/_form.html.erb +2 -2
  108. data/app/views/spotlight/exhibits/_languages.html.erb +7 -7
  109. data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
  110. data/app/views/spotlight/locks/_lock.html.erb +2 -2
  111. data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
  112. data/app/views/spotlight/pages/_order_pages.html.erb +3 -3
  113. data/app/views/spotlight/pages/preview.html.erb +1 -1
  114. data/app/views/spotlight/pages/show.html.erb +2 -2
  115. data/app/views/spotlight/resources/_form.html.erb +1 -1
  116. data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
  117. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  118. data/app/views/spotlight/roles/index.html.erb +5 -5
  119. data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
  120. data/app/views/spotlight/search_configurations/edit.html.erb +1 -1
  121. data/app/views/spotlight/searches/index.html.erb +2 -2
  122. data/app/views/spotlight/shared/_configuration_sidebar.html.erb +1 -1
  123. data/app/views/spotlight/shared/_curation_sidebar.html.erb +1 -1
  124. data/app/views/spotlight/shared/_dd3_item.html.erb +1 -1
  125. data/app/views/spotlight/sir_trevor/_sir_trevor_block_array.html.erb +1 -1
  126. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
  127. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +1 -1
  128. data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +2 -2
  129. data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
  130. data/app/views/spotlight/sir_trevor/blocks/_rule_block.html.erb +1 -1
  131. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -1
  132. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +1 -1
  133. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +1 -1
  134. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
  135. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +1 -1
  136. data/app/views/spotlight/sites/edit_exhibits.html.erb +3 -3
  137. data/app/views/spotlight/translations/_browse_categories.html.erb +2 -2
  138. data/app/views/spotlight/translations/_general.html.erb +21 -21
  139. data/app/views/spotlight/translations/_groups.html.erb +1 -1
  140. data/app/views/spotlight/translations/_metadata.html.erb +8 -8
  141. data/app/views/spotlight/translations/_pages_table.html.erb +2 -2
  142. data/app/views/spotlight/translations/_search_fields.html.erb +13 -13
  143. data/app/views/spotlight/translations/edit.html.erb +5 -5
  144. data/config/importmap.rb +0 -1
  145. data/lib/generators/spotlight/assets/propshaft_generator.rb +0 -1
  146. data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -31
  147. data/lib/spotlight/version.rb +1 -1
  148. data/spec/factories/contact_images.rb +1 -1
  149. data/spec/factories/exhibit_thumbnails.rb +1 -1
  150. data/spec/factories/featured_images.rb +1 -1
  151. data/spec/support/features/test_features_helpers.rb +41 -1
  152. metadata +4 -61
  153. data/app/javascript/spotlight/admin/copy_email_addresses.js +0 -7
  154. data/vendor/assets/javascripts/jquery.waitforimages.min.js +0 -2
@@ -1,8 +1,4 @@
1
1
  .spotlight-flexbox {
2
- display: -webkit-box;
3
- display: -moz-box;
4
- display: -ms-flexbox;
5
- display: -webkit-flex;
6
2
  display: flex;
7
3
  flex-flow: row wrap;
8
4
 
@@ -13,7 +9,7 @@
13
9
 
14
10
  @media (max-width: breakpoint-max("sm")) {
15
11
  min-width: 200px;
16
- -webkit-flex: 1 1 200px;
12
+ flex: 1 1 200px;
17
13
  }
18
14
 
19
15
  .caption {
@@ -23,11 +19,6 @@
23
19
  img {
24
20
  max-width: 100%;
25
21
  }
26
- -webkit-box-flex: 1;
27
- -moz-box-flex: 1;
28
- -webkit-flex: 1;
29
- -ms-flex: 1;
30
22
  flex: 1;
31
- -webkit-flex: 1 1 125px;
32
23
  }
33
24
  }
@@ -26,10 +26,27 @@ tr.dd-item {
26
26
  position: relative;
27
27
  }
28
28
 
29
+ // SortableJS moves an item to the start of a list when the pointer is over the list more than
30
+ // 10px left of its items.
31
+ $dd-nested-list-padding-left: 5px;
32
+
29
33
  .dd-list { display: block; position: relative; margin: 0; padding: 0 0 5px 0; list-style: none; }
30
- .dd-list .dd-list { margin-left: 15px; padding-left: 15px; padding-bottom: 0; } // Having this mix of padding and margin improves the experience of dragging left to remove an item from a nested list.
34
+ .dd-list .dd-list { margin-left: 25px; padding-left: $dd-nested-list-padding-left; padding-bottom: 0; }
31
35
  .dd-collapsed .dd-list { display: none; }
32
36
 
37
+ // While a drag is in progress, extend each child list with a drop zone that covers the
38
+ // indented part of the next item. Dragging an item to the right then nests it.
39
+ .dd-nesting .dd-item > .dd-list::after {
40
+ content: "";
41
+ position: absolute;
42
+ top: 100%;
43
+ left: $dd-nested-list-padding-left; // Offset from the child list's padding box, so the zone starts where its items start
44
+ right: 0;
45
+ height: var(--dd-nesting-zone-height);
46
+ z-index: 1;
47
+ }
48
+ .dd-nesting .sortable-chosen > .dd-list::after { display: none; }
49
+
33
50
  .dd-item,
34
51
  .dd-empty,
35
52
  .dd-placeholder { display: block; position: relative; margin: 0; padding: 0; min-height: 20px; font-size: 13px; line-height: 20px; }
@@ -237,14 +237,14 @@
237
237
 
238
238
  .box {
239
239
  min-width: 150px;
240
- -webkit-flex: 1 1 150px;
240
+ flex: 1 1 150px;
241
241
  }
242
242
 
243
243
  /* two items */
244
244
  .box:first-child:nth-last-child(2),
245
245
  .box:first-child:nth-last-child(2) ~ .box {
246
246
  min-width: 250px;
247
- -webkit-flex: 1 1 250px;
247
+ flex: 1 1 250px;
248
248
  }
249
249
 
250
250
  /* only images, no text */
@@ -260,7 +260,7 @@
260
260
  }
261
261
 
262
262
  @media (max-width: breakpoint-max("md")) {
263
- -webkit-flex: 1 1 175px;
263
+ flex: 1 1 175px;
264
264
  }
265
265
  }
266
266
  }
@@ -11,4 +11,4 @@
11
11
  <% end %>
12
12
  </tr>
13
13
  </tfoot>
14
- </table>
14
+ </table>
@@ -8,7 +8,7 @@
8
8
  itemscope: true,
9
9
  itemtype: @document.itemtype,
10
10
  class: classes.flatten.join(' ') do %>
11
- <% # header bar for doc items in index view -%>
11
+ <%# header bar for doc items in index view -%>
12
12
  <td class="spotlight-admin-thumbnail">
13
13
  <%= thumbnail %>
14
14
  </td>
@@ -31,6 +31,6 @@
31
31
  </td>
32
32
 
33
33
  <td class="checkbox-toggle">
34
- <%= render partial: 'document_visibility_control', locals: { document: presenter.document} %>
34
+ <%= helpers.render partial: 'document_visibility_control', locals: { document: presenter.document} %>
35
35
  </td>
36
36
  <% end %>
@@ -10,4 +10,4 @@
10
10
  <% if delete_link %>
11
11
  &middot; <%= helpers.exhibit_delete_link page %>
12
12
  <% end %>
13
- </div>
13
+ </div>
@@ -1 +1 @@
1
- <%= top_bar %>
1
+ <%= top_bar %>
@@ -11,4 +11,4 @@
11
11
  </div>
12
12
  <% else %>
13
13
  <%= form.text_field :tag_list, value: form.object.tag_list.to_s %>
14
- <% end %>
14
+ <% end %>
@@ -5,8 +5,8 @@
5
5
  <%= form.text_field field_name, value: selected_tags_value, class: 'tag-selector-input', placeholder: t('.no_js_placeholder'), data: { tag_selector_target: "tagsField" } %>
6
6
  <% end %>
7
7
  <input type="hidden" value="<%= selected_tags_value %>" data-tag-selector-target="initialTags">
8
-
9
- <div class='mb-3'>
8
+
9
+ <div class="mb-3">
10
10
  <div class="tag-selection-wrapper" data-tag-selector-target="tagControlWrapper">
11
11
  <div class="dropdown w-100 mb-3 d-inline-block" data-action="click@window->tag-selector#clickOutside">
12
12
  <div data-tag-selector-target="tagSearchDropdown">
@@ -1,3 +1,3 @@
1
- <h2 class='translation-subheading mt-4'>
1
+ <h2 class="translation-subheading mt-4">
2
2
  <%= text %>
3
3
  </h2>
@@ -55,7 +55,7 @@ module Spotlight
55
55
 
56
56
  def resource_params
57
57
  params.require(:resource).tap { |x| x['type'] ||= resource_class.name }
58
- .permit(:url, :type, *resource_class.stored_attributes[:data], data: params[:resource][:data].try(:keys))
58
+ .permit(:url, :type, *resource_class.stored_attributes[:data], data: params[:resource][:data].try(:keys))
59
59
  end
60
60
  end
61
61
  end
@@ -1,24 +1,31 @@
1
1
  export default class {
2
2
  connect() {
3
- $("[data-action='add-another']").on("click", function(event) {
4
- event.preventDefault();
3
+ $("[data-action='add-another']").on("click", function (event) {
4
+ event.preventDefault()
5
5
 
6
- var templateId = $(this).data('template-id');
6
+ var templateId = $(this).data("template-id")
7
7
 
8
- var template = document.querySelector('#' + templateId);
9
- var clone = document.importNode(template.content, true);
8
+ var template = document.querySelector("#" + templateId)
9
+ var clone = document.importNode(template.content, true)
10
10
 
11
- var count = $(this).closest('.form-group').find('[name="' + $(clone).find('[name]').attr('name') + '"]').length + 1;
12
- $(clone).find('[id]').each(function(index, el) {
13
- $(el).attr('id', $(el).attr('id') + '_' + String(count));
14
- });
11
+ var count =
12
+ $(this)
13
+ .closest(".form-group")
14
+ .find('[name="' + $(clone).find("[name]").attr("name") + '"]')
15
+ .length + 1
16
+ $(clone)
17
+ .find("[id]")
18
+ .each(function (index, el) {
19
+ $(el).attr("id", $(el).attr("id") + "_" + String(count))
20
+ })
15
21
 
16
- $(clone).find('[for]').each(function(index, el) {
17
- $(el).attr('for', $(el).attr('for') + '_' + String(count));
18
- });
22
+ $(clone)
23
+ .find("[for]")
24
+ .each(function (index, el) {
25
+ $(el).attr("for", $(el).attr("for") + "_" + String(count))
26
+ })
19
27
 
20
-
21
- $(clone).insertBefore(this);
22
- });
28
+ $(clone).insertBefore(this)
29
+ })
23
30
  }
24
31
  }
@@ -1,38 +1,40 @@
1
- import Iiif from 'spotlight/admin/iiif'
1
+ import Iiif from "spotlight/admin/iiif"
2
2
 
3
3
  export function addImageSelector(input, panel, manifestUrl, initialize) {
4
4
  if (!manifestUrl) {
5
- showNonIiifAlert(input);
6
- return;
5
+ showNonIiifAlert(input)
6
+ return
7
7
  }
8
- var cropper = input.data('iiifCropper');
9
- $.ajax(manifestUrl).done(
10
- function(manifest) {
11
- var iiifManifest = new Iiif(manifestUrl, manifest);
8
+ var cropper = input.data("iiifCropper")
9
+ $.ajax(manifestUrl).done(function (manifest) {
10
+ var iiifManifest = new Iiif(manifestUrl, manifest)
12
11
 
13
- var thumbs = iiifManifest.imagesArray();
12
+ var thumbs = iiifManifest.imagesArray()
14
13
 
15
- hideNonIiifAlert(input);
14
+ hideNonIiifAlert(input)
16
15
 
17
- if (initialize) {
18
- cropper.setIiifFields(thumbs[0]);
19
- panel.multiImageSelector(); // Clears out existing selector
20
- }
16
+ if (initialize) {
17
+ cropper.setIiifFields(thumbs[0])
18
+ panel.multiImageSelector() // Clears out existing selector
19
+ }
21
20
 
22
- if(thumbs.length > 1) {
23
- panel.show();
24
- panel.multiImageSelector(thumbs, function(selectorImage) {
25
- cropper.setIiifFields(selectorImage);
26
- }, cropper.iiifImageField.val());
27
- }
21
+ if (thumbs.length > 1) {
22
+ panel.show()
23
+ panel.multiImageSelector(
24
+ thumbs,
25
+ function (selectorImage) {
26
+ cropper.setIiifFields(selectorImage)
27
+ },
28
+ cropper.iiifImageField.val(),
29
+ )
28
30
  }
29
- );
31
+ })
30
32
  }
31
33
 
32
- function showNonIiifAlert(input){
33
- input.parent().prev('[data-behavior="non-iiif-alert"]').show();
34
+ function showNonIiifAlert(input) {
35
+ input.parent().prev('[data-behavior="non-iiif-alert"]').show()
34
36
  }
35
37
 
36
- function hideNonIiifAlert(input){
37
- input.parent().prev('[data-behavior="non-iiif-alert"]').hide();
38
- }
38
+ function hideNonIiifAlert(input) {
39
+ input.parent().prev('[data-behavior="non-iiif-alert"]').hide()
40
+ }
@@ -1,77 +1,81 @@
1
1
  export default class {
2
2
  connect() {
3
- $("[data-expanded-add-button]").each((_i, el) => this.addExpandBehaviorToButton($(el)))
3
+ $("[data-expanded-add-button]").each((_i, el) =>
4
+ this.addExpandBehaviorToButton($(el)),
5
+ )
4
6
  }
5
7
 
6
- addExpandBehaviorToButton(button){
8
+ addExpandBehaviorToButton(button) {
7
9
  var settings = {
8
- speed: (button.data('speed') || 450),
9
- animate_width: (button.data('animate_width') || 425)
10
+ speed: button.data("speed") || 450,
11
+ animate_width: button.data("animate_width") || 425,
10
12
  }
11
- var target = $(button.data('field-target'));
12
- var save = $("input[data-behavior='save']", target);
13
- var cancel = $("input[data-behavior='cancel']", target);
14
- var input = $("input[type='text']", target);
15
- var original_width = button.outerWidth();
16
- var expanded = false;
13
+ var target = $(button.data("field-target"))
14
+ var save = $("input[data-behavior='save']", target)
15
+ var cancel = $("input[data-behavior='cancel']", target)
16
+ var input = $("input[type='text']", target)
17
+ var original_width = button.outerWidth()
18
+ var expanded = false
17
19
 
18
20
  // Animate button open when the mouse enters or
19
21
  // the button is given focus (i.e. clicked/tabbed)
20
- button.on("mouseenter focus", function(){
21
- expandButton();
22
- });
22
+ button.on("mouseenter focus", function () {
23
+ expandButton()
24
+ })
23
25
 
24
26
  // Don't allow blank titles
25
- save.on('click', function(){
26
- if ( inputEmpty() ) {
27
- return false;
27
+ save.on("click", function () {
28
+ if (inputEmpty()) {
29
+ return false
28
30
  }
29
- });
31
+ })
30
32
 
31
33
  // Empty input and collapse
32
34
  // button on cancel click
33
- cancel.on('click', function(e){
34
- e.preventDefault();
35
- input.val('');
36
- collapseButton();
37
- });
35
+ cancel.on("click", function (e) {
36
+ e.preventDefault()
37
+ input.val("")
38
+ collapseButton()
39
+ })
38
40
 
39
41
  // Collapse the button on when
40
42
  // an empty input loses focus
41
- input.on("blur", function(){
42
- if ( inputEmpty() ) {
43
- collapseButton();
43
+ input.on("blur", function () {
44
+ if (inputEmpty()) {
45
+ collapseButton()
44
46
  }
45
- });
46
- function expandButton(){
47
- // If this has not yet been expanded, recalculate original_width to
47
+ })
48
+ function expandButton() {
49
+ // If this has not yet been expanded, recalculate original_width to
48
50
  // handle things that may have been originally hidden.
49
51
  if (!expanded) {
50
- original_width = button.outerWidth();
52
+ original_width = button.outerWidth()
51
53
  }
52
- if(button.outerWidth() <= (original_width + 5)) {
53
- expanded = true;
54
+ if (button.outerWidth() <= original_width + 5) {
55
+ expanded = true
54
56
  button.animate(
55
- {width: settings.animate_width + 'px'}, settings.speed, function(){
56
- target.show(0, function(){
57
- input.focus();
57
+ { width: settings.animate_width + "px" },
58
+ settings.speed,
59
+ function () {
60
+ target.show(0, function () {
61
+ input.focus()
58
62
  // Set the button to auto width to make
59
63
  // sure it has room for any inputs
60
- button.width("auto");
64
+ button.width("auto")
61
65
  // Explicitly set the width of the button
62
66
  // so the close animation works properly
63
- button.width(button.width());
64
- });
65
- }
67
+ button.width(button.width())
68
+ })
69
+ },
66
70
  )
67
71
  }
68
72
  }
69
- function collapseButton(){
70
- target.hide();
71
- button.animate({width: original_width + 'px'}, settings.speed);
73
+ function collapseButton() {
74
+ target.hide()
75
+ button.animate({ width: original_width + "px" }, settings.speed)
72
76
  }
73
- function inputEmpty(){
74
- return $.trim(input.val()) == "";
77
+ function inputEmpty() {
78
+ return $.trim(input.val()) == ""
75
79
  }
76
80
  }
77
81
  }
@@ -1,62 +1,76 @@
1
1
  export default class {
2
2
  connect() {
3
3
  // Add Select/Deselect all input behavior
4
- this.addCheckboxToggleBehavior();
5
- this.addEnableToggleBehavior();
4
+ this.addCheckboxToggleBehavior()
5
+ this.addEnableToggleBehavior()
6
6
  }
7
-
8
- // Add Select/Deselect all behavior for metadata field names for a given view e.g. Item details.
7
+
8
+ // Add Select/Deselect all behavior for metadata field names for a given view e.g. Item details.
9
9
  addCheckboxToggleBehavior() {
10
- $("[data-behavior='metadata-select']").each(function(){
11
- var selectCheckbox = $(this);
12
- var parentCell = selectCheckbox.parents("th");
13
- var table = parentCell.closest("table");
14
- var columnRows = $("tr td:nth-child(" + (parentCell.index() + 1) + ")", table);
15
- var checkboxes = $("input[type='checkbox']", columnRows);
16
- updateSelectAllInput(selectCheckbox, columnRows);
10
+ $("[data-behavior='metadata-select']").each(function () {
11
+ var selectCheckbox = $(this)
12
+ var parentCell = selectCheckbox.parents("th")
13
+ var table = parentCell.closest("table")
14
+ var columnRows = $(
15
+ "tr td:nth-child(" + (parentCell.index() + 1) + ")",
16
+ table,
17
+ )
18
+ var checkboxes = $("input[type='checkbox']", columnRows)
19
+ updateSelectAllInput(selectCheckbox, columnRows)
17
20
  // Add the check/uncheck behavior to the select/deselect all checkbox
18
- selectCheckbox.on('click', function(e){
19
- var allChecked = allCheckboxesChecked(columnRows);
20
- columnRows.each(function(){
21
- $("input[type='checkbox']", $(this)).prop('checked', !allChecked);
22
- });
23
- });
21
+ selectCheckbox.on("click", function () {
22
+ var allChecked = allCheckboxesChecked(columnRows)
23
+ columnRows.each(function () {
24
+ $("input[type='checkbox']", $(this)).prop("checked", !allChecked)
25
+ })
26
+ })
24
27
  // When a single checkbox is selected/unselected, the "All" checkbox should be updated accordingly.
25
- checkboxes.each(function(){
26
- $(this).on('change', function(){
27
- updateSelectAllInput(selectCheckbox, columnRows);
28
- });
29
- });
30
- });
28
+ checkboxes.each(function () {
29
+ $(this).on("change", function () {
30
+ updateSelectAllInput(selectCheckbox, columnRows)
31
+ })
32
+ })
33
+ })
31
34
 
32
35
  // Check number of checkboxes against the number of checked
33
36
  // checkboxes to determine if all of them are checked or not
34
37
  function allCheckboxesChecked(elements) {
35
- return ($("input[type='checkbox']", elements).length == $("input[type='checkbox']:checked", elements).length)
38
+ return (
39
+ $("input[type='checkbox']", elements).length ==
40
+ $("input[type='checkbox']:checked", elements).length
41
+ )
36
42
  }
37
43
 
38
44
  // Check or uncheck the "All" checkbox for each view column, e.g. Item details, List, etc.
39
45
  function updateSelectAllInput(checkbox, elements) {
40
- if ( allCheckboxesChecked(elements) ) {
41
- checkbox.prop('checked', true);
46
+ if (allCheckboxesChecked(elements)) {
47
+ checkbox.prop("checked", true)
42
48
  } else {
43
- checkbox.prop('checked', false);
49
+ checkbox.prop("checked", false)
44
50
  }
45
51
  }
46
52
  }
47
-
53
+
48
54
  addEnableToggleBehavior() {
49
- $("[data-behavior='enable-feature']").each(function(){
50
- var checkbox = $(this);
51
- var target = $($(this).data('target'));
55
+ $("[data-behavior='enable-feature']").each(function () {
56
+ var checkbox = $(this)
57
+ var target = $($(this).data("target"))
52
58
 
53
- checkbox.on('change', function() {
54
- if ($(this).is(':checked')) {
55
- target.find('input:checkbox').not("[data-behavior='enable-feature']").prop('checked', true).attr('disabled', false);
59
+ checkbox.on("change", function () {
60
+ if ($(this).is(":checked")) {
61
+ target
62
+ .find("input:checkbox")
63
+ .not("[data-behavior='enable-feature']")
64
+ .prop("checked", true)
65
+ .attr("disabled", false)
56
66
  } else {
57
- target.find('input:checkbox').not("[data-behavior='enable-feature']").prop('checked', false).attr('disabled', true);
67
+ target
68
+ .find("input:checkbox")
69
+ .not("[data-behavior='enable-feature']")
70
+ .prop("checked", false)
71
+ .attr("disabled", true)
58
72
  }
59
- });
60
- });
73
+ })
74
+ })
61
75
  }
62
- }
76
+ }