blacklight 8.3.0 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +10 -6
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +22 -55
  5. data/Gemfile +2 -10
  6. data/README.md +2 -2
  7. data/VERSION +1 -1
  8. data/app/assets/javascripts/blacklight/blacklight.esm.js +13 -7
  9. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  10. data/app/assets/javascripts/blacklight/blacklight.js +13 -7
  11. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  12. data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -1
  13. data/app/assets/stylesheets/blacklight/_bookmark.scss +30 -0
  14. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -4
  15. data/app/assets/stylesheets/blacklight/_constraints.scss +15 -9
  16. data/app/assets/stylesheets/blacklight/_controls.scss +0 -1
  17. data/app/assets/stylesheets/blacklight/_facets.scss +33 -37
  18. data/app/assets/stylesheets/blacklight/_header.scss +2 -35
  19. data/app/assets/stylesheets/blacklight/_icons.scss +3 -2
  20. data/app/assets/stylesheets/blacklight/_layout.scss +3 -0
  21. data/app/assets/stylesheets/blacklight/_mixins.scss +4 -4
  22. data/app/assets/stylesheets/blacklight/_search_form.scss +3 -8
  23. data/app/assets/stylesheets/blacklight/_search_history.scss +5 -5
  24. data/app/assets/stylesheets/blacklight/_search_results.scss +5 -2
  25. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +16 -10
  26. data/app/components/blacklight/advanced_search_form_component.html.erb +1 -1
  27. data/app/components/blacklight/advanced_search_form_component.rb +6 -0
  28. data/app/components/blacklight/constraint_layout_component.html.erb +2 -9
  29. data/app/components/blacklight/constraint_layout_component.rb +8 -0
  30. data/app/components/blacklight/constraints_component.rb +3 -3
  31. data/app/components/blacklight/document/action_component.rb +2 -1
  32. data/app/components/blacklight/document/bookmark_component.html.erb +2 -1
  33. data/app/components/blacklight/document/bookmark_component.rb +6 -0
  34. data/app/components/blacklight/document/page_header_component.html.erb +7 -0
  35. data/app/components/blacklight/document/page_header_component.rb +85 -0
  36. data/app/components/blacklight/document_component.rb +1 -1
  37. data/app/components/blacklight/facet_component.rb +1 -1
  38. data/app/components/blacklight/facet_field_checkboxes_component.html.erb +1 -1
  39. data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
  40. data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +1 -1
  41. data/app/components/blacklight/facet_field_list_component.html.erb +1 -1
  42. data/app/components/blacklight/facet_item_component.rb +1 -1
  43. data/app/components/blacklight/icons/bookmark_icon_component.rb +17 -0
  44. data/app/components/blacklight/icons/icon_component.rb +9 -4
  45. data/app/components/blacklight/icons/remove_component.rb +16 -0
  46. data/app/components/blacklight/metadata_field_component.html.erb +1 -1
  47. data/app/components/blacklight/metadata_field_component.rb +5 -0
  48. data/app/components/blacklight/response/facet_group_component.rb +1 -1
  49. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  50. data/app/components/blacklight/response/sort_component.html.erb +1 -6
  51. data/app/components/blacklight/response/sort_component.rb +15 -0
  52. data/app/components/blacklight/search/per_page_component.html.erb +2 -0
  53. data/app/components/blacklight/search/per_page_component.rb +50 -0
  54. data/app/components/blacklight/search_bar_component.html.erb +1 -1
  55. data/app/components/blacklight/search_context/server_item_pagination_component.html.erb +5 -4
  56. data/app/components/blacklight/search_context/server_item_pagination_component.rb +1 -1
  57. data/app/components/blacklight/skip_link_component.html.erb +7 -0
  58. data/app/components/blacklight/skip_link_component.rb +17 -0
  59. data/app/components/blacklight/system/dropdown_button_component.rb +18 -0
  60. data/app/components/blacklight/system/dropdown_component.rb +3 -6
  61. data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
  62. data/app/components/blacklight/top_navbar_component.html.erb +2 -2
  63. data/app/components/blacklight/top_navbar_component.rb +4 -0
  64. data/app/helpers/blacklight/catalog_helper_behavior.rb +2 -0
  65. data/app/helpers/blacklight/component_helper_behavior.rb +4 -4
  66. data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -0
  67. data/app/helpers/blacklight/document_helper_behavior.rb +14 -0
  68. data/app/javascript/blacklight/checkbox_submit.js +7 -1
  69. data/app/javascript/blacklight/core.js +5 -5
  70. data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -1
  71. data/app/presenters/blacklight/facet_checkbox_item_presenter.rb +11 -0
  72. data/app/presenters/blacklight/facet_field_presenter.rb +9 -1
  73. data/app/services/blacklight/search_service.rb +9 -1
  74. data/app/views/catalog/_per_page_widget.html.erb +1 -10
  75. data/app/views/catalog/_search_results.html.erb +1 -1
  76. data/app/views/catalog/_show_main_content.html.erb +1 -1
  77. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  78. data/app/views/catalog/show.html.erb +3 -3
  79. data/app/views/catalog/suggest.html.erb +1 -1
  80. data/app/views/kaminari/blacklight/_page.html.erb +14 -8
  81. data/app/views/kaminari/blacklight/_paginator.html.erb +2 -1
  82. data/app/views/layouts/blacklight/base.html.erb +3 -5
  83. data/blacklight.gemspec +6 -2
  84. data/{docker-compose.yml → compose.yaml} +1 -1
  85. data/config/locales/blacklight.ar.yml +3 -0
  86. data/config/locales/blacklight.de.yml +3 -0
  87. data/config/locales/blacklight.en.yml +216 -229
  88. data/config/locales/blacklight.es.yml +3 -0
  89. data/config/locales/blacklight.fr.yml +3 -0
  90. data/config/locales/blacklight.hu.yml +3 -0
  91. data/config/locales/blacklight.it.yml +3 -0
  92. data/config/locales/blacklight.nl.yml +3 -0
  93. data/config/locales/blacklight.pt-BR.yml +3 -0
  94. data/config/locales/blacklight.sq.yml +3 -0
  95. data/config/locales/blacklight.zh.yml +3 -0
  96. data/lib/blacklight/abstract_repository.rb +6 -0
  97. data/lib/blacklight/component.rb +10 -47
  98. data/lib/blacklight/configuration.rb +32 -19
  99. data/lib/blacklight/engine.rb +6 -0
  100. data/lib/blacklight/parameters.rb +1 -1
  101. data/lib/blacklight/solr/repository.rb +11 -4
  102. data/lib/blacklight/solr/response/params.rb +1 -1
  103. data/lib/blacklight/solr/response.rb +0 -12
  104. data/lib/blacklight/solr/search_builder_behavior.rb +1 -1
  105. data/lib/blacklight/solr.rb +0 -6
  106. data/lib/blacklight.rb +4 -14
  107. data/lib/generators/blacklight/assets/propshaft_generator.rb +2 -2
  108. data/lib/generators/blacklight/models_generator.rb +1 -1
  109. data/lib/generators/blacklight/user_generator.rb +2 -0
  110. data/package.json +3 -2
  111. data/rollup.config.js +6 -12
  112. data/spec/components/blacklight/document/action_component_spec.rb +1 -1
  113. data/spec/components/blacklight/document/page_header_component_spec.rb +92 -0
  114. data/spec/components/blacklight/document_component_spec.rb +20 -0
  115. data/spec/components/blacklight/icons/icon_component_spec.rb +42 -0
  116. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +13 -2
  117. data/spec/controllers/blacklight/catalog_spec.rb +1 -1
  118. data/spec/controllers/catalog_controller_spec.rb +5 -5
  119. data/spec/features/advanced_search_spec.rb +16 -2
  120. data/spec/features/bookmarks_spec.rb +15 -0
  121. data/spec/features/search_context_spec.rb +2 -1
  122. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +2 -2
  123. data/spec/lib/blacklight/component_spec.rb +32 -27
  124. data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +1 -1
  125. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +1 -1
  126. data/spec/models/blacklight/configuration_spec.rb +12 -12
  127. data/spec/models/blacklight/solr/document_spec.rb +2 -2
  128. data/spec/models/blacklight/solr/repository_spec.rb +31 -13
  129. data/spec/models/blacklight/solr/response/facets_spec.rb +2 -2
  130. data/spec/models/blacklight/solr/response/group_spec.rb +1 -1
  131. data/spec/models/blacklight/solr/response_spec.rb +2 -2
  132. data/spec/models/blacklight/solr/search_builder_behavior_spec.rb +1 -1
  133. data/spec/models/bookmark_spec.rb +1 -1
  134. data/spec/presenters/blacklight/document_presenter_spec.rb +2 -2
  135. data/spec/presenters/blacklight/facet_checkbox_item_presenter_spec.rb +42 -0
  136. data/spec/presenters/blacklight/facet_field_presenter_spec.rb +14 -0
  137. data/spec/requests/load_suggestions_spec.rb +5 -5
  138. data/spec/services/blacklight/search_service_spec.rb +2 -2
  139. data/spec/spec_helper.rb +5 -2
  140. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  141. data/tasks/blacklight.rake +6 -6
  142. metadata +86 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1e6e672e07634c504da353b57fe4f15f41d56f3bc6656aedc03f7b312f1531e
