blacklight 9.0.0.beta1 → 9.0.0.beta2

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 (203) hide show
  1. checksums.yaml +4 -4
  2. data/.github/matrix.json +47 -0
  3. data/.github/workflows/build.yml +16 -0
  4. data/.github/workflows/lint.yml +25 -0
  5. data/.github/workflows/main.yml +22 -0
  6. data/.github/workflows/release_7_x_scheduled.yml +39 -0
  7. data/.github/workflows/release_8_x_scheduled.yml +39 -0
  8. data/.github/workflows/test.yml +53 -0
  9. data/.rubocop.yml +70 -2
  10. data/.rubocop_todo.yml +43 -67
  11. data/.solr_wrapper.yml +2 -0
  12. data/VERSION +1 -1
  13. data/app/assets/builds/blacklight.css +19 -15
  14. data/app/assets/javascripts/blacklight/blacklight.esm.js +31 -69
  15. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  16. data/app/assets/javascripts/blacklight/blacklight.js +31 -69
  17. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  18. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +4 -0
  19. data/app/assets/stylesheets/blacklight/_facets.scss +2 -2
  20. data/app/assets/stylesheets/blacklight/_header.scss +4 -0
  21. data/app/assets/stylesheets/blacklight/_modal.scss +9 -8
  22. data/app/assets/stylesheets/blacklight/_pagination.scss +1 -3
  23. data/app/assets/stylesheets/blacklight/_search_history.scss +0 -4
  24. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +3 -0
  25. data/app/components/blacklight/advanced_search_form_component.rb +2 -2
  26. data/app/components/blacklight/constraints_component.rb +2 -2
  27. data/app/components/blacklight/document/action_component.rb +1 -3
  28. data/app/components/blacklight/document/bookmark_component.rb +2 -2
  29. data/app/components/blacklight/document/more_like_this_component.rb +2 -2
  30. data/app/components/blacklight/document/page_header_component.rb +2 -2
  31. data/app/components/blacklight/document/thumbnail_component.html.erb +3 -7
  32. data/app/components/blacklight/document/thumbnail_component.rb +7 -6
  33. data/app/components/blacklight/document_component.rb +3 -3
  34. data/app/components/blacklight/document_title_component.rb +3 -10
  35. data/app/components/blacklight/facet_field_checkboxes_component.rb +2 -20
  36. data/app/components/blacklight/facet_field_component.rb +2 -17
  37. data/app/components/blacklight/facet_field_filter_component.rb +2 -21
  38. data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +4 -25
  39. data/app/components/blacklight/facet_field_list_component.rb +2 -32
  40. data/app/components/blacklight/facet_field_no_layout_component.rb +2 -10
  41. data/app/components/blacklight/facet_field_pagination_component.html.erb +2 -2
  42. data/app/components/blacklight/facet_item_component.rb +2 -74
  43. data/app/components/blacklight/facet_item_pivot_component.rb +1 -1
  44. data/app/components/blacklight/facets/checkboxes_component.rb +26 -0
  45. data/app/components/blacklight/facets/count_component.rb +23 -0
  46. data/app/components/blacklight/{facet_field_component.html.erb → facets/field_component.html.erb} +1 -1
  47. data/app/components/blacklight/facets/field_component.rb +23 -0
  48. data/app/components/blacklight/facets/filters_component.html.erb +4 -0
  49. data/app/components/blacklight/facets/filters_component.rb +27 -0
  50. data/app/components/blacklight/{facet_field_inclusive_constraint_component.html.erb → facets/inclusive_constraint_component.html.erb} +1 -1
  51. data/app/components/blacklight/facets/inclusive_constraint_component.rb +31 -0
  52. data/app/components/blacklight/{facet_field_filter_component.html.erb → facets/index_navigation_component.html.erb} +1 -1
  53. data/app/components/blacklight/facets/index_navigation_component.rb +32 -0
  54. data/app/components/blacklight/facets/item_component.rb +73 -0
  55. data/app/components/blacklight/facets/list_component.html.erb +11 -0
  56. data/app/components/blacklight/facets/list_component.rb +38 -0
  57. data/app/components/blacklight/facets/no_layout_component.rb +16 -0
  58. data/app/components/blacklight/facets/selected_value_component.rb +29 -0
  59. data/app/components/blacklight/facets/suggest_component.html.erb +12 -0
  60. data/app/components/blacklight/facets/suggest_component.rb +22 -0
  61. data/app/components/blacklight/metadata_field_plain_text_layout_component.rb +2 -2
  62. data/app/components/blacklight/response/facet_group_component.html.erb +1 -1
  63. data/app/components/blacklight/response/facet_group_component.rb +5 -1
  64. data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
  65. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  66. data/app/components/blacklight/top_navbar_component.html.erb +1 -1
  67. data/app/controllers/concerns/blacklight/bookmarks.rb +3 -3
  68. data/app/controllers/concerns/blacklight/catalog.rb +10 -25
  69. data/app/controllers/concerns/blacklight/controller.rb +1 -1
  70. data/app/controllers/concerns/blacklight/facetable.rb +34 -0
  71. data/app/controllers/concerns/blacklight/search_context.rb +1 -1
  72. data/app/controllers/concerns/blacklight/searchable.rb +1 -1
  73. data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -2
  74. data/app/helpers/blacklight/document_helper_behavior.rb +3 -1
  75. data/app/helpers/blacklight/facets_helper_behavior.rb +9 -0
  76. data/app/helpers/blacklight/icon_helper_behavior.rb +2 -2
  77. data/app/javascript/blacklight-frontend/checkbox_submit.js +3 -0
  78. data/app/javascript/blacklight-frontend/debounce.js +1 -1
  79. data/app/javascript/blacklight-frontend/facet_suggest.js +23 -3
  80. data/app/javascript/blacklight-frontend/index.js +0 -2
  81. data/app/javascript/blacklight-frontend/modal.js +1 -4
  82. data/app/javascript/blacklight-frontend/search_context.js +3 -2
  83. data/app/models/facet_search_builder.rb +5 -0
  84. data/app/presenters/blacklight/facet_field_presenter.rb +1 -1
  85. data/app/presenters/blacklight/json_presenter.rb +1 -3
  86. data/app/presenters/blacklight/rendering/helper_method.rb +4 -4
  87. data/app/presenters/blacklight/rendering/join.rb +2 -2
  88. data/app/services/blacklight/facet_search_service.rb +44 -0
  89. data/app/services/blacklight/field_retriever.rb +1 -1
  90. data/app/services/blacklight/search_service.rb +6 -6
  91. data/app/values/blacklight/types.rb +2 -2
  92. data/app/views/catalog/_facet_pivot.html.erb +1 -1
  93. data/app/views/catalog/_home_text.html.erb +2 -2
  94. data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
  95. data/app/views/catalog/facet.html.erb +8 -10
  96. data/config/locales/blacklight.ar.yml +2 -2
  97. data/config/locales/blacklight.es.yml +2 -2
  98. data/config/locales/blacklight.fr.yml +2 -2
  99. data/config/locales/blacklight.hu.yml +2 -2
  100. data/config/locales/blacklight.it.yml +2 -2
  101. data/config/locales/blacklight.nl.yml +1 -1
  102. data/config/locales/blacklight.pt-BR.yml +2 -2
  103. data/config/locales/blacklight.sq.yml +2 -2
  104. data/config/locales/blacklight.zh.yml +2 -2
  105. data/lib/blacklight/abstract_repository.rb +2 -2
  106. data/lib/blacklight/abstract_search_builder.rb +154 -0
  107. data/lib/blacklight/configuration/context.rb +3 -3
  108. data/lib/blacklight/configuration/facet_field.rb +6 -6
  109. data/lib/blacklight/configuration/field.rb +4 -4
  110. data/lib/blacklight/configuration/fields.rb +0 -1
  111. data/lib/blacklight/configuration/search_field.rb +1 -1
  112. data/lib/blacklight/configuration/view_config.rb +2 -2
  113. data/lib/blacklight/configuration.rb +6 -7
  114. data/lib/blacklight/facet_search_builder.rb +18 -0
  115. data/lib/blacklight/nested_open_struct_with_hash_access.rb +1 -1
  116. data/lib/blacklight/open_struct_with_hash_access.rb +2 -2
  117. data/lib/blacklight/search_builder.rb +1 -159
  118. data/lib/blacklight/search_state/filter_field.rb +4 -4
  119. data/lib/blacklight/search_state/pivot_filter_field.rb +4 -4
  120. data/lib/blacklight/solr/abstract_filter_query_builder.rb +77 -0
  121. data/lib/blacklight/solr/default_filter_query_builder.rb +20 -0
  122. data/lib/blacklight/solr/facet_search_builder_behavior.rb +62 -0
  123. data/lib/blacklight/solr/repository.rb +8 -9
  124. data/lib/blacklight/solr/response/facets.rb +2 -2
  125. data/lib/blacklight/solr/response/params.rb +0 -4
  126. data/lib/blacklight/solr/response.rb +5 -1
  127. data/lib/blacklight/solr/search_builder_behavior.rb +17 -132
  128. data/lib/blacklight.rb +1 -1
  129. data/lib/generators/blacklight/assets/importmap_generator.rb +3 -5
  130. data/lib/generators/blacklight/assets_generator.rb +1 -1
  131. data/lib/generators/blacklight/search_builder_generator.rb +1 -1
  132. data/lib/generators/blacklight/templates/.solr_wrapper.yml +2 -0
  133. data/lib/generators/blacklight/templates/catalog_controller.rb +3 -1
  134. data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +0 -4
  135. data/package.json +3 -3
  136. data/spec/components/blacklight/advanced_search_form_component_spec.rb +18 -22
  137. data/spec/components/blacklight/constraint_layout_component_spec.rb +8 -8
  138. data/spec/components/blacklight/constraints_component_spec.rb +11 -11
  139. data/spec/components/blacklight/document/action_component_spec.rb +23 -15
  140. data/spec/components/blacklight/document/group_component_spec.rb +10 -15
  141. data/spec/components/blacklight/document/page_header_component_spec.rb +35 -28
  142. data/spec/components/blacklight/document/sidebar_component_spec.rb +5 -11
  143. data/spec/components/blacklight/document_component_spec.rb +98 -65
  144. data/spec/components/blacklight/facet_component_spec.rb +12 -8
  145. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +12 -12
  146. data/spec/components/blacklight/{facet_field_checkboxes_component_spec.rb → facets/checkboxes_component_spec.rb} +13 -13
  147. data/spec/components/blacklight/facets/filters_component_spec.rb +36 -0
  148. data/spec/components/blacklight/facets/index_navigation_component_spec.rb +40 -0
  149. data/spec/components/blacklight/{facet_item_component_spec.rb → facets/item_component_spec.rb} +10 -10
  150. data/spec/components/blacklight/{facet_field_list_component_spec.rb → facets/list_component_spec.rb} +23 -23
  151. data/spec/components/blacklight/facets/suggest_component_spec.rb +68 -0
  152. data/spec/components/blacklight/header_component_spec.rb +2 -4
  153. data/spec/components/blacklight/hidden_search_state_component_spec.rb +7 -7
  154. data/spec/components/blacklight/metadata_field_component_spec.rb +17 -15
  155. data/spec/components/blacklight/response/facet_group_component_spec.rb +37 -0
  156. data/spec/components/blacklight/response/pagination_component_spec.rb +1 -1
  157. data/spec/components/blacklight/response/spellcheck_component_spec.rb +1 -1
  158. data/spec/components/blacklight/search_bar_component_spec.rb +4 -4
  159. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +2 -2
  160. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +3 -5
  161. data/spec/components/blacklight/skip_link_component_spec.rb +8 -11
  162. data/spec/components/blacklight/start_over_button_component_spec.rb +4 -4
  163. data/spec/components/blacklight/system/dropdown_component_spec.rb +26 -0
  164. data/spec/components/blacklight/system/flash_message_component_spec.rb +7 -11
  165. data/spec/controllers/catalog_controller_spec.rb +12 -20
  166. data/spec/features/facets_spec.rb +70 -7
  167. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +10 -0
  168. data/spec/lib/blacklight/configuration/facet_field_spec.rb +2 -2
  169. data/spec/lib/blacklight/parameters_spec.rb +12 -1
  170. data/spec/lib/blacklight/search_state/filter_field_spec.rb +18 -0
  171. data/spec/models/blacklight/configuration_spec.rb +32 -28
  172. data/spec/models/blacklight/facet_search_builder_spec.rb +19 -0
  173. data/spec/models/blacklight/search_builder_spec.rb +1 -11
  174. data/spec/models/blacklight/solr/default_filter_query_builder_spec.rb +72 -0
  175. data/spec/models/blacklight/solr/document_spec.rb +0 -4
  176. data/spec/models/blacklight/solr/facet_search_builder_behavior_spec.rb +929 -0
  177. data/spec/models/blacklight/solr/repository_spec.rb +31 -29
  178. data/spec/models/blacklight/solr/response/facets_spec.rb +86 -40
  179. data/spec/models/blacklight/solr/response/group_response_spec.rb +8 -5
  180. data/spec/models/blacklight/solr/response/group_spec.rb +9 -5
  181. data/spec/models/blacklight/solr/response_spec.rb +96 -64
  182. data/spec/models/blacklight/solr/search_builder_behavior_spec.rb +2 -227
  183. data/spec/models/solr_document_spec.rb +5 -1
  184. data/spec/services/blacklight/search_service_spec.rb +6 -27
  185. data/spec/spec_helper.rb +0 -1
  186. data/spec/support/view_component_test_helpers.rb +0 -18
  187. data/spec/views/catalog/facet.html.erb_spec.rb +10 -3
  188. data/spec/views/catalog/index.atom.builder_spec.rb +6 -3
  189. data/spec/views/catalog/index.html.erb_spec.rb +3 -1
  190. metadata +58 -29
  191. data/.github/workflows/ruby.yml +0 -98
  192. data/app/components/blacklight/facet_field_list_component.html.erb +0 -19
  193. data/app/components/blacklight/search/facet_suggest_input.html.erb +0 -9
  194. data/app/components/blacklight/search/facet_suggest_input.rb +0 -16
  195. data/app/javascript/blacklight-frontend/modalForm.js +0 -60
  196. data/app/views/catalog/_facet_index_navigation.html.erb +0 -1
  197. data/app/views/catalog/_facet_layout.html.erb +0 -8
  198. data/app/views/catalog/_facet_pagination.html.erb +0 -1
  199. data/spec/components/blacklight/document_metadata_component_spec.rb +0 -0
  200. data/spec/components/blacklight/search/facet_suggest_input_spec.rb +0 -33
  201. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +0 -43
  202. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +0 -41
  203. /data/app/components/blacklight/{facet_field_checkboxes_component.html.erb → facets/checkboxes_component.html.erb} +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.0.beta1
