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
@@ -24,7 +24,6 @@
24
24
  @import "upload";
25
25
  @import "nestable";
26
26
  @import "blacklight_configuration";
27
- @import "typeahead";
28
27
  @import "bootstrap_overrides";
29
28
  @import "blacklight_overrides";
30
29
  @import "report_a_problem";
@@ -38,7 +37,6 @@
38
37
  @import "admin_users";
39
38
  @import "autocomplete";
40
39
 
41
-
42
40
  // Styles below keep footer at bottom of viewport
43
41
  html {
44
42
  position: relative;
@@ -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>
@@ -29,8 +29,8 @@ module Spotlight
29
29
  **params
30
30
  )
31
31
 
32
- redirect_back fallback_location: spotlight.search_exhibit_catalog_path(current_search_session.query_params),
33
- notice: t(:"spotlight.bulk_actions.#{i18n_key}.changed", count: solr_response.total)
32
+ redirect_back_or_to(spotlight.search_exhibit_catalog_path(current_search_session.query_params),
33
+ notice: t(:"spotlight.bulk_actions.#{i18n_key}.changed", count: solr_response.total))
34
34
  end
35
35
 
36
36
  def solr_params
@@ -31,9 +31,9 @@ module Spotlight
31
31
  bulk_update = Spotlight::BulkUpdate.new(exhibit: current_exhibit, file: file_params)
32
32
  if bulk_update.save
33
33
  ProcessBulkUpdatesCsvJob.perform_later(current_exhibit, bulk_update)
34
- redirect_back fallback_location: spotlight.edit_exhibit_bulk_updates_path(current_exhibit), notice: t(:'spotlight.bulk_updates.update.submitted')
34
+ redirect_back_or_to(spotlight.edit_exhibit_bulk_updates_path(current_exhibit), notice: t(:'spotlight.bulk_updates.update.submitted'))
35
35
  else
36
- redirect_back fallback_location: spotlight.edit_exhibit_bulk_updates_path(current_exhibit), alert: t(:'spotlight.bulk_updates.update.error')
36
+ redirect_back_or_to(spotlight.edit_exhibit_bulk_updates_path(current_exhibit), alert: t(:'spotlight.bulk_updates.update.error'))
37
37
  end
38
38
  end
39
39
 
@@ -103,7 +103,7 @@ module Spotlight
103
103
  @document.save
104
104
 
105
105
  respond_to do |format|
106
- format.html { redirect_back(fallback_location: [spotlight, current_exhibit, @document]) }
106
+ format.html { redirect_back_or_to([spotlight, current_exhibit, @document]) }
107
107
  format.json { render json: true }
108
108
  end
109
109
  end
@@ -113,7 +113,7 @@ module Spotlight
113
113
  @document.save
114
114
 
115
115
  respond_to do |format|
116
- format.html { redirect_back(fallback_location: [spotlight, current_exhibit, @document]) }
116
+ format.html { redirect_back_or_to([spotlight, current_exhibit, @document]) }
117
117
  format.json { render json: true }
118
118
  end
119
119
  end
@@ -15,7 +15,7 @@ module Spotlight
15
15
  if @contact_form.valid?
16
16
  ContactMailer.report_problem(@contact_form).deliver_now
17
17
 
18
- redirect_back fallback_location: spotlight.new_exhibit_contact_form_path(current_exhibit), notice: t(:'helpers.submit.contact_form.created')
18
+ redirect_back_or_to(spotlight.new_exhibit_contact_form_path(current_exhibit), notice: t(:'helpers.submit.contact_form.created'))
19
19
  else
20
20
  render 'new'
21
21
  end
@@ -64,7 +64,7 @@ module Spotlight
64
64
  else
65
65
  flash.now[:alert] = t('spotlight.exhibits.new_exhibit_form.errors.slug_taken') if @exhibit.errors[:slug].present?
66
66
 
67
- render :new, status: :unprocessable_entity
67
+ render :new, status: :unprocessable_content
68
68
  end
69
69
  end
70
70
  # rubocop:enable Metrics/AbcSize
@@ -18,7 +18,7 @@ module Spotlight
18
18
  private
19
19
 
20
20
  def handle_upload_error(exception)
21
- render json: { error: [exception.message] }, status: :unprocessable_entity
21
+ render json: { error: [exception.message] }, status: :unprocessable_content
22
22
  end
23
23
 
24
24
  def tilesource
@@ -93,7 +93,7 @@ module Spotlight
93
93
  else
94
94
  t(:'helpers.submit.page.batch_error', model: human_name)
95
95
  end
96
- redirect_back fallback_location: spotlight.exhibit_dashboard_path(@exhibit), notice:
96
+ redirect_back_or_to(spotlight.exhibit_dashboard_path(@exhibit), notice:)
97
97
  end
98
98
 
99
99
  def clone
@@ -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
@@ -40,10 +40,9 @@ module Spotlight
40
40
  @search.query_params = query_params
41
41
 
42
42
  if @search.save
43
- redirect_back fallback_location: fallback_url,
44
- notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase)
43
+ redirect_back_or_to(fallback_url, notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase))
45
44
  else
46
- redirect_back fallback_location: fallback_url, alert: @search.errors.full_messages.join('<br>'.html_safe)
45
+ redirect_back_or_to(fallback_url, alert: @search.errors.full_messages.join('<br>'.html_safe))
47
46
  end
48
47
  end
49
48
 
@@ -79,7 +78,7 @@ module Spotlight
79
78
  else
80
79
  t(:'helpers.submit.search.batch_error', model: Spotlight::Search.model_name.human.pluralize.downcase)
81
80
  end
82
- redirect_back fallback_location: fallback_url, notice:
81
+ redirect_back_or_to(fallback_url, notice:)
83
82
  end
84
83
 
85
84
  protected
@@ -27,7 +27,7 @@ module Spotlight
27
27
  end
28
28
 
29
29
  if params[:resources_json_upload]
30
- redirect_back fallback_location: exhibit_resources_path(@exhibit)
30
+ redirect_back_or_to(exhibit_resources_path(@exhibit))
31
31
  else
32
32
  head :ok
33
33
  end
@@ -43,7 +43,7 @@ module Spotlight
43
43
 
44
44
  rename_tags_later!(tags_to_rename)
45
45
 
46
- redirect_back fallback_location: fallback_url, notice: t(:'helpers.submit.tags.batch_updated', count: tags_to_rename.count)
46
+ redirect_back_or_to(fallback_url, notice: t(:'helpers.submit.tags.batch_updated', count: tags_to_rename.count))
47
47
  end
48
48
 
49
49
  private
@@ -17,7 +17,7 @@ module Spotlight
17
17
  redirect_to [obj.exhibit, obj], flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
18
18
  end
19
19
  else
20
- redirect_back fallback_location: main_app.root_url, flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
20
+ redirect_back_or_to(main_app.root_url, flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error'))
21
21
  end
22
22
  end
23
23
 
@@ -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
+ }