4
- data.tar.gz: 0cc0c2d92c0622e27889eb49b08b5f2d39e455e725076c59ef119f45606a1e4e
3
+ metadata.gz: a3f47b9e29a5b0ab121d67527cdc2a69bbc02060100bf438f5c2bcc9d4f4f4e3
4
+ data.tar.gz: f6157e3ccc510be3a4ca02dcf560b400db9855ff63b89e9abe5f0c40cbac0cba
5
5
  SHA512:
6
- metadata.gz: b5847ccdf59e00a4c34e36081626cead1263475e517c9ea79b23ebd6e0c656b0e272eff35c0da02cbc500c0c8b119a2454e397ce323ce64eb473bdc1dc897a44
7
- data.tar.gz: 90db3e0bd7e6a24d782832a0967f5af56c0f3b803f8d4debeef669040e98077829e5c49dd03449719d1de9ed19e26a33b060a231d173e5d1e00d2d31ed2f6764
6
+ metadata.gz: 3309694036e4a5e75680f56e2f920cc06f5a88e4ecd5d0e2a70b068ddb5436567481efde3896eac8b23684c558c84289da58dd61d7944c0935ae3cdb53860dbb
7
+ data.tar.gz: 8fe85d16697b0314c0f75539c919c94e8ac002e3d180106ec02934b925e7fade6ff82e52a00daa39c383b0c4065556f16bac18681959bd350f8a2a4ba6100c66
@@ -18,12 +18,14 @@ jobs:
18
18
  lint:
19
19
  runs-on: ubuntu-latest
20
20
  steps:
21
- - uses: actions/checkout@v3
21
+ - uses: actions/checkout@v4
22
22
  - name: Set up Ruby
23
23
  uses: ruby/setup-ruby@v1
24
24
  with:
25
25
  ruby-version: 3.2
26
26
  bundler: "latest"
27
+ - name: Change permissions
28
+ run: "chmod -f -R o-w /opt/hostedtoolcache/Ruby/3.2.5/x64/lib/ruby/gems/3.2.0/gems | :"
27
29
  - name: Install dependencies
28
30
  run: bundle install
29
31
  - name: Run linter
@@ -34,7 +36,7 @@ jobs:
34
36
  strategy:
35
37
  matrix:
36
38
  ruby: ["3.3"]
37
- rails_version: ["7.0.8.4", "7.1.3.4"]
39
+ rails_version: ["7.0.8.4", "7.1.3.4", "7.2.0"]
38
40
  bootstrap_version: [null]
39
41
  view_component_version: ["~> 3.12"]
40
42
  api: [null]
@@ -53,7 +55,7 @@ jobs:
53
55
  rails_version: "7.1.3.4"
54
56
  - ruby: "3.1"
55
57
  rails_version: "7.1.3.4"
56
- view_component_version: "~> 2.66"
58
+ view_component_version: "~> 2.74"
57
59
  additional_name: "/ ViewComponent 2"
58
60
  - ruby: "3.1"
59
61
  rails_version: "7.0.8.4"
@@ -76,12 +78,14 @@ jobs:
76
78
  BLACKLIGHT_API_TEST: ${{ matrix.api }}
77
79
  ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
78
80
  steps:
79
- - uses: actions/checkout@v3
81
+ - uses: actions/checkout@v4
80
82
  - name: Set up Ruby
81
83
  uses: ruby/setup-ruby@v1
82
84
  with:
83
85
  bundler: "latest"
84
86
  ruby-version: ${{ matrix.ruby }}