4
+ version: 9.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -16,7 +16,7 @@ authors:
16
16
  - Justin Coyne
17
17
  bindir: exe
18
18
  cert_chain: []
19
- date: 2025-02-06 00:00:00.000000000 Z
19
+ date: 2025-06-18 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rails
@@ -409,8 +409,14 @@ files:
409
409
  - ".docker/app/entrypoint.sh"
410
410
  - ".dockerignore"
411
411
  - ".env"
412
+ - ".github/matrix.json"
412
413
  - ".github/pull_request_template.md"
413
- - ".github/workflows/ruby.yml"
414
+ - ".github/workflows/build.yml"
415
+ - ".github/workflows/lint.yml"
416
+ - ".github/workflows/main.yml"
417
+ - ".github/workflows/release_7_x_scheduled.yml"
418
+ - ".github/workflows/release_8_x_scheduled.yml"
419
+ - ".github/workflows/test.yml"
414
420
  - ".gitignore"
415
421
  - ".hound.yml"
416
422
  - ".jshintrc"
@@ -488,21 +494,34 @@ files:
488
494
  - app/components/blacklight/document_title_component.html.erb
489
495
  - app/components/blacklight/document_title_component.rb
490
496
  - app/components/blacklight/facet_component.rb
491
- - app/components/blacklight/facet_field_checkboxes_component.html.erb
492
497
  - app/components/blacklight/facet_field_checkboxes_component.rb
493
- - app/components/blacklight/facet_field_component.html.erb
494
498
  - app/components/blacklight/facet_field_component.rb
495
- - app/components/blacklight/facet_field_filter_component.html.erb
496
499
  - app/components/blacklight/facet_field_filter_component.rb
497
- - app/components/blacklight/facet_field_inclusive_constraint_component.html.erb
498
500
  - app/components/blacklight/facet_field_inclusive_constraint_component.rb
499
- - app/components/blacklight/facet_field_list_component.html.erb
500
501
  - app/components/blacklight/facet_field_list_component.rb
501
502
  - app/components/blacklight/facet_field_no_layout_component.rb
502
503
  - app/components/blacklight/facet_field_pagination_component.html.erb
503
504
  - app/components/blacklight/facet_field_pagination_component.rb
504
505
  - app/components/blacklight/facet_item_component.rb
505
506
  - app/components/blacklight/facet_item_pivot_component.rb
507
+ - app/components/blacklight/facets/checkboxes_component.html.erb
508
+ - app/components/blacklight/facets/checkboxes_component.rb
509
+ - app/components/blacklight/facets/count_component.rb
510
+ - app/components/blacklight/facets/field_component.html.erb
511
+ - app/components/blacklight/facets/field_component.rb
512
+ - app/components/blacklight/facets/filters_component.html.erb
513
+ - app/components/blacklight/facets/filters_component.rb
514
+ - app/components/blacklight/facets/inclusive_constraint_component.html.erb
515
+ - app/components/blacklight/facets/inclusive_constraint_component.rb
516
+ - app/components/blacklight/facets/index_navigation_component.html.erb
517
+ - app/components/blacklight/facets/index_navigation_component.rb
518
+ - app/components/blacklight/facets/item_component.rb
519
+ - app/components/blacklight/facets/list_component.html.erb
520
+ - app/components/blacklight/facets/list_component.rb
521
+ - app/components/blacklight/facets/no_layout_component.rb
522
+ - app/components/blacklight/facets/selected_value_component.rb
523
+ - app/components/blacklight/facets/suggest_component.html.erb
524
+ - app/components/blacklight/facets/suggest_component.rb
506
525
  - app/components/blacklight/header_component.html.erb