87
+ - name: Change permissions
88
+ run: "chmod -f -R o-w /opt/hostedtoolcache/Ruby/3.2.5/x64/lib/ruby/gems/3.2.0/gems | :"
85
89
  - name: Install dependencies
86
90
  run: bundle install
87
91
  - name: Run tests
@@ -89,6 +93,6 @@ jobs:
89
93
  docker_build:
90
94
  runs-on: ubuntu-latest
91
95
  steps:
92
- - uses: actions/checkout@v3
96
+ - uses: actions/checkout@v4
93
97
  - name: Build docker image
94
- run: docker-compose build app
98
+ run: docker compose build app
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ require:
3
3
  - rubocop-rspec
4
4
  - rubocop-rspec_rails
5
5
  - rubocop-rails
6
+ - rubocop-factory_bot
6
7
 
7
8
  inherit_from:
8
9
  - .rubocop_todo.yml
@@ -581,3 +582,5 @@ Rails/WhereNotWithMultipleConditions: # new in 2.17
581
582
  Enabled: true
582
583
  Rails/WhereRange: # new in 2.25
583
584
  Enabled: true
585
+ Gemspec/AddRuntimeDependency: # new in 1.65
586
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-12-05 17:55:17 UTC using RuboCop version 1.58.0.
3
+ # on 2024-09-03 14:22:19 UTC using RuboCop version 1.66.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -35,14 +35,13 @@ Lint/AmbiguousBlockAssociation:
35
35
  Exclude:
36
36
  - 'lib/blacklight/solr/search_builder_behavior.rb'
37
37
 
38
- # Offense count: 5
38
+ # Offense count: 4
39
39
  # This cop supports safe autocorrection (--autocorrect).
40
40
  Lint/AmbiguousOperator:
41
41
  Exclude:
42
42
  - 'spec/helpers/blacklight/url_helper_behavior_spec.rb'
43
43
  - 'spec/helpers/blacklight_helper_spec.rb'
44
44
  - 'spec/models/blacklight/facet_paginator_spec.rb'
45
- - 'spec/models/blacklight/solr/search_builder_spec.rb'
46
45
  - 'spec/services/blacklight/search_service_spec.rb'
47
46
 
48
47
  # Offense count: 45
@@ -91,7 +90,7 @@ Lint/EmptyFile:
91
90
  Exclude:
92
91
  - 'spec/components/blacklight/document_metadata_component_spec.rb'
93
92
 
94
- # Offense count: 46
93
+ # Offense count: 48
95
94
  # Configuration parameters: AllowedParentClasses.
96
95
  Lint/MissingSuper:
97
96
  Enabled: false
@@ -111,7 +110,7 @@ Lint/ShadowingOuterLocalVariable:
111
110
  Exclude:
112
111
  - 'spec/models/blacklight/configuration_spec.rb'
113
112
 
114
- # Offense count: 81
113
+ # Offense count: 83
115
114
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
116
115
  Metrics/AbcSize:
117
116
  Max: 46
@@ -122,20 +121,15 @@ Metrics/AbcSize:
122
121
  Metrics/BlockLength:
123
122
  Max: 26
124
123
 
125
- # Offense count: 1
126
- # Configuration parameters: CountBlocks.
127
- Metrics/BlockNesting:
128
- Max: 4
129
-
130
124
  # Offense count: 42
131
125
  # Configuration parameters: AllowedMethods, AllowedPatterns.
132
126
  Metrics/CyclomaticComplexity:
133
127
  Max: 14
134
128
 
135
- # Offense count: 77
129
+ # Offense count: 78
136
130
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
137
131
  Metrics/MethodLength:
138
- Max: 29
132
+ Max: 27
139
133
 
140
134
  # Offense count: 4
141
135
  # Configuration parameters: CountComments, CountAsOne.
@@ -147,7 +141,7 @@ Metrics/ModuleLength:
147
141
  Metrics/ParameterLists:
148
142
  Max: 6
149
143
 
150
- # Offense count: 37
144
+ # Offense count: 36
151
145
  # Configuration parameters: AllowedMethods, AllowedPatterns.
152
146
  Metrics/PerceivedComplexity:
153
147
  Max: 14
@@ -190,19 +184,13 @@ RSpec/BeforeAfterAll:
190
184
  - 'spec/models/blacklight/document/dublin_core_spec.rb'
191
185
  - 'spec/models/blacklight/solr/document_spec.rb'
192
186
 
193
- # Offense count: 104
187
+ # Offense count: 109
194
188
  # Configuration parameters: Prefixes, AllowedPatterns.
195
189
  # Prefixes: when, with, without
196
190
  RSpec/ContextWording:
197
191
  Enabled: false
198
192
 
199
- # Offense count: 1
200
- # This cop supports unsafe autocorrection (--autocorrect-all).
201
- RSpec/EmptyExampleGroup:
202
- Exclude:
203
- - 'spec/models/blacklight/solr/search_builder_spec.rb'
204
-
205
- # Offense count: 135
193
+ # Offense count: 138
206
194
  # Configuration parameters: CountAsOne.
207
195
  RSpec/ExampleLength:
208
196
  Max: 33
@@ -212,16 +200,6 @@ RSpec/ExpectInHook:
212
200
  Exclude:
213
201
  - 'spec/controllers/catalog_controller_spec.rb'
214
202
 
215
- # Offense count: 4
216
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
217
- # Include: **/*_spec*rb*, **/spec/**/*
218
- RSpec/FilePath:
219
- Exclude:
220
- - 'spec/controllers/blacklight/catalog/component_configuration_spec.rb'
221
- - 'spec/models/blacklight/solr/search_builder_spec.rb'
222
- - 'spec/presenters/pipeline_spec.rb'
223
- - 'spec/presenters/thumbnail_presenter_spec.rb'
224
-
225
203
  # Offense count: 108
226
204
  # Configuration parameters: AssignmentOnly.
227
205
  RSpec/InstanceVariable:
@@ -263,7 +241,7 @@ RSpec/MessageChain:
263
241
  - 'spec/presenters/blacklight/field_presenter_spec.rb'
264
242
  - 'spec/views/shared/_user_util_links.html.erb_spec.rb'
265
243
 
266
- # Offense count: 30
244
+ # Offense count: 28
267
245
  # Configuration parameters: EnforcedStyle.
268
246
  # SupportedStyles: have_received, receive