507
526
  - app/components/blacklight/header_component.rb
508
527
  - app/components/blacklight/hidden_search_state_component.rb
@@ -530,8 +549,6 @@ files:
530
549
  - app/components/blacklight/response/view_type_button_component.rb
531
550
  - app/components/blacklight/response/view_type_component.html.erb
532
551
  - app/components/blacklight/response/view_type_component.rb
533
- - app/components/blacklight/search/facet_suggest_input.html.erb
534
- - app/components/blacklight/search/facet_suggest_input.rb
535
552
  - app/components/blacklight/search/per_page_component.html.erb
536
553
  - app/components/blacklight/search/per_page_component.rb
537
554
  - app/components/blacklight/search/sidebar_component.html.erb
@@ -566,6 +583,7 @@ files:
566
583
  - app/controllers/concerns/blacklight/bookmarks.rb
567
584
  - app/controllers/concerns/blacklight/catalog.rb
568
585
  - app/controllers/concerns/blacklight/controller.rb
586
+ - app/controllers/concerns/blacklight/facetable.rb
569
587
  - app/controllers/concerns/blacklight/search_context.rb
570
588
  - app/controllers/concerns/blacklight/search_history.rb
571
589
  - app/controllers/concerns/blacklight/searchable.rb
@@ -591,7 +609,6 @@ files:
591
609
  - app/javascript/blacklight-frontend/facet_suggest.js
592
610
  - app/javascript/blacklight-frontend/index.js
593
611
  - app/javascript/blacklight-frontend/modal.js
594
- - app/javascript/blacklight-frontend/modalForm.js
595
612
  - app/javascript/blacklight-frontend/search_context.js
596
613
  - app/models/blacklight/facet_paginator.rb
597
614
  - app/models/blacklight/icon.rb
@@ -609,6 +626,7 @@ files:
609
626
  - app/models/concerns/blacklight/document/semantic_fields.rb
610
627
  - app/models/concerns/blacklight/suggest/response.rb
611
628
  - app/models/concerns/blacklight/user.rb
629
+ - app/models/facet_search_builder.rb
612
630
  - app/models/record_mailer.rb
613
631
  - app/models/search.rb
614
632
  - app/models/search_builder.rb
@@ -636,6 +654,7 @@ files:
636
654
  - app/presenters/blacklight/thumbnail_presenter.rb
637
655
  - app/services/blacklight/bookmarks_search_builder.rb
638
656
  - app/services/blacklight/document_factory.rb
657
+ - app/services/blacklight/facet_search_service.rb
639
658
  - app/services/blacklight/field_retriever.rb
640
659
  - app/services/blacklight/search_params_yaml_coder.rb
641
660
  - app/services/blacklight/search_service.rb
@@ -655,9 +674,6 @@ files:
655
674
  - app/views/catalog/_document.rss.builder
656
675
  - app/views/catalog/_document_list.html.erb
657
676
  - app/views/catalog/_email_form.html.erb
658
- - app/views/catalog/_facet_index_navigation.html.erb
659
- - app/views/catalog/_facet_layout.html.erb
660
- - app/views/catalog/_facet_pagination.html.erb
661
677
  - app/views/catalog/_facet_pivot.html.erb
662
678
  - app/views/catalog/_field.json.jbuilder
663
679
  - app/views/catalog/_group.html.erb
@@ -740,6 +756,7 @@ files:
740
756
  - db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb
741
757
  - lib/blacklight.rb
742
758
  - lib/blacklight/abstract_repository.rb
759
+ - lib/blacklight/abstract_search_builder.rb
743
760
  - lib/blacklight/component.rb
744
761
  - lib/blacklight/configuration.rb
745
762
  - lib/blacklight/configuration/context.rb
@@ -758,6 +775,7 @@ files:
758
775
  - lib/blacklight/configuration/view_config.rb
759
776
  - lib/blacklight/engine.rb
760
777
  - lib/blacklight/exceptions.rb
778
+ - lib/blacklight/facet_search_builder.rb
761
779
  - lib/blacklight/nested_open_struct_with_hash_access.rb
762
780
  - lib/blacklight/open_struct_with_hash_access.rb
763
781
  - lib/blacklight/parameters.rb
@@ -770,8 +788,11 @@ files:
770
788
  - lib/blacklight/search_state/filter_field.rb
771
789
  - lib/blacklight/search_state/pivot_filter_field.rb
772
790
  - lib/blacklight/solr.rb
791
+ - lib/blacklight/solr/abstract_filter_query_builder.rb
792
+ - lib/blacklight/solr/default_filter_query_builder.rb
773
793
  - lib/blacklight/solr/document.rb
774
794
  - lib/blacklight/solr/facet_paginator.rb
795
+ - lib/blacklight/solr/facet_search_builder_behavior.rb
775
796
  - lib/blacklight/solr/repository.rb
776
797
  - lib/blacklight/solr/request.rb
777
798
  - lib/blacklight/solr/response.rb
@@ -832,25 +853,28 @@ files:
832
853
  - spec/components/blacklight/document/page_header_component_spec.rb
833
854
  - spec/components/blacklight/document/sidebar_component_spec.rb
834
855
  - spec/components/blacklight/document_component_spec.rb
835
- - spec/components/blacklight/document_metadata_component_spec.rb
836
856
  - spec/components/blacklight/facet_component_spec.rb
837
- - spec/components/blacklight/facet_field_checkboxes_component_spec.rb
838
- - spec/components/blacklight/facet_field_list_component_spec.rb
839
- - spec/components/blacklight/facet_item_component_spec.rb
840
857
  - spec/components/blacklight/facet_item_pivot_component_spec.rb
858
+ - spec/components/blacklight/facets/checkboxes_component_spec.rb
859
+ - spec/components/blacklight/facets/filters_component_spec.rb
860
+ - spec/components/blacklight/facets/index_navigation_component_spec.rb
861
+ - spec/components/blacklight/facets/item_component_spec.rb
862
+ - spec/components/blacklight/facets/list_component_spec.rb
863
+ - spec/components/blacklight/facets/suggest_component_spec.rb
841
864
  - spec/components/blacklight/header_component_spec.rb
842
865
  - spec/components/blacklight/hidden_search_state_component_spec.rb
843
866
  - spec/components/blacklight/icons/icon_component_spec.rb
844
867
  - spec/components/blacklight/metadata_field_component_spec.rb
868
+ - spec/components/blacklight/response/facet_group_component_spec.rb
845
869
  - spec/components/blacklight/response/pagination_component_spec.rb
846
870
  - spec/components/blacklight/response/spellcheck_component_spec.rb
847
871
  - spec/components/blacklight/response/view_type_component_spec.rb
848
- - spec/components/blacklight/search/facet_suggest_input_spec.rb
849
872
  - spec/components/blacklight/search_bar_component_spec.rb
850
873
  - spec/components/blacklight/search_context/server_applied_params_component_spec.rb
851
874
  - spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
852
875
  - spec/components/blacklight/skip_link_component_spec.rb
853
876
  - spec/components/blacklight/start_over_button_component_spec.rb
877
+ - spec/components/blacklight/system/dropdown_component_spec.rb
854
878
  - spec/components/blacklight/system/flash_message_component_spec.rb
855
879
  - spec/controllers/alternate_controller_spec.rb
856
880
  - spec/controllers/application_controller_spec.rb
@@ -914,10 +938,13 @@ files:
914
938
  - spec/models/blacklight/document/dublin_core_spec.rb
915
939
  - spec/models/blacklight/document_spec.rb
916
940
  - spec/models/blacklight/facet_paginator_spec.rb
941
+ - spec/models/blacklight/facet_search_builder_spec.rb
917
942
  - spec/models/blacklight/icon_spec.rb
918
943
  - spec/models/blacklight/search_builder_spec.rb
944
+ - spec/models/blacklight/solr/default_filter_query_builder_spec.rb
919
945
  - spec/models/blacklight/solr/document_spec.rb
920
946
  - spec/models/blacklight/solr/facet_paginator_spec.rb
947
+ - spec/models/blacklight/solr/facet_search_builder_behavior_spec.rb
921
948
  - spec/models/blacklight/solr/repository_spec.rb
922
949
  - spec/models/blacklight/solr/request_spec.rb
923
950
  - spec/models/blacklight/solr/response/facets_spec.rb
@@ -961,8 +988,6 @@ files:
961
988
  - spec/test_app_templates/lib/generators/test_app_generator.rb
962
989
  - spec/views/catalog/_document.html.erb_spec.rb
963
990
  - spec/views/catalog/_document_list.html.erb_spec.rb
964
- - spec/views/catalog/_facet_index_navigation.html.erb_spec.rb
965
- - spec/views/catalog/_facet_layout.html.erb_spec.rb
966
991
  - spec/views/catalog/_paginate_compact.html.erb_spec.rb
967
992
  - spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
968
993
  - spec/views/catalog/_sort_widget.html.erb_spec.rb
@@ -998,7 +1023,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
998
1023
  - !ruby/object:Gem::Version
999
1024
  version: '0'
1000
1025
  requirements: []
1001
- rubygems_version: 3.6.2
1026
+ rubygems_version: 3.6.3
1002
1027
  specification_version: 4
1003
1028
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
1004
1029
  index.
@@ -1011,25 +1036,28 @@ test_files:
1011
1036
  - spec/components/blacklight/document/page_header_component_spec.rb
1012
1037
  - spec/components/blacklight/document/sidebar_component_spec.rb