269
247
  RSpec/MessageSpies:
@@ -276,34 +254,32 @@ RSpec/MessageSpies:
276
254
  - 'spec/models/blacklight/search_builder_spec.rb'
277
255
  - 'spec/models/blacklight/suggest_search_spec.rb'
278
256
  - 'spec/presenters/blacklight/field_presenter_spec.rb'
279
- - 'spec/presenters/thumbnail_presenter_spec.rb'
280
257
 
281
- # Offense count: 382
258
+ # Offense count: 390
282
259
  RSpec/MultipleExpectations:
283
260
  Max: 16
284
261
 
285
- # Offense count: 282
262
+ # Offense count: 292
286
263
  # Configuration parameters: AllowSubject.
287
264
  RSpec/MultipleMemoizedHelpers:
288
265
  Max: 14
289
266
 
290
- # Offense count: 394
267
+ # Offense count: 399
291
268
  # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
292
269
  # SupportedStyles: always, named_only
293
270
  RSpec/NamedSubject:
294
271
  Enabled: false
295
272
 
296
- # Offense count: 59
273
+ # Offense count: 60
297
274
  # Configuration parameters: AllowedGroups.
298
275
  RSpec/NestedGroups:
299
276
  Max: 5
300
277
 
301
- # Offense count: 6
278
+ # Offense count: 4
302
279
  RSpec/RepeatedDescription:
303
280
  Exclude:
304
281
  - 'spec/features/search_results_spec.rb'
305
282
  - 'spec/helpers/catalog_helper_spec.rb'
306
- - 'spec/models/blacklight/solr/search_builder_spec.rb'
307
283
 
308
284
  # Offense count: 2
309
285
  RSpec/RepeatedExample:
@@ -315,14 +291,14 @@ RSpec/RepeatedExampleGroupDescription:
315
291
  Exclude:
316
292
  - 'spec/services/blacklight/search_service_spec.rb'
317
293
 
318
- # Offense count: 3
294
+ # Offense count: 1
319
295
  # This cop supports safe autocorrection (--autocorrect).
296
+ # Configuration parameters: AutoCorrect.
320
297
  RSpec/ScatteredLet:
321
298
  Exclude:
322
- - 'spec/models/blacklight/solr/search_builder_spec.rb'
323
299
  - 'spec/views/catalog/index.atom.builder_spec.rb'
324
300
 
325
- # Offense count: 22
301
+ # Offense count: 20
326
302
  RSpec/StubbedMock:
327
303
  Exclude:
328
304
  - 'spec/controllers/catalog_controller_spec.rb'
@@ -332,7 +308,6 @@ RSpec/StubbedMock:
332
308
  - 'spec/helpers/catalog_helper_spec.rb'
333
309
  - 'spec/models/blacklight/suggest_search_spec.rb'
334
310
  - 'spec/presenters/blacklight/field_presenter_spec.rb'
335
- - 'spec/presenters/thumbnail_presenter_spec.rb'
336
311
 
337
312
  # Offense count: 1
338
313
  RSpec/SubjectDeclaration:
@@ -349,7 +324,7 @@ RSpec/SubjectStub:
349
324
  - 'spec/presenters/blacklight/document_presenter_spec.rb'
350
325
  - 'spec/services/blacklight/search_service_spec.rb'
351
326
 
352
- # Offense count: 79
327
+ # Offense count: 80
353
328
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
354
329
  RSpec/VerifiedDoubles:
355
330
  Enabled: false
@@ -443,7 +418,7 @@ Style/DocumentDynamicEvalDefinition:
443
418
  - 'app/builders/blacklight/action_builder.rb'
444
419
  - 'lib/blacklight/configuration/fields.rb'
445
420
 
446
- # Offense count: 128
421
+ # Offense count: 133
447
422
  # Configuration parameters: AllowedConstants.
448
423
  Style/Documentation:
449
424
  Enabled: false
@@ -549,20 +524,12 @@ Style/PercentLiteralDelimiters:
549
524
  - 'lib/blacklight/engine.rb'
550
525
  - 'lib/blacklight/solr/request.rb'
551
526
 
552
- # Offense count: 15
527
+ # Offense count: 2
553
528
  # This cop supports safe autocorrection (--autocorrect).
554
529
  Style/RedundantParentheses:
555
530
  Exclude:
556
- - 'app/components/blacklight/advanced_search_form_component.rb'
557
- - 'app/components/blacklight/document/actions_component.rb'
558
- - 'app/components/blacklight/document_component.rb'
559
- - 'app/components/blacklight/document_metadata_component.rb'
560
- - 'app/components/blacklight/metadata_field_layout_component.rb'
561
- - 'app/components/blacklight/system/dropdown_component.rb'
562
531
  - 'app/views/catalog/_document.atom.builder'
563
- - 'lib/blacklight/search_state/pivot_filter_field.rb'
564
532
  - 'lib/railties/blacklight.rake'
565
- - 'spec/models/blacklight/solr/search_builder_spec.rb'
566
533
 
567
534
  # Offense count: 6
568
535
  # This cop supports safe autocorrection (--autocorrect).
@@ -603,7 +570,7 @@ Style/SoleNestedConditional:
603
570
  Exclude:
604
571
  - 'app/controllers/concerns/blacklight/controller.rb'
605
572
 
606
- # Offense count: 30
573
+ # Offense count: 32
607
574
  # This cop supports safe autocorrection (--autocorrect).
608
575
  # Configuration parameters: MinSize.
609
576
  # SupportedStyles: percent, brackets
data/Gemfile CHANGED
@@ -31,17 +31,9 @@ else
31
31
  gem 'rails', ENV['RAILS_VERSION']
32
32
  end
33
33
  end
34
-
35
- case ENV['RAILS_VERSION'].to_s
36
- when /^(~> ?)?6\.0/
37
- gem 'sass-rails', '>= 6'
38
- gem 'webpacker', '~> 4.0'
39
- when /^5.[12]/
40
- gem 'sass-rails', '~> 5.0'
41
- gem 'sprockets', '~> 3.7'
42
- gem 'thor', '~> 0.20'
43
- end
44
34
  end
45
35
  # END ENGINE_CART BLOCK
46
36
 
47
37
  eval_gemfile File.expand_path("spec/test_app_templates/Gemfile.extra", File.dirname(__FILE__))
38
+
39
+ gem "easy_translate", "~> 0.5.1"
data/README.md CHANGED
@@ -36,11 +36,11 @@ rails generate blacklight:install
36
36
 