1013
1038
  - spec/components/blacklight/document_component_spec.rb
1014
- - spec/components/blacklight/document_metadata_component_spec.rb
1015
1039
  - spec/components/blacklight/facet_component_spec.rb
1016
- - spec/components/blacklight/facet_field_checkboxes_component_spec.rb
1017
- - spec/components/blacklight/facet_field_list_component_spec.rb
1018
- - spec/components/blacklight/facet_item_component_spec.rb
1019
1040
  - spec/components/blacklight/facet_item_pivot_component_spec.rb
1041
+ - spec/components/blacklight/facets/checkboxes_component_spec.rb
1042
+ - spec/components/blacklight/facets/filters_component_spec.rb
1043
+ - spec/components/blacklight/facets/index_navigation_component_spec.rb
1044
+ - spec/components/blacklight/facets/item_component_spec.rb
1045
+ - spec/components/blacklight/facets/list_component_spec.rb
1046
+ - spec/components/blacklight/facets/suggest_component_spec.rb
1020
1047
  - spec/components/blacklight/header_component_spec.rb
1021
1048
  - spec/components/blacklight/hidden_search_state_component_spec.rb
1022
1049
  - spec/components/blacklight/icons/icon_component_spec.rb
1023
1050
  - spec/components/blacklight/metadata_field_component_spec.rb
1051
+ - spec/components/blacklight/response/facet_group_component_spec.rb
1024
1052
  - spec/components/blacklight/response/pagination_component_spec.rb
1025
1053
  - spec/components/blacklight/response/spellcheck_component_spec.rb
1026
1054
  - spec/components/blacklight/response/view_type_component_spec.rb
1027
- - spec/components/blacklight/search/facet_suggest_input_spec.rb
1028
1055
  - spec/components/blacklight/search_bar_component_spec.rb
1029
1056
  - spec/components/blacklight/search_context/server_applied_params_component_spec.rb
1030
1057
  - spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
1031
1058
  - spec/components/blacklight/skip_link_component_spec.rb
1032
1059
  - spec/components/blacklight/start_over_button_component_spec.rb
1060
+ - spec/components/blacklight/system/dropdown_component_spec.rb
1033
1061
  - spec/components/blacklight/system/flash_message_component_spec.rb
1034
1062
  - spec/controllers/alternate_controller_spec.rb
1035
1063
  - spec/controllers/application_controller_spec.rb
@@ -1093,10 +1121,13 @@ test_files:
1093
1121
  - spec/models/blacklight/document/dublin_core_spec.rb
1094
1122
  - spec/models/blacklight/document_spec.rb
1095
1123
  - spec/models/blacklight/facet_paginator_spec.rb
1124
+ - spec/models/blacklight/facet_search_builder_spec.rb
1096
1125
  - spec/models/blacklight/icon_spec.rb
1097
1126
  - spec/models/blacklight/search_builder_spec.rb
1127
+ - spec/models/blacklight/solr/default_filter_query_builder_spec.rb
1098
1128
  - spec/models/blacklight/solr/document_spec.rb
1099
1129
  - spec/models/blacklight/solr/facet_paginator_spec.rb
1130
+ - spec/models/blacklight/solr/facet_search_builder_behavior_spec.rb
1100
1131
  - spec/models/blacklight/solr/repository_spec.rb
1101
1132
  - spec/models/blacklight/solr/request_spec.rb
1102
1133
  - spec/models/blacklight/solr/response/facets_spec.rb
@@ -1140,8 +1171,6 @@ test_files:
1140
1171
  - spec/test_app_templates/lib/generators/test_app_generator.rb
1141
1172
  - spec/views/catalog/_document.html.erb_spec.rb
1142
1173
  - spec/views/catalog/_document_list.html.erb_spec.rb
1143
- - spec/views/catalog/_facet_index_navigation.html.erb_spec.rb
1144
- - spec/views/catalog/_facet_layout.html.erb_spec.rb
1145
1174
  - spec/views/catalog/_paginate_compact.html.erb_spec.rb
1146
1175
  - spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
1147
1176
  - spec/views/catalog/_sort_widget.html.erb_spec.rb
@@ -1,98 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: CI
9
-
10
- on:
11
- push:
12
- branches:
13
- - main
14
- - "release-*"
15
- pull_request:
16
-
17
- jobs:
18
- lint:
19
- runs-on: ubuntu-latest
20
- steps:
21
- - uses: actions/checkout@v4
22
- - name: Set up Ruby
23
- uses: ruby/setup-ruby@v1
24
- with:
25
- ruby-version: 3.2
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 | :"
29
- - name: Install dependencies
30
- run: bundle install
31
- - name: Run linter
32
- run: bundle exec rake rubocop
33
- test:
34
- runs-on: ubuntu-latest
35
- name: test (ruby ${{ matrix.ruby }} / rails ${{ matrix.rails_version }} ${{ matrix.additional_name }})
36
- strategy:
37
- fail-fast: false
38
- matrix:
39
- ruby: ["3.3"]
40
- rails_version: ["7.1.5.1", "7.2.2.1"]
41
- bootstrap_version: [null]
42
- view_component_version: ["~> 3.12"]
43
- api: [null]
44
- additional_engine_cart_rails_options: [""]
45
- additional_name: [""]
46
- include:
47
- - ruby: "3.3"
48
- rails_version: "8.0.1"
49
- additional_engine_cart_rails_options: --css=bootstrap
50
- - ruby: "3.3"
51
- rails_version: "8.0.1"
52
- additional_engine_cart_rails_options: --css=bootstrap --js=esbuild
53
- additional_name: "/ esbuild"
54
- - ruby: "3.2"
55
- rails_version: "7.1.5.1"
56
- solr_version: "8.11.2"
57
- additional_name: "Solr 8.11.2"
58
- - ruby: "3.1"
59
- rails_version: "7.1.5.1"
60
- - ruby: "3.3"
61
- rails_version: "7.1.5.1"
62
- additional_name: "/ Propshaft"
63
- additional_engine_cart_rails_options: -a propshaft --css=bootstrap
64
- - ruby: "3.3"
65
- rails_version: "7.1.5.1"
66
- api: "true"
67
- additional_engine_cart_rails_options: --api --skip-yarn
68
- additional_name: "/ API"
69
- - ruby: "3.3"
70
- rails_version: "7.2.2.1"
71
- additional_engine_cart_rails_options: -a propshaft --css=bootstrap --js=esbuild
72
- additional_name: "/ Propshaft, esbuild"
73
- env:
74
- RAILS_VERSION: ${{ matrix.rails_version }}
75
- SOLR_VERSION: ${{ matrix.solr_version || 'latest' }}
76
- VIEW_COMPONENT_VERSION: ${{ matrix.view_component_version }}
77
- BOOTSTRAP_VERSION: ${{ matrix.bootstrap_version }}
78
- BLACKLIGHT_API_TEST: ${{ matrix.api }}
79
- ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-kamal --skip-solid --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
80
- steps:
81
- - uses: actions/checkout@v4
82
- - name: Set up Ruby
83
- uses: ruby/setup-ruby@v1
84
- with:
85
- bundler: "latest"
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 | :"
89
- - name: Install dependencies
90
- run: bundle install
91
- - name: Run tests
92
- run: bundle exec rake ci
93
- docker_build:
94
- runs-on: ubuntu-latest
95
- steps:
96
- - uses: actions/checkout@v4
97
- - name: Build docker image
98
- run: docker compose build app
@@ -1,19 +0,0 @@
1
- <%= render(@layout.new(facet_field: @facet_field)) do |component| %>
2
- <% component.with_label do %>
3
- <%= @facet_field.label %>
4
- <% end %>
5
- <% component.with_body do %>
6
- <%= render(Blacklight::FacetFieldInclusiveConstraintComponent.new(facet_field: @facet_field)) %>
7
- <ul class="facet-values list-unstyled">
8
- <%= render facet_items %>
9
- </ul>
10
- <%# backwards compatibility, ugh %>
11
- <% if @layout == Blacklight::FacetFieldNoLayoutComponent && !@facet_field.in_modal? && @facet_field.modal_path %>
12
- <div class="more_facets">
13
- <%= link_to t("more_#{@facet_field.key}_html", scope: 'blacklight.search.facets', default: :more_html, field_name: @facet_field.label),
14
- @facet_field.modal_path,
15
- data: { blacklight_modal: 'trigger' } %>
16
- </div>
17
- <% end %>
18
- <% end %>
19
- <% end %>
@@ -1,9 +0,0 @@
1
- <label for="facet-suggest-<%= facet.key %>">
2
- <%= I18n.t('blacklight.search.facets.suggest.label', field_label: presenter&.label) %>
3
- </label>
4
- <input class="facet-suggest form-control"
5
- id="facet-suggest-<%= facet.key %>"
6
- data-facet-field="<%= facet.key %>"
7
- name="facet_suggest_<%= facet.key %>"
8
- placeholder="<%= I18n.t('blacklight.search.form.search.placeholder') %>">
9
- </input>
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Blacklight
4
- module Search
5
- class FacetSuggestInput < Blacklight::Component
6
- def initialize(facet:, presenter:)
7
- @facet = facet
8
- @presenter = presenter
9
- end
10
-
11
- private
12
-
13
- attr_accessor :facet, :presenter
14
- end
15
- end
16
- end
@@ -1,60 +0,0 @@
1
- // The email and sms forms are displayed inside a modal. When the form is submitted,
2
- // this script closes the modal and puts the output on the main part of the page.
3
- // By default it is rendering catalog/sms_success and catalog/email_succcess.
4
- // These templates deliver a payload of the format used by turbo-streams.
5
- // See https://turbo.hotwired.dev/handbook/streams
6
- // That format allows a downstream application to override the template to define
7
- // multiple customizable areas of the page to get updated.
8
- export default class {
9
- constructor(errorHandler, badRequestHandler, hideModal) {
10
- this.errorHandler = errorHandler
11
- this.badRequestHandler = badRequestHandler
12
- this.hideModal = hideModal
13
- }
14
-
15
- get triggerFormSelector() {
16
- return 'form[data-blacklight-modal~=trigger]'
17
- }
18
-
19
- bind() {
20
- document.addEventListener('submit', (e) => {
21
- if (e.target.matches(this.triggerFormSelector))
22
- this.onSubmit(e)
23
- })
24
- }
25
-
26
- // This is like a light-weight version of turbo that only supports append presently.
27
- updateTurboStream(data) {
28
- this.hideModal()
29
- const domparser = new DOMParser();
30
- const dom = domparser.parseFromString(data, "text/html")
31
- dom.querySelectorAll("turbo-stream[action='append']").forEach((node) => {
32
- const target = node.getAttribute('target')
33
- const element = document.getElementById(target)
34
- if (element)
35
- element.append(node.querySelector('template').content.cloneNode(true))
36
- else
37
- console.error(`Unable to find an element on the page with and ID of "${target}""`)
38
- })
39
- }
40
-
41
- onSubmit(e) {
42
- e.preventDefault();
43
- const form = e.target
44
- fetch(form.action, {
45
- body: new FormData(form),
46
- headers: { "X-Requested-With": "XMLHttpRequest" }, // Ensures rails will return true when checking request.xhr?
47
- method: form.method,
48
- })
49
- .then(response => {
50
- if (response.status === 422) {
51
- return response.text().then(content => this.badRequestHandler(content) )
52
- }
53
- if (!response.ok) {
54
- throw new TypeError("Request failed");
55
- }
56
- response.text().then(content => this.updateTurboStream(content))
57
- })
58
- .catch(error => this.errorHandler(error))
59
- }
60
- }
@@ -1 +0,0 @@
1
- <%= render(Blacklight::FacetFieldFilterComponent.new(facet_field: facet_field_presenter(@facet, @display_facet))) %>
@@ -1,8 +0,0 @@
1
- <%= render(Blacklight::FacetFieldComponent.new(facet_field: facet_field_presenter(facet_field, nil))) do |component| %>
2
- <% component.with_label do %>
3
- <%= facet_field_label(facet_field.key) %>
4
- <% end %>
5
- <% component.with_body do %>
6
- <%= yield %>
7
- <% end %>
8
- <% end %>
@@ -1 +0,0 @@
1
- <%= render(Blacklight::FacetFieldPaginationComponent.new(facet_field: facet_field_presenter(@facet, @display_facet))) %>
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Blacklight::Search::FacetSuggestInput, type: :component do
6
- let(:facet) { Blacklight::Configuration::FacetField.new key: 'language_facet' }
7
- let(:presenter) { instance_double(Blacklight::FacetFieldPresenter) }
8
-
9
- before do
10
- allow(presenter).to receive(:label).and_return 'Language'
11
- end
12
-
13
- it 'has an input with the facet-suggest class, which the javascript needs to find it' do
14
- rendered = render_inline(described_class.new(facet: facet, presenter: presenter))
15
- expect(rendered.css("input.facet-suggest").count).to eq 1
16
- end
17
-
18
- it 'has an input with the data-facet-field attribute, which the javascript needs to determine the correct query' do
19
- rendered = render_inline(described_class.new(facet: facet, presenter: presenter))
20
- expect(rendered.css('input[data-facet-field="language_facet"]').count).to eq 1
21
- end
22
-
23
- it 'has a visible label that is associated with the input' do
24
- rendered = render_inline(described_class.new(facet: facet, presenter: presenter))
25
- label = rendered.css('label').first
26
- expect(label.text.strip).to eq 'Filter Language'
27
-
28
- id_in_label_for = label.attribute('for').text
29
- expect(id_in_label_for).to eq('facet-suggest-language_facet')
30
-
31
- expect(rendered.css('input').first.attribute('id').text).to eq id_in_label_for
32
- end
33
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe 'catalog/_facet_index_navigation.html.erb' do
4
- let(:pagination) { Blacklight::Solr::FacetPaginator.new([]) }
5
- let(:facet) { Blacklight::Configuration::FacetField.new(index_range: '0'..'9', presenter: Blacklight::FacetFieldPresenter) }
6
- let(:display_facet) { double(items: [], offset: 0, prefix: '', sort: 'index') }
7
- let(:blacklight_config) { Blacklight::Configuration.new }
8
-
9
- before do
10
- assign(:display_facet, display_facet)
11
- assign(:facet, facet)
12
- allow(view).to receive_messages(blacklight_config: blacklight_config, facet_limit_for: 10)
13
- controller.request.path_parameters[:action] = 'index'
14
- end
15
-
16
- it 'renders the facet index navigation range' do
17
- render
18
- expect(rendered).to have_css '.pagination'
19
- expect(rendered).to have_link '0', href: '/?facet.prefix=0&facet.sort=index'
20
- expect(rendered).to have_link '1'
21
- expect(rendered).to have_link '8'
22
- expect(rendered).to have_link '9'
23
- end
24
-
25
- it 'renders an "all" button' do
26
- render
27
- expect(rendered).to have_css '.page-link', text: 'All'
28
- end
29
-
30
- context 'with a selected index' do
31
- let(:display_facet) { double(items: [], offset: 0, prefix: '5', sort: 'index') }
32
-
33
- it 'highlights the selected index' do
34
- render
35
- expect(rendered).to have_css '.active', text: '5'
36
- end
37
-
38
- it 'enables the clear facets button' do
39
- render
40
- expect(rendered).to have_link 'All'
41
- end
42
- end
43
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe "catalog/facet_layout" do
4
- let :blacklight_config do
5
- Blacklight::Configuration.new do |config|
6
- config.facet_fields[facet_field.field] = facet_field
7
- end
8
- end
9
-
10
- let :facet_field do
11
- Blacklight::Configuration::FacetField.new(field: 'some_field').normalize!
12
- end
13
-
14
- before do
15
- allow(view).to receive_messages(blacklight_config: blacklight_config)
16
- end
17
-
18
- it "has a facet-specific class" do
19
- render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
20
- expect(rendered).to have_css '.blacklight-some_field'
21
- end
22
-
23
- it "has a title with a link for a11y" do
24
- render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
25
- expect(rendered).to have_css 'h3', text: 'Some Field'
26
- end
27
-
28
- it "is collapsable" do
29
- render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
30
- expect(rendered).to have_css 'button.collapsed[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="false"]'
31
- expect(rendered).to have_css '.collapse .accordion-body'
32
- end
33
-
34
- it "is configured to be open by default" do
35
- allow(facet_field).to receive_messages(collapse: false)
36
- render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
37
- expect(rendered).to have_css 'button[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="true"]'
38
- expect(rendered).to have_no_css '.accordion-header.collapsed'
39
- expect(rendered).to have_css '.collapse.show .accordion-body'
40
- end
41
- end