37
37
  ## Browser Compatibility
38
38
 
39
- Blacklight assumes a modern browser with support for ES6. This means we explicitly do not support Internet Explorer 11.
39
+ Blacklight assumes a modern browser with support for [Baseline 2023](https://web.dev/baseline/2023). This means we explicitly do not support Internet Explorer.
40
40
 
41
41
  ## Dependencies
42
42
 
43
- * [Ruby](https://www.ruby-lang.org/) 2.7+
43
+ * [Ruby](https://www.ruby-lang.org/) 3.1+
44
44
  * [Ruby on Rails](https://rubyonrails.org/) 6.1+
45
45
 
46
46
  Blacklight aims to support the currently [supported versions of Ruby](https://www.ruby-lang.org/en/downloads/branches/) and the [supported versions of Ruby on Rails](https://guides.rubyonrails.org/maintenance_policy.html). We aim to keep our [test configuration](blob/main/.github/workflows/ruby.yml) up to date with these supported versions.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.3.0
1
+ 8.5.0
@@ -37,7 +37,9 @@ class CheckboxSubmit {
37
37
  this.labelTarget.removeAttribute('disabled');
38
38
  this.checkboxTarget.removeAttribute('disabled');
39
39
  this.updateStateFor(!this.checked);
40
- document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count;
40
+ this.bookmarksCounter().forEach(counter => {
41
+ counter.innerHTML = json.bookmarks.count;
42
+ });
41
43
  }).catch((error) => {
42
44
  this.handleError(error);
43
45
  });
@@ -63,6 +65,10 @@ class CheckboxSubmit {
63
65
  return this.form.querySelector('[data-checkboxsubmit-target="span"]')
64
66
  }
65
67
 
68
+ bookmarksCounter() {
69
+ return document.querySelectorAll('[data-role="bookmark-counter"]')
70
+ }
71
+
66
72
  handleError() {
67
73
  alert("Unable to save the bookmark at this time.");
68
74
  }
@@ -330,7 +336,7 @@ SearchContext.handleSearchContextMethod = function(event) {
330
336
 
331
337
  document.addEventListener('click', SearchContext);
332
338
 
333
- const Blacklight = function() {
339
+ const Core = function() {
334
340
  const buffer = new Array;
335
341
  return {
336
342
  onLoad: function(func) {
@@ -366,13 +372,13 @@ const Blacklight = function() {
366
372
 
367
373
  // turbolinks triggers page:load events on page transition
368
374
  // If app isn't using turbolinks, this event will never be triggered, no prob.
369
- Blacklight.listeners().forEach(function(listener) {
375
+ Core.listeners().forEach(function(listener) {
370
376
  document.addEventListener(listener, function() {
371
- Blacklight.activate();
377
+ Core.activate();
372
378
  });
373
379
  });
374
380
 
375
- Blacklight.onLoad(function () {
381
+ Core.onLoad(function () {
376
382
  const elem = document.querySelector('.no-js');
377
383
 
378
384
  // The "no-js" class may already have been removed because this function is
@@ -388,8 +394,8 @@ const index = {
388
394
  ButtonFocus,
389
395
  Modal,
390
396
  SearchContext,
391
- Core: Blacklight,
392
- onLoad: Blacklight.onLoad
397
+ Core,
398
+ onLoad: Core.onLoad
393
399
  };
394
400
 
395
401
  export { index as default };
@@ -1 +1 @@
1
- {"version":3,"file":"blacklight.esm.js","sources":["../../../javascript/blacklight/checkbox_submit.js","../../../javascript/blacklight/bookmark_toggle.js","../../../javascript/blacklight/button_focus.js","../../../javascript/blacklight/modal.js","../../../javascript/blacklight/search_context.js","../../../javascript/blacklight/core.js","../../../javascript/blacklight/index.js"],"sourcesContent":["/* Converts a \"toggle\" form, with single submit button to add/remove\n something, like used for Bookmarks, into an AJAXy checkbox instead.\n Apply to a form. Does require certain assumption about the form:\n 1) The same form 'action' href must be used for both ADD and REMOVE\n actions, with the different being the hidden input name=\"_method\"\n being set to \"put\" or \"delete\" -- that's the Rails method to pretend\n to be doing a certain HTTP verb. So same URL, PUT to add, DELETE\n to remove. This plugin assumes that.\n Plus, the form this is applied to should provide a data-doc-id\n attribute (HTML5-style doc-*) that contains the id/primary key\n of the object in question -- used by plugin for a unique value for\n DOM id's.\n Uses HTML for a checkbox compatible with Bootstrap 4.\n new CheckboxSubmit(document.querySelector('form.something')).render()\n*/\nexport default class CheckboxSubmit {\n constructor(form) {\n this.form = form\n }\n\n clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n fetch(this.formTarget.getAttribute('action'), {\n body: new FormData(this.formTarget),\n method: this.formTarget.getAttribute('method').toUpperCase(),\n headers: {\n 'Accept': 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content\n }\n }).then((response) => {\n if (response.ok) return response.json();\n return Promise.reject('response was not ok')\n }).then((json) => {\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n this.updateStateFor(!this.checked)\n document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count\n }).catch((error) => {\n this.handleError(error)\n })\n }\n\n get checked() {\n return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)\n }\n\n get formTarget() {\n return this.form\n }\n\n get labelTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"label\"]')\n }\n\n get checkboxTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"checkbox\"]')\n }\n\n get spanTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"span\"]')\n }\n\n handleError() {\n alert(\"Unable to save the bookmark at this time.\")\n }\n\n updateStateFor(state) {\n this.checkboxTarget.checked = state\n\n if (state) {\n this.labelTarget.classList.add('checked')\n //Set the Rails hidden field that fakes an HTTP verb\n //properly for current state action.\n this.formTarget.querySelector('input[name=_method]').value = 'delete'\n this.spanTarget.innerHTML = this.form.getAttribute('data-present')\n } else {\n this.labelTarget.classList.remove('checked')\n this.formTarget.querySelector('input[name=_method]').value = 'put'\n this.spanTarget.innerHTML = this.form.getAttribute('data-absent')\n }\n }\n}\n","import CheckboxSubmit from 'blacklight/checkbox_submit'\n\nconst BookmarkToggle = (e) => {\n if (e.target.matches('[data-checkboxsubmit-target=\"checkbox\"]')) {\n const form = e.target.closest('form')\n if (form) new CheckboxSubmit(form).clicked(e);\n }\n};\n\ndocument.addEventListener('click', BookmarkToggle);\n\nexport default BookmarkToggle\n","const ButtonFocus = (e) => {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n if (e.target.matches('[data-toggle=\"collapse\"]') || e.target.matches('[data-bs-toggle=\"collapse\"]')) {\n e.target.focus()\n }\n}\n\ndocument.addEventListener('click', ButtonFocus)\n\nexport default ButtonFocus\n","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `<div data-blacklight-modal=\"container\">` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n <div data-blacklight-modal=\"container\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-bl-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h3 class=\"modal-title\">Request Placed</h3>\n </div>\n\n <div class=\"modal-body\">\n <p>Some message</p>\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n </div>\n\n\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bl-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n\n One additional feature. If the content returned from the AJAX form submission\n can be a turbo-stream that defines some HTML fragementsand where on the page to put them:\n https://turbo.hotwired.dev/handbook/streams\n*/\nimport ModalForm from 'blacklight/modalForm'\n\nconst Modal = (() => {\n const modal = {}\n\n // a Bootstrap modal div that should be already on the page hidden\n modal.modalSelector = '#blacklight-modal';\n\n // Trigger selectors identify forms or hyperlinks that should open\n // inside a modal dialog.\n modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\n\n // preserve selectors identify forms or hyperlinks that, if activated already\n // inside a modal dialog, should have destinations remain inside the modal -- but\n // won't trigger a modal if not already in one.\n //\n // No need to repeat selectors from trigger selectors, those will already\n // be preserved. MUST be manually prefixed with the modal selector,\n // so they only apply to things inside a modal.\n modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\n\n modal.containerSelector = '[data-blacklight-modal~=container]';\n\n // Called on fatal failure of ajax load, function returns content\n // to show to user in modal. Right now called only for network errors.\n modal.onFailure = function (error) {\n console.error('Server error:', this.url, error);\n\n const contents = `<div class=\"modal-header\">\n <div class=\"modal-title\">There was a problem with your request.</div>\n <button type=\"button\" class=\"blacklight-modal-close btn-close close\" data-bl-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <p>Expected a successful response from the server, but got an error</p>\n <pre>${this.url}\\n${error}</pre>\n </div>`\n\n document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents\n\n modal.show();\n }\n\n // Add the passed in contents to the modal and display it.\n // We have specific handling so that scripts returned from the ajax call are executed.\n // This enables adding a script like recaptcha to prevent bots from sending emails.\n modal.receiveAjax = function (contents) {\n const domparser = new DOMParser();\n const dom = domparser.parseFromString(contents, \"text/html\")\n // If there is a containerSelector on the document, use its children.\n let elements = dom.querySelectorAll(`${modal.containerSelector} > *`)\n const frag = document.createDocumentFragment()\n if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n elements.forEach((el) => frag.appendChild(el))\n modal.activateScripts(frag)\n \n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)\n\n modal.show();\n };\n\n // DOMParser doesn't allow scripts to be executed. This fixes that.\n modal.activateScripts = function (frag) {\n frag.querySelectorAll('script').forEach((script) => {\n const fixedScript = document.createElement('script')\n fixedScript.src = script.src\n fixedScript.async = false\n script.parentNode.replaceChild(fixedScript, script)\n })\n }\n\n modal.modalAjaxLinkClick = function(e) {\n e.preventDefault();\n const href = e.target.getAttribute('href')\n fetch(href)\n .then(response => {\n if (!response.ok) {\n throw new TypeError(\"Request failed\");\n }\n return response.text();\n })\n .then(data => modal.receiveAjax(data))\n .catch(error => modal.onFailure(error))\n };\n\n modal.setupModal = function() {\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n document.addEventListener('click', (e) => {\n if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))\n modal.modalAjaxLinkClick(e)\n else if (e.target.closest('[data-bl-dismiss=\"modal\"]'))\n modal.hide()\n })\n };\n\n modal.hide = function (el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (!dom.open) return\n dom.close()\n }\n\n modal.show = function(el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (dom.open) return\n dom.showModal()\n }\n\n modal.setupModal()\n\n return modal;\n})()\n\nexport default Modal\n","const SearchContext = (e) => {\n if (e.target.matches('[data-context-href]')) {\n SearchContext.handleSearchContextMethod.call(e.target, e)\n }\n}\n\nSearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content\nSearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nSearchContext.handleSearchContextMethod = function(event) {\n const link = this\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href')\n let target = link.getAttribute('target')\n let csrfToken = SearchContext.csrfToken()\n let csrfParam = SearchContext.csrfParam()\n let form = document.createElement('form')\n form.method = 'post'\n form.action = href\n\n\n let formContent = `<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"${link.getAttribute('href')}\" type=\"hidden\" />`\n\n // check for meta keys.. if set, we should open in a new tab\n if(event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += `<input name=\"${csrfParam}\" value=\"${csrfToken}\" type=\"hidden\" />`\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '<input type=\"submit\" />'\n\n if (target) { form.setAttribute('target', target); }\n\n form.style.display = 'none'\n form.innerHTML = formContent\n document.body.appendChild(form)\n form.querySelector('[type=\"submit\"]').click()\n\n event.preventDefault()\n};\n\ndocument.addEventListener('click', SearchContext)\n\nexport default SearchContext\n","const Blacklight = function() {\n const buffer = new Array;\n return {\n onLoad: function(func) {\n buffer.push(func);\n },\n\n activate: function() {\n for(let i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n\n listeners: function () {\n const listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load', 'turbo:frame-load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nBlacklight.listeners().forEach(function(listener) {\n document.addEventListener(listener, function() {\n Blacklight.activate()\n })\n})\n\nBlacklight.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n\n elem.classList.remove('no-js')\n elem.classList.add('js')\n})\n\n\nexport default Blacklight\n","import BookmarkToggle from 'blacklight/bookmark_toggle'\nimport ButtonFocus from 'blacklight/button_focus'\nimport Modal from 'blacklight/modal'\nimport SearchContext from 'blacklight/search_context'\nimport Core from 'blacklight/core'\n\nexport default {\n BookmarkToggle,\n ButtonFocus,\n Modal,\n SearchContext,\n Core,\n onLoad: Core.onLoad\n}\n"],"names":["Core"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAM,cAAc,CAAC;AACpC,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG,EAAE;AACf,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAC;AACzE,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC7D,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;AAClD,MAAM,IAAI,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;AACzC,MAAM,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE;AAClE,MAA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CAAC;AAC3C,OAAO;AACP;AACA,MAAM,OAAO,SAAS,CAAC;AACvB,KAAK;AACL,GAAG,CAAC;AACJ,CAAC,EAAE,CAAC;AACJ;AACA;AACA;AACA,UAAU,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,SAAS,QAAQ,EAAE;AAClD,EAAE,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW;AACjD,IAAI,UAAU,CAAC,QAAQ,GAAE;AACzB,GAAG,EAAC;AACJ,CAAC,EAAC;AACF;AACA,UAAU,CAAC,MAAM,CAAC,YAAY;AAC9B,EAAE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD;AACA;AACA;AACA,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO;AACpB;AACA,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAC;AAChC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAC;AAC1B,CAAC;;AC7CD,cAAe;AACf,EAAE,cAAc;AAChB,EAAE,WAAW;AACb,EAAE,KAAK;AACP,EAAE,aAAa;AACf,QAAEA,UAAI;AACN,EAAE,MAAM,EAAEA,UAAI,CAAC,MAAM;AACrB;;;;"}
1
+ {"version":3,"file":"blacklight.esm.js","sources":["../../../javascript/blacklight/checkbox_submit.js","../../../javascript/blacklight/bookmark_toggle.js","../../../javascript/blacklight/button_focus.js","../../../javascript/blacklight/modal.js","../../../javascript/blacklight/search_context.js","../../../javascript/blacklight/core.js","../../../javascript/blacklight/index.js"],"sourcesContent":["/* Converts a \"toggle\" form, with single submit button to add/remove\n something, like used for Bookmarks, into an AJAXy checkbox instead.\n Apply to a form. Does require certain assumption about the form:\n 1) The same form 'action' href must be used for both ADD and REMOVE\n actions, with the different being the hidden input name=\"_method\"\n being set to \"put\" or \"delete\" -- that's the Rails method to pretend\n to be doing a certain HTTP verb. So same URL, PUT to add, DELETE\n to remove. This plugin assumes that.\n Plus, the form this is applied to should provide a data-doc-id\n attribute (HTML5-style doc-*) that contains the id/primary key\n of the object in question -- used by plugin for a unique value for\n DOM id's.\n Uses HTML for a checkbox compatible with Bootstrap 4.\n new CheckboxSubmit(document.querySelector('form.something')).render()\n*/\nexport default class CheckboxSubmit {\n constructor(form) {\n this.form = form\n }\n\n clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n fetch(this.formTarget.getAttribute('action'), {\n body: new FormData(this.formTarget),\n method: this.formTarget.getAttribute('method').toUpperCase(),\n headers: {\n 'Accept': 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content\n }\n }).then((response) => {\n if (response.ok) return response.json();\n return Promise.reject('response was not ok')\n }).then((json) => {\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n this.updateStateFor(!this.checked)\n this.bookmarksCounter().forEach(counter => {\n counter.innerHTML = json.bookmarks.count;\n });\n }).catch((error) => {\n this.handleError(error)\n })\n }\n\n get checked() {\n return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)\n }\n\n get formTarget() {\n return this.form\n }\n\n get labelTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"label\"]')\n }\n\n get checkboxTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"checkbox\"]')\n }\n\n get spanTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"span\"]')\n }\n\n bookmarksCounter() {\n return document.querySelectorAll('[data-role=\"bookmark-counter\"]')\n }\n\n handleError() {\n alert(\"Unable to save the bookmark at this time.\")\n }\n\n updateStateFor(state) {\n this.checkboxTarget.checked = state\n\n if (state) {\n this.labelTarget.classList.add('checked')\n //Set the Rails hidden field that fakes an HTTP verb\n //properly for current state action.\n this.formTarget.querySelector('input[name=_method]').value = 'delete'\n this.spanTarget.innerHTML = this.form.getAttribute('data-present')\n } else {\n this.labelTarget.classList.remove('checked')\n this.formTarget.querySelector('input[name=_method]').value = 'put'\n this.spanTarget.innerHTML = this.form.getAttribute('data-absent')\n }\n }\n}\n","import CheckboxSubmit from 'blacklight/checkbox_submit'\n\nconst BookmarkToggle = (e) => {\n if (e.target.matches('[data-checkboxsubmit-target=\"checkbox\"]')) {\n const form = e.target.closest('form')\n if (form) new CheckboxSubmit(form).clicked(e);\n }\n};\n\ndocument.addEventListener('click', BookmarkToggle);\n\nexport default BookmarkToggle\n","const ButtonFocus = (e) => {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n if (e.target.matches('[data-toggle=\"collapse\"]') || e.target.matches('[data-bs-toggle=\"collapse\"]')) {\n e.target.focus()\n }\n}\n\ndocument.addEventListener('click', ButtonFocus)\n\nexport default ButtonFocus\n","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `<div data-blacklight-modal=\"container\">` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n <div data-blacklight-modal=\"container\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-bl-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h3 class=\"modal-title\">Request Placed</h3>\n </div>\n\n <div class=\"modal-body\">\n <p>Some message</p>\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n </div>\n\n\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bl-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n\n One additional feature. If the content returned from the AJAX form submission\n can be a turbo-stream that defines some HTML fragementsand where on the page to put them:\n https://turbo.hotwired.dev/handbook/streams\n*/\nimport ModalForm from 'blacklight/modalForm'\n\nconst Modal = (() => {\n const modal = {}\n\n // a Bootstrap modal div that should be already on the page hidden\n modal.modalSelector = '#blacklight-modal';\n\n // Trigger selectors identify forms or hyperlinks that should open\n // inside a modal dialog.\n modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\n\n // preserve selectors identify forms or hyperlinks that, if activated already\n // inside a modal dialog, should have destinations remain inside the modal -- but\n // won't trigger a modal if not already in one.\n //\n // No need to repeat selectors from trigger selectors, those will already\n // be preserved. MUST be manually prefixed with the modal selector,\n // so they only apply to things inside a modal.\n modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\n\n modal.containerSelector = '[data-blacklight-modal~=container]';\n\n // Called on fatal failure of ajax load, function returns content\n // to show to user in modal. Right now called only for network errors.\n modal.onFailure = function (error) {\n console.error('Server error:', this.url, error);\n\n const contents = `<div class=\"modal-header\">\n <div class=\"modal-title\">There was a problem with your request.</div>\n <button type=\"button\" class=\"blacklight-modal-close btn-close close\" data-bl-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <p>Expected a successful response from the server, but got an error</p>\n <pre>${this.url}\\n${error}</pre>\n </div>`\n\n document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents\n\n modal.show();\n }\n\n // Add the passed in contents to the modal and display it.\n // We have specific handling so that scripts returned from the ajax call are executed.\n // This enables adding a script like recaptcha to prevent bots from sending emails.\n modal.receiveAjax = function (contents) {\n const domparser = new DOMParser();\n const dom = domparser.parseFromString(contents, \"text/html\")\n // If there is a containerSelector on the document, use its children.\n let elements = dom.querySelectorAll(`${modal.containerSelector} > *`)\n const frag = document.createDocumentFragment()\n if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n elements.forEach((el) => frag.appendChild(el))\n modal.activateScripts(frag)\n \n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)\n\n modal.show();\n };\n\n // DOMParser doesn't allow scripts to be executed. This fixes that.\n modal.activateScripts = function (frag) {\n frag.querySelectorAll('script').forEach((script) => {\n const fixedScript = document.createElement('script')\n fixedScript.src = script.src\n fixedScript.async = false\n script.parentNode.replaceChild(fixedScript, script)\n })\n }\n\n modal.modalAjaxLinkClick = function(e) {\n e.preventDefault();\n const href = e.target.getAttribute('href')\n fetch(href)\n .then(response => {\n if (!response.ok) {\n throw new TypeError(\"Request failed\");\n }\n return response.text();\n })\n .then(data => modal.receiveAjax(data))\n .catch(error => modal.onFailure(error))\n };\n\n modal.setupModal = function() {\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n document.addEventListener('click', (e) => {\n if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))\n modal.modalAjaxLinkClick(e)\n else if (e.target.closest('[data-bl-dismiss=\"modal\"]'))\n modal.hide()\n })\n };\n\n modal.hide = function (el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (!dom.open) return\n dom.close()\n }\n\n modal.show = function(el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (dom.open) return\n dom.showModal()\n }\n\n modal.setupModal()\n\n return modal;\n})()\n\nexport default Modal\n","const SearchContext = (e) => {\n if (e.target.matches('[data-context-href]')) {\n SearchContext.handleSearchContextMethod.call(e.target, e)\n }\n}\n\nSearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content\nSearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nSearchContext.handleSearchContextMethod = function(event) {\n const link = this\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href')\n let target = link.getAttribute('target')\n let csrfToken = SearchContext.csrfToken()\n let csrfParam = SearchContext.csrfParam()\n let form = document.createElement('form')\n form.method = 'post'\n form.action = href\n\n\n let formContent = `<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"${link.getAttribute('href')}\" type=\"hidden\" />`\n\n // check for meta keys.. if set, we should open in a new tab\n if(event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += `<input name=\"${csrfParam}\" value=\"${csrfToken}\" type=\"hidden\" />`\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '<input type=\"submit\" />'\n\n if (target) { form.setAttribute('target', target); }\n\n form.style.display = 'none'\n form.innerHTML = formContent\n document.body.appendChild(form)\n form.querySelector('[type=\"submit\"]').click()\n\n event.preventDefault()\n};\n\ndocument.addEventListener('click', SearchContext)\n\nexport default SearchContext\n","const Core = function() {\n const buffer = new Array;\n return {\n onLoad: function(func) {\n buffer.push(func);\n },\n\n activate: function() {\n for(let i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n\n listeners: function () {\n const listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load', 'turbo:frame-load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nCore.listeners().forEach(function(listener) {\n document.addEventListener(listener, function() {\n Core.activate()\n })\n})\n\nCore.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n\n elem.classList.remove('no-js')\n elem.classList.add('js')\n})\n\n\nexport default Core\n","import BookmarkToggle from 'blacklight/bookmark_toggle'\nimport ButtonFocus from 'blacklight/button_focus'\nimport Modal from 'blacklight/modal'\nimport SearchContext from 'blacklight/search_context'\nimport Core from 'blacklight/core'\n\nexport default {\n BookmarkToggle,\n ButtonFocus,\n Modal,\n SearchContext,\n Core,\n onLoad: Core.onLoad\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAM,cAAc,CAAC;AACpC,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG,EAAE;AACf,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAC;AACzE,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC7D,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,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disabled');
45
45
  this.updateStateFor(!this.checked);
46
- document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count;
46
+ this.bookmarksCounter().forEach(counter => {
47
+ counter.innerHTML = json.bookmarks.count;
48
+ });
47
49
  }).catch((error) => {
48
50
  this.handleError(error);
49
51
  });
@@ -69,6 +71,10 @@
69
71
  return this.form.querySelector('[data-checkboxsubmit-target="span"]')
70
72
  }
71
73
 
74
+ bookmarksCounter() {
75
+ return document.querySelectorAll('[data-role="bookmark-counter"]')
76
+ }
77
+
72
78
  handleError() {
73
79
  alert("Unable to save the bookmark at this time.");
74
80
  }
@@ -336,7 +342,7 @@
336
342
 
337
343
  document.addEventListener('click', SearchContext);
338
344
 
339
- const Blacklight = function() {
345
+ const Core = function() {
340
346
  const buffer = new Array;
341
347
  return {
342
348
  onLoad: function(func) {
@@ -372,13 +378,13 @@
372
378
 
373
379
  // turbolinks triggers page:load events on page transition
374
380
  // If app isn't using turbolinks, this event will never be triggered, no prob.
375
- Blacklight.listeners().forEach(function(listener) {
381
+ Core.listeners().forEach(function(listener) {
376
382
  document.addEventListener(listener, function() {
377
- Blacklight.activate();
383
+ Core.activate();
378
384
  });
379
385
  });
380
386
 
381
- Blacklight.onLoad(function () {
387
+ Core.onLoad(function () {
382
388
  const elem = document.querySelector('.no-js');
383
389
 
384
390
  // The "no-js" class may already have been removed because this function is
@@ -394,8 +400,8 @@
394
400
  ButtonFocus,
395
401
  Modal,
396
402
  SearchContext,
397
- Core: Blacklight,
398
- onLoad: Blacklight.onLoad
403
+ Core,
404
+ onLoad: Core.onLoad
399
405
  };
400
406
 
401
407
  return index;