blacklight 8.12.2 → 9.0.0.beta1

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 (200) hide show
  1. checksums.yaml +4 -4
  2. data/.env +3 -3
  3. data/.github/pull_request_template.md +7 -0
  4. data/.github/workflows/ruby.yml +98 -0
  5. data/.rubocop.yml +2 -2
  6. data/.rubocop_todo.yml +0 -9
  7. data/.solr_wrapper.yml +0 -2
  8. data/README.md +30 -8
  9. data/VERSION +1 -1
  10. data/app/assets/builds/blacklight.css +448 -0
  11. data/app/assets/javascripts/blacklight/blacklight.esm.js +8 -51
  12. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  13. data/app/assets/javascripts/blacklight/blacklight.js +8 -51
  14. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  15. data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -4
  16. data/app/assets/stylesheets/blacklight/_blacklight_base.scss +1 -3
  17. data/app/assets/stylesheets/blacklight/_bookmark.scss +44 -41
  18. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -29
  19. data/app/assets/stylesheets/blacklight/_constraints.scss +15 -24
  20. data/app/assets/stylesheets/blacklight/_controls.scss +2 -18
  21. data/app/assets/stylesheets/blacklight/_facets.scss +15 -82
  22. data/app/assets/stylesheets/blacklight/_group.scss +2 -5
  23. data/app/assets/stylesheets/blacklight/_header.scss +4 -11
  24. data/app/assets/stylesheets/blacklight/_icons.scss +0 -8
  25. data/app/assets/stylesheets/blacklight/_modal.scss +9 -10
  26. data/app/assets/stylesheets/blacklight/_pagination.scss +3 -5
  27. data/app/assets/stylesheets/blacklight/_search_form.scss +0 -1
  28. data/app/assets/stylesheets/blacklight/_search_history.scss +0 -4
  29. data/app/assets/stylesheets/blacklight/_search_results.scss +1 -15
  30. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +9 -17
  31. data/app/assets/stylesheets/blacklight/build.scss +4 -0
  32. data/app/components/blacklight/advanced_search_form_component.rb +1 -1
  33. data/app/components/blacklight/constraint_component.rb +1 -1
  34. data/app/components/blacklight/constraint_layout_component.html.erb +2 -2
  35. data/app/components/blacklight/constraints_component.html.erb +2 -2
  36. data/app/components/blacklight/constraints_component.rb +1 -1
  37. data/app/components/blacklight/document/action_component.rb +3 -1
  38. data/app/components/blacklight/document/bookmark_component.html.erb +3 -3
  39. data/app/components/blacklight/document/bookmark_component.rb +0 -1
  40. data/app/components/blacklight/document/group_component.html.erb +1 -1
  41. data/app/components/blacklight/document/page_header_component.rb +3 -3
  42. data/app/components/blacklight/document/sidebar_component.rb +5 -5
  43. data/app/components/blacklight/document_component.rb +14 -20
  44. data/app/components/blacklight/document_title_component.rb +3 -2
  45. data/app/components/blacklight/facet_field_component.html.erb +5 -5
  46. data/app/components/blacklight/facet_field_list_component.rb +4 -22
  47. data/app/components/blacklight/facet_field_pagination_component.html.erb +2 -2
  48. data/app/components/blacklight/facet_item_component.rb +2 -2
  49. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  50. data/app/components/blacklight/header_component.rb +2 -2
  51. data/app/components/blacklight/response/facet_group_component.html.erb +3 -18
  52. data/app/components/blacklight/response/facet_group_component.rb +7 -23
  53. data/app/components/blacklight/response/facet_toggle_button_component.html.erb +16 -0
  54. data/app/components/blacklight/response/facet_toggle_button_component.rb +14 -0
  55. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  56. data/app/components/blacklight/response/pagination_component.rb +2 -1
  57. data/app/components/blacklight/response/sort_component.rb +1 -0
  58. data/app/components/blacklight/response/view_type_button_component.html.erb +1 -1
  59. data/app/components/blacklight/response/view_type_component.html.erb +1 -1
  60. data/app/components/blacklight/search/facet_suggest_input.html.erb +7 -10
  61. data/app/components/blacklight/search/facet_suggest_input.rb +0 -4
  62. data/app/components/blacklight/search/per_page_component.html.erb +1 -1
  63. data/app/components/blacklight/search/per_page_component.rb +1 -0
  64. data/app/components/blacklight/search/sidebar_component.html.erb +1 -1
  65. data/app/components/blacklight/search/sidebar_component.rb +1 -1
  66. data/app/components/blacklight/search_bar_component.html.erb +3 -3
  67. data/app/components/blacklight/search_bar_component.rb +2 -2
  68. data/app/components/blacklight/search_button_component.rb +2 -2
  69. data/app/components/blacklight/search_context/server_applied_params_component.html.erb +2 -2
  70. data/app/components/blacklight/search_context/server_applied_params_component.rb +9 -0
  71. data/app/components/blacklight/skip_link_component.html.erb +1 -1
  72. data/app/components/blacklight/skip_link_component.rb +2 -1
  73. data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
  74. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  75. data/app/components/blacklight/top_navbar_component.html.erb +1 -1
  76. data/app/controllers/concerns/blacklight/catalog.rb +3 -2
  77. data/app/controllers/concerns/blacklight/search_context.rb +1 -13
  78. data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -6
  79. data/app/helpers/blacklight/catalog_helper_behavior.rb +0 -10
  80. data/app/helpers/blacklight/configuration_helper_behavior.rb +0 -12
  81. data/app/helpers/blacklight/document_helper_behavior.rb +0 -26
  82. data/app/helpers/blacklight/icon_helper_behavior.rb +1 -9
  83. data/app/helpers/blacklight/layout_helper_behavior.rb +2 -2
  84. data/app/helpers/blacklight/render_partials_helper_behavior.rb +0 -14
  85. data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
  86. data/app/javascript/{blacklight → blacklight-frontend}/bookmark_toggle.js +1 -1
  87. data/app/javascript/{blacklight → blacklight-frontend}/core.js +2 -10
  88. data/app/javascript/{blacklight → blacklight-frontend}/debounce.js +1 -1
  89. data/app/javascript/blacklight-frontend/facet_suggest.js +26 -0
  90. data/app/javascript/blacklight-frontend/index.js +18 -0
  91. data/app/javascript/{blacklight → blacklight-frontend}/modal.js +2 -14
  92. data/app/javascript/{blacklight → blacklight-frontend}/search_context.js +2 -3
  93. data/app/models/concerns/blacklight/document.rb +0 -11
  94. data/app/models/concerns/blacklight/user.rb +1 -1
  95. data/app/presenters/blacklight/facet_field_presenter.rb +2 -2
  96. data/app/presenters/blacklight/json_presenter.rb +3 -1
  97. data/app/services/blacklight/search_params_yaml_coder.rb +0 -2
  98. data/app/views/bookmarks/_clear_bookmarks_widget.html.erb +0 -2
  99. data/app/views/bookmarks/index.html.erb +1 -1
  100. data/app/views/catalog/_document.atom.builder +1 -1
  101. data/app/views/catalog/_document.html.erb +1 -1
  102. data/app/views/catalog/_results_pagination.html.erb +2 -5
  103. data/app/views/catalog/_search_results.html.erb +3 -3
  104. data/app/views/catalog/_search_results_header.html.erb +1 -1
  105. data/app/views/catalog/_show_main_content.html.erb +1 -1
  106. data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
  107. data/app/views/catalog/_sort_widget.html.erb +1 -0
  108. data/app/views/catalog/facet.html.erb +9 -9
  109. data/app/views/catalog/show.html.erb +2 -3
  110. data/app/views/kaminari/blacklight/_paginator.html.erb +1 -2
  111. data/app/views/layouts/blacklight/base.html.erb +3 -7
  112. data/app/views/search_history/index.html.erb +0 -2
  113. data/blacklight.gemspec +4 -4
  114. data/config/importmap.rb +1 -1
  115. data/config/locales/blacklight.ar.yml +4 -4
  116. data/config/locales/blacklight.ca.yml +124 -124
  117. data/config/locales/blacklight.de.yml +2 -2
  118. data/config/locales/blacklight.en.yml +14 -14
  119. data/config/locales/blacklight.es.yml +4 -4
  120. data/config/locales/blacklight.fr.yml +4 -4
  121. data/config/locales/blacklight.hu.yml +4 -4
  122. data/config/locales/blacklight.it.yml +3 -3
  123. data/config/locales/blacklight.nl.yml +3 -3
  124. data/config/locales/blacklight.pt-BR.yml +3 -3
  125. data/config/locales/blacklight.sq.yml +4 -4
  126. data/config/locales/blacklight.zh.yml +4 -4
  127. data/lib/blacklight/component.rb +1 -2
  128. data/lib/blacklight/configuration/display_field.rb +1 -1
  129. data/lib/blacklight/configuration/fields.rb +3 -3
  130. data/lib/blacklight/configuration/view_config.rb +0 -2
  131. data/lib/blacklight/configuration.rb +5 -11
  132. data/lib/blacklight/engine.rb +0 -6
  133. data/lib/blacklight/open_struct_with_hash_access.rb +4 -4
  134. data/lib/blacklight/search_builder.rb +4 -4
  135. data/lib/blacklight/search_state/filter_field.rb +2 -2
  136. data/lib/blacklight/solr/request.rb +1 -7
  137. data/lib/blacklight/solr/response/group_response.rb +2 -2
  138. data/lib/blacklight.rb +1 -1
  139. data/lib/generators/blacklight/assets/importmap_generator.rb +8 -24
  140. data/lib/generators/blacklight/assets/propshaft_generator.rb +1 -1
  141. data/lib/generators/blacklight/assets_generator.rb +3 -3
  142. data/lib/generators/blacklight/controller_generator.rb +3 -3
  143. data/lib/generators/blacklight/templates/.solr_wrapper.yml +0 -2
  144. data/lib/generators/blacklight/user_generator.rb +9 -10
  145. data/package.json +14 -4
  146. data/rollup.config.js +1 -1
  147. data/spec/components/blacklight/document/action_component_spec.rb +1 -5
  148. data/spec/components/blacklight/document/sidebar_component_spec.rb +5 -20
  149. data/spec/components/blacklight/document_component_spec.rb +9 -14
  150. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +2 -2
  151. data/spec/components/blacklight/facet_field_list_component_spec.rb +2 -2
  152. data/spec/components/blacklight/search/facet_suggest_input_spec.rb +3 -27
  153. data/spec/components/blacklight/search_bar_component_spec.rb +1 -1
  154. data/spec/controllers/blacklight/catalog_spec.rb +1 -1
  155. data/spec/controllers/catalog_controller_spec.rb +1 -1
  156. data/spec/features/axe_spec.rb +6 -11
  157. data/spec/features/bookmarks_spec.rb +48 -11
  158. data/spec/features/facets_spec.rb +22 -90
  159. data/spec/features/search_context_spec.rb +1 -2
  160. data/spec/features/search_filters_spec.rb +6 -6
  161. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +0 -9
  162. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +1 -1
  163. data/spec/lib/blacklight/parameters_spec.rb +1 -12
  164. data/spec/lib/blacklight/search_state/filter_field_spec.rb +0 -18
  165. data/spec/models/blacklight/solr/request_spec.rb +7 -0
  166. data/spec/services/blacklight/search_service_spec.rb +1 -1
  167. data/spec/support/presenter_test_helpers.rb +1 -1
  168. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -3
  169. data/spec/views/catalog/facet.html.erb_spec.rb +0 -8
  170. data/spec/views/catalog/index.atom.builder_spec.rb +0 -2
  171. data/spec/views/catalog/index.html.erb_spec.rb +6 -3
  172. data/spec/views/catalog/show.html.erb_spec.rb +1 -0
  173. data/tasks/blacklight.rake +8 -5
  174. metadata +30 -64
  175. data/.github/matrix.json +0 -92
  176. data/.github/workflows/build.yml +0 -16
  177. data/.github/workflows/lint.yml +0 -25
  178. data/.github/workflows/main.yml +0 -24
  179. data/.github/workflows/test.yml +0 -58
  180. data/app/assets/stylesheets/blacklight/_autocomplete.scss +0 -25
  181. data/app/assets/stylesheets/blacklight/_mixins.scss +0 -20
  182. data/app/components/blacklight/icons/legacy_icon_component.rb +0 -30
  183. data/app/javascript/blacklight/facet_suggest.js +0 -48
  184. data/app/javascript/blacklight/index.js +0 -18
  185. data/app/views/catalog/_constraints.html.erb +0 -1
  186. data/app/views/catalog/_facets.html.erb +0 -5
  187. data/app/views/catalog/_search_form.html.erb +0 -7
  188. data/app/views/catalog/_search_header.html.erb +0 -1
  189. data/app/views/catalog/_show_sidebar.html.erb +0 -3
  190. data/app/views/catalog/_show_tools.html.erb +0 -2
  191. data/app/views/catalog/_start_over.html.erb +0 -1
  192. data/app/views/shared/_header_navbar.html.erb +0 -1
  193. data/lib/generators/blacklight/assets/sprockets_generator.rb +0 -68
  194. data/spec/components/blacklight/system/dropdown_component_spec.rb +0 -26
  195. data/spec/views/catalog/_search_header.erb_spec.rb +0 -14
  196. data/spec/views/catalog/_show_sidebar.erb_spec.rb +0 -24
  197. data/spec/views/catalog/_show_tools.html.erb_spec.rb +0 -37
  198. /data/app/javascript/{blacklight → blacklight-frontend}/button_focus.js +0 -0
  199. /data/app/javascript/{blacklight → blacklight-frontend}/checkbox_submit.js +0 -0
  200. /data/app/javascript/{blacklight → blacklight-frontend}/modalForm.js +0 -0
@@ -90,7 +90,7 @@ hu:
90
90
  close: Fazetek elrejtése
91
91
  open: Szempontok megjelenítése
92
92
  missing: "[Hiányzó]"
93
- more_html: több <span class="sr-only visually-hidden">%{field_name}</span> »
93
+ more_html: több <span class="visually-hidden">%{field_name}</span> »
94
94
  pivot:
95
95
  hide: Bezárás
96
96
  show: Megnyitás
@@ -100,8 +100,8 @@ hu:
100
100
  count: Numerikus rendezés
101
101
  index: A-Z rendezés
102
102
  suggest:
103
- label: Szűrő %{field_label}
104
- placeholder: Szűrő...
103
+ label: Filter %{field_label}
104
+ placeholder: Filter...
105
105
  title: Szűrje tovább a keresését
106
106
  filters:
107
107
  label: "%{label}:"
@@ -139,7 +139,7 @@ hu:
139
139
  aria_label: Eredmények navigáció
140
140
  button_label: "%{count} oldalanként"
141
141
  button_label_html: '%{count}<span class="d-none d-sm-inline"> oldalanként</span>'
142
- label: '%{count}<span class="sr-only visually-hidden"> oldalanként</span>'
142
+ label: '%{count}<span class="visually-hidden"> oldalanként</span>'
143
143
  submit: Frissítés
144
144
  title: Az eredmények száma oldalanként
145
145
  rss_feed: Eredmények RSS-ként
@@ -103,8 +103,8 @@ it:
103
103
  count: Ordina per numero
104
104
  index: Ordina A-Z
105
105
  suggest:
106
- label: Filtro %{field_label}
107
- placeholder: Filtro...
106
+ label: Filter %{field_label}
107
+ placeholder: Filter...
108
108
  title: Affina la ricerca
109
109
  filters:
110
110
  label: "%{label}:"
@@ -142,7 +142,7 @@ it:
142
142
  aria_label: Navigazione dei risultati
143
143
  button_label: "%{count} per pagina"
144
144
  button_label_html: '%{count}<span class="d-none d-sm-inline"> per pagina</span>'
145
- label: '%{count}<span class="sr-only visually-hidden"> per pagina</span>'
145
+ label: '%{count}<span class="visually-hidden"> per pagina</span>'
146
146
  submit: Aggiorna
147
147
  title: Risultati per pagina
148
148
  rss_feed: RSS per i risultati
@@ -90,7 +90,7 @@ nl:
90
90
  close: Verberg facetten
91
91
  open: Toon facetten
92
92
  missing: "[Ontbrekend]"
93
- more_html: Meer <span class="sr-only visually-hidden">%{field_name}</span> »
93
+ more_html: Meer <span class="visually-hidden">%{field_name}</span> »
94
94
  pivot:
95
95
  hide: Sluiten
96
96
  show: Openen
@@ -100,7 +100,7 @@ nl:
100
100
  count: Numeriek sorteren
101
101
  index: A-Z Sorteren
102
102
  suggest:
103
- label: Filteren %{field_label}
103
+ label: Filter %{field_label}
104
104
  placeholder: Filter...
105
105
  title: Verfijn uw zoekopdracht
106
106
  filters:
@@ -139,7 +139,7 @@ nl:
139
139
  aria_label: Resultaten navigatie
140
140
  button_label: "%{count} per pagina"
141
141
  button_label_html: '%{count}<span class="d-none d-sm-inline"> per pagina</span>'
142
- label: '%{count}<span class="sr-only visually-hidden"> per pagina</span>'
142
+ label: '%{count}<span class="visually-hidden"> per pagina</span>'
143
143
  submit: Update
144
144
  title: Toon aantal zoekresultaten per pagina
145
145
  rss_feed: RSS voor zoekresultaten
@@ -91,7 +91,7 @@ pt-BR:
91
91
  open: Mostrar facetas
92
92
  missing:
93
93
  - Ausência
94
- more_html: mais <span class="sr-only visually-hidden">%{field_name}</span> »
94
+ more_html: mais <span class="visually-hidden">%{field_name}</span> »
95
95
  pivot:
96
96
  hide: Fechar
97
97
  show: Abrir
@@ -101,8 +101,8 @@ pt-BR:
101
101
  count: Ordenar por Número
102
102
  index: Ordem Alfabética A-Z
103
103
  suggest:
104
- label: Filtro %{field_label}
105
- placeholder: Filtro...
104
+ label: Filter %{field_label}
105
+ placeholder: Filter...
106
106
  title: Filtre sua busca
107
107
  filters:
108
108
  label: "%{label}:"
@@ -90,7 +90,7 @@ sq:
90
90
  close: Fshih aspektet
91
91
  open: Trego aspektet
92
92
  missing: "[Mungon]"
93
- more_html: Më shumë <span class="sr-only visually-hidden">%{field_name}</span> »
93
+ more_html: Më shumë <span class="visually-hidden">%{field_name}</span> »
94
94
  pivot:
95
95
  hide: Mbylle
96
96
  show: Hape
@@ -100,8 +100,8 @@ sq:
100
100
  count: Renditja numerike
101
101
  index: A-Z Renditja
102
102
  suggest:
103
- label: Filtri %{field_label}
104
- placeholder: Filtro...
103
+ label: Filter %{field_label}
104
+ placeholder: Filter...
105
105
  title: Kufizo këkimin
106
106
  filters:
107
107
  label: "%{label}:"
@@ -139,7 +139,7 @@ sq:
139
139
  aria_label: Rezultatet e lundrimit
140
140
  button_label: "%{count} për faqe"
141
141
  button_label_html: '%{count}<span class="d-none d-sm-inline"> për faqe</span>'
142
- label: '%{count}<span class="sr-only visually-hidden"> për faqe</span>'
142
+ label: '%{count}<span class="visually-hidden"> për faqe</span>'
143
143
  submit: Përditëso
144
144
  title: Numri i rezultateve që do të shfaqen për faqe
145
145
  rss_feed: RSS për rezultatet
@@ -90,7 +90,7 @@ zh:
90
90
  close: 隐藏方面
91
91
  open: 显示方面
92
92
  missing: "[未找到]"
93
- more_html: 更多 <span class="sr-only visually-hidden">%{field_name}</span> »
93
+ more_html: 更多 <span class="visually-hidden">%{field_name}</span> »
94
94
  pivot:
95
95
  hide: 关
96
96
  show: 打开
@@ -100,8 +100,8 @@ zh:
100
100
  count: 按数量排序
101
101
  index: 按字母排序
102
102
  suggest:
103
- label: 过滤器 %{field_label}
104
- placeholder: 筛选...
103
+ label: Filter %{field_label}
104
+ placeholder: Filter...
105
105
  title: 限定搜索
106
106
  filters:
107
107
  label: "%{label}:"
@@ -139,7 +139,7 @@ zh:
139
139
  aria_label: 结果导航
140
140
  button_label: "%{count} 每页"
141
141
  button_label_html: '%{count}<span class="d-none d-sm-inline"> 每页</span>'
142
- label: '%{count}<span class="sr-only visually-hidden"> 每页</span>'
142
+ label: '%{count}<span class="visually-hidden"> 每页</span>'
143
143
  submit: 更新
144
144
  title: 每页显示结果数
145
145
  rss_feed: 搜索结果RSS
@@ -11,8 +11,7 @@ module Blacklight
11
11
 
12
12
  def sidecar_files(*args, **kwargs)
13
13
  upstream_sidecar_files(*args, **kwargs).map do |path|
14
- components_path = ViewComponent::VERSION::MAJOR < 4 ? view_component_path : config.generate.path
15
- app_path = Rails.root.join(path.slice(path.index(components_path)..-1).to_s).to_s
14
+ app_path = Rails.root.join(path.slice(path.index(view_component_path)..-1).to_s).to_s
16
15
 
17
16
  if File.exist?(app_path)
18
17
  app_path
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Blacklight
4
4
  class Configuration::DisplayField < Blacklight::Configuration::Field
5
- def initialize(*args, **kwargs, &block)
5
+ def initialize(*args, **kwargs, &)
6
6
  super
7
7
 
8
8
  self.presenter ||= Blacklight::FieldPresenter
@@ -81,7 +81,7 @@ module Blacklight
81
81
  #
82
82
  # add_blacklight_field :index_field, [{ :field => 'format', :label => 'Format' }, IndexField.new(:field => 'date', :label => 'Date')]
83
83
  #
84
- def add_blacklight_field config_key, *args, &block
84
+ def add_blacklight_field(config_key, *args, &)
85
85
  field_config = case args.first
86
86
  when String
87
87
  field_config_from_key_and_hash(config_key, *args)
@@ -89,7 +89,7 @@ module Blacklight
89
89
  args[0] = args[0].to_s
90
90
  field_config_from_key_and_hash(config_key, *args)
91
91
  when Array
92
- field_config_from_array(config_key, *args, &block)
92
+ field_config_from_array(config_key, *args, &)
93
93
  return # we've iterated over the array above.
94
94
  else
95
95
  field_config_from_field_or_hash(config_key, *args)
@@ -101,7 +101,7 @@ module Blacklight
101
101
 
102
102
  # look up any dynamic fields
103
103
  if field_config.match
104
- handle_matching_fields(config_key, field_config, &block)
104
+ handle_matching_fields(config_key, field_config, &)
105
105
  return
106
106
  end
107
107
 
@@ -4,8 +4,6 @@ class Blacklight::Configuration
4
4
  class ViewConfig < Blacklight::OpenStructWithHashAccess
5
5
  # @!attribute template
6
6
  # @return [String] partial to render around the documents
7
- # @!attribute partials
8
- # @return [Array<String>] partials to render for each document(see #render_document_partials)
9
7
  # @!attribute document_presenter_class
10
8
  # @return [Class] document presenter class used by helpers and views
11
9
  # @!attribute document_component
@@ -138,8 +138,8 @@ module Blacklight
138
138
  # @!attribute bookmark_icon_component
139
139
  # @since v8.3.1
140
140
  # component class used to render a document
141
- # set to Blacklight::Icons::BookmarkIconComponent to replace checkbox with icon
142
- property :bookmark_icon_component, default: nil
141
+ # set to nil if a checkbox is prefered to the icon
142
+ property :bookmark_icon_component, default: Blacklight::Icons::BookmarkIconComponent
143
143
 
144
144
  # @!attribute index
145
145
  # General configuration for all views
@@ -157,8 +157,6 @@ module Blacklight
157
157
  display_type_field: nil,
158
158
  # the "field access" key to use to look up the document display fields
159
159
  document_fields_key: :index_fields,
160
- # partials to render for each document(see #render_document_partials)
161
- partials: [],
162
160
  document_actions: NestedOpenStructWithHashAccess.new(ToolConfig),
163
161
  collection_actions: NestedOpenStructWithHashAccess.new(ToolConfig),
164
162
  # what field, if any, to use to render grouped results
@@ -166,7 +164,7 @@ module Blacklight
166
164
  # additional response formats for search results
167
165
  respond_to: OpenStructWithHashAccess.new,
168
166
  # component class used to render the facet grouping
169
- facet_group_component: nil,
167
+ facet_group_component: Blacklight::Response::FacetGroupComponent,
170
168
  # component class used to render search constraints
171
169
  constraints_component: Blacklight::ConstraintsComponent,
172
170
  # component class used to render the search bar
@@ -184,9 +182,7 @@ module Blacklight
184
182
  # document presenter class used by helpers and views
185
183
  document_presenter_class: nil,
186
184
  document_component: Blacklight::DocumentComponent,
187
- # in Blacklight 9, the default show_tools_component configuration will
188
- # be Blacklight::Document::ShowToolsComponent
189
- show_tools_component: nil,
185
+ show_tools_component: Blacklight::Document::ShowToolsComponent,
190
186
  show_header_tools_component: nil,
191
187
  document_header_component: Blacklight::Document::PageHeaderComponent,
192
188
  sidebar_component: Blacklight::Document::SidebarComponent,
@@ -197,8 +193,6 @@ module Blacklight
197
193
  # Set this to a hash with additional arguments to merge into the route,
198
194
  # or set `controller: :current` to route to the current controller.
199
195
  route: nil,
200
- # partials to render for each document(see #render_document_partials)
201
- partials: [],
202
196
  document_actions: NestedOpenStructWithHashAccess.new(ToolConfig),
203
197
  header_actions: NestedOpenStructWithHashAccess.new(ToolConfig)
204
198
  )
@@ -585,7 +579,7 @@ module Blacklight
585
579
 
586
580
  ##
587
581
  # Add a section of config that only applies to documents with a matching display type
588
- def for_display_type display_type, &_block
582
+ def for_display_type(display_type, &)
589
583
  fields_for_type[display_type] ||= self.class.new
590
584
 
591
585
  fields_for_type[display_type].tap do |conf|
@@ -72,12 +72,6 @@ module Blacklight
72
72
  outer_window: 2
73
73
  }
74
74
 
75
- # Blacklight 9 moves the next button after the page numbers. This behavior can be configured
76
- # in Blacklight 8 by setting the next_button_position to :after
77
- bl_global_config.paginator = {
78
- next_button_position: :before
79
- }
80
-
81
75
  bl_global_config.search_params_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol]
82
76
 
83
77
  # Anything that goes into Blacklight::Engine.config is stored as a class
@@ -53,14 +53,14 @@ module Blacklight
53
53
  self.class.new @table.deep_dup
54
54
  end
55
55
 
56
- def deep_transform_values(&method)
57
- self.class.new @table.deep_transform_values(&method)
56
+ def deep_transform_values(&)
57
+ self.class.new @table.deep_transform_values(&)
58
58
  end
59
59
 
60
- def try(method_name = nil, *args, &block)
60
+ def try(method_name = nil, *args, &)
61
61
  if method_name.nil? && block_given?
62
62
  if b.arity.zero?
63
- instance_eval(&block)
63
+ instance_eval(&)
64
64
  else
65
65
  yield self
66
66
  end
@@ -95,20 +95,20 @@ module Blacklight
95
95
 
96
96
  ##
97
97
  # Merge additional, repository-specific parameters
98
- def merge(extra_params, &block)
98
+ def merge(extra_params, &)
99
99
  if extra_params
100
100
  params_will_change!
101
- @merged_params.merge!(extra_params.to_hash, &block)
101
+ @merged_params.merge!(extra_params.to_hash, &)
102
102
  end
103
103
  self
104
104
  end
105
105
 
106
106
  ##
107
107
  # "Reverse merge" additional, repository-specific parameters
108
- def reverse_merge(extra_params, &block)
108
+ def reverse_merge(extra_params, &)
109
109
  if extra_params
110
110
  params_will_change!
111
- @reverse_merged_params.reverse_merge!(extra_params.to_hash, &block)
111
+ @reverse_merged_params.reverse_merge!(extra_params.to_hash, &)
112
112
  end
113
113
  self
114
114
  end
@@ -145,8 +145,8 @@ module Blacklight
145
145
  def permitted_params
146
146
  if config.pivot
147
147
  {
148
- filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge!(key => [], "-#{key}" => []) },
149
- inclusive_filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge!(key => []) }
148
+ filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge(key => [], "-#{key}" => []) },
149
+ inclusive_filters_key => config.pivot.each_with_object({}) { |key, filter| filter.merge(key => []) }
150
150
  }
151
151
  else
152
152
  {
@@ -3,12 +3,6 @@
3
3
  class Blacklight::Solr::InvalidParameter < ArgumentError; end
4
4
 
5
5
  class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess
6
- # @deprecated
7
- SINGULAR_KEYS = %w(facet fl q qt rows start spellcheck spellcheck.q sort per_page wt hl group defType)
8
-
9
- # @deprecated
10
- ARRAY_KEYS = %w(facet.field facet.query facet.pivot fq hl.fl)
11
-
12
6
  def initialize(constructor = {})
13
7
  if constructor.is_a?(Hash)
14
8
  super()
@@ -42,7 +36,7 @@ class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess
42
36
  self[:json][:query] ||= { bool: { bool_operator => [] } }
43
37
  self[:json][:query][:bool][bool_operator] ||= []
44
38
 
45
- if self['q']
39
+ if self['q'].present?
46
40
  self[:json][:query][:bool][:must] ||= []
47
41
  self[:json][:query][:bool][:must] << self['q']
48
42
  delete 'q'
@@ -51,9 +51,9 @@ class Blacklight::Solr::Response::GroupResponse
51
51
  )
52
52
  end
53
53
 
54
- def method_missing meth, *args, &block
54
+ def method_missing(meth, *args, &)
55
55
  if response.respond_to? meth
56
- response.send(meth, *args, &block)
56
+ response.send(meth, *args, &)
57
57
  else
58
58
  super
59
59
  end
data/lib/blacklight.rb CHANGED
@@ -116,7 +116,7 @@ module Blacklight
116
116
 
117
117
  # returns the full path the the blacklight plugin installation
118
118
  def self.root
119
- @root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
119
+ @root ||= File.expand_path(File.dirname(__FILE__, 2))
120
120
  end
121
121
 
122
122
  def self.deprecation
@@ -5,18 +5,12 @@ module Blacklight
5
5
  class ImportmapGenerator < Rails::Generators::Base
6
6
  class_option :'bootstrap-version', type: :string, default: ENV.fetch('BOOTSTRAP_VERSION', '~> 5.3'), desc: "Set the generated app's bootstrap version"
7
7
 
8
- # This could be skipped if you want to use webpacker
9
- def add_javascript_dependencies
10
- gem 'bootstrap', options[:'bootstrap-version'].presence # in rails 7, only for stylesheets
11
- gem 'jquery-rails' if bootstrap_4? # Bootstrap 4 has a dependency on jquery
12
- end
13
-
14
8
  def import_javascript_assets
15
9
  append_to_file 'config/importmap.rb' do
16
10
  <<~CONTENT
17
11
  pin "@github/auto-complete-element", to: "https://cdn.skypack.dev/@github/auto-complete-element"
18
12
  pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.6/dist/umd/popper.min.js"
19
- pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@#{(defined?(Bootstrap) && Bootstrap::VERSION) || '5.3.2'}/dist/js/bootstrap.js"
13
+ pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@#{(defined?(Bootstrap) && Bootstrap::VERSION) || '5.3.3'}/dist/js/bootstrap.js"
20
14
  CONTENT
21
15
  end
22
16
 
@@ -40,39 +34,29 @@ module Blacklight
40
34
  append_to_file 'app/javascript/application.js' do
41
35
  <<~CONTENT
42
36
  import githubAutoCompleteElement from "@github/auto-complete-element"
43
- import Blacklight from "blacklight"
37
+ import Blacklight from "blacklight-frontend"
44
38
  CONTENT
45
39
  end
46
40
  end
47
41
 
48
42
  def add_stylesheet
49
43
  if File.exist? 'app/assets/stylesheets/application.bootstrap.scss'
50
- if ENV['CI']
51
- run "yarn add file:#{Blacklight::Engine.root}"
52
- else
53
- run "yarn add blacklight-frontend@#{Blacklight::VERSION}"
54
- end
55
-
56
44
  append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do
57
45
  <<~CONTENT
58
- @import "blacklight-frontend/app/assets/stylesheets/blacklight/blacklight";
46
+ @import url("blacklight.css");
59
47
  CONTENT
60
48
  end
61
49
  else
62
- gem "sassc-rails", "~> 2.1"
63
-
64
- create_file 'app/assets/stylesheets/blacklight.scss' do
50
+ append_to_file 'app/assets/stylesheets/application.css' do
65
51
  <<~CONTENT
66
- @import 'bootstrap';
67
- @import 'blacklight/blacklight';
52
+ /*
53
+ *= require blacklight
54
+ */
55
+ @import url(https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css);
68
56
  CONTENT
69
57
  end
70
58
  end
71
59
  end
72
-
73
- def bootstrap_4?
74
- options[:'bootstrap-version'].match?(/\A[^0-9]*4\./)
75
- end
76
60
  end
77
61
  end
78
62
  end
@@ -18,7 +18,7 @@ module Blacklight
18
18
  def add_package_assets
19
19
  append_to_file 'app/assets/stylesheets/application.bootstrap.scss' do
20
20
  <<~CONTENT
21
- @import "blacklight-frontend/app/assets/stylesheets/blacklight/blacklight";
21
+ @import url("blacklight.css");
22
22
  CONTENT
23
23
  end
24
24
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Blacklight
4
4
  class AssetsGenerator < Rails::Generators::Base
5
- class_option :'bootstrap-version', type: :string, default: ENV.fetch('BOOTSTRAP_VERSION', '~> 5.3'), desc: "Set the generated app's bootstrap version"
5
+ class_option :'bootstrap-version', type: :string, default: ENV.fetch('BOOTSTRAP_VERSION', '5.3.3'), desc: "Set the generated app's bootstrap version"
6
6
 
7
7
  def run_asset_pipeline_specific_generator
8
8
  generated_options = "--bootstrap-version='#{options[:'bootstrap-version']}'" if options[:'bootstrap-version']
@@ -11,8 +11,8 @@ module Blacklight
11
11
  'blacklight:assets:importmap'
12
12
  elsif defined?(Propshaft)
13
13
  'blacklight:assets:propshaft'
14
- elsif defined?(Sprockets)
15
- 'blacklight:assets:sprockets'
14
+ else
15
+ raise "Unsupported path"
16
16
  end
17
17
 
18
18
  generate generator, generated_options if generator
@@ -16,9 +16,9 @@ module Blacklight
16
16
  # Add Blacklight to the application controller
17
17
  def inject_blacklight_controller_behavior
18
18
  inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
19
- " # Adds a few additional behaviors into the application controller\n" \
20
- " include Blacklight::Controller\n" \
21
- " layout :determine_layout if respond_to? :layout\n\n"
19
+ " # Adds a few additional behaviors into the application controller\n " \
20
+ "include Blacklight::Controller\n " \
21
+ "layout :determine_layout if respond_to? :layout\n\n"
22
22
  end
23
23
  end
24
24
 
@@ -1,7 +1,5 @@
1
1
  # Place any default configuration for solr_wrapper here
2
2
  # port: 8983
3
- env:
4
- SOLR_MODULES: analysis-extras
5
3
  collection:
6
4
  dir: solr/conf/
7
5
  name: blacklight-core
@@ -34,13 +34,6 @@ module Blacklight
34
34
  generate "devise", model_name.classify
35
35
  generate "devise_guests", model_name.classify
36
36
 
37
- # add the #to_s to the model.
38
- insert_into_file("app/models/#{model_name}.rb", before: /end(\n| )*$/) do
39
- "\n # Configuration added by Blacklight; Blacklight::User uses a method key on your\n" \
40
- " # user class to get a user-displayable login/identifier for\n" \
41
- " # the account.\n" \
42
- " self.string_display_key ||= :email\n"
43
- end
44
37
  gsub_file("config/initializers/devise.rb", "config.sign_out_via = :delete", "config.sign_out_via = :get")
45
38
  # Work around for https://github.com/heartcombo/devise/issues/5720
46
39
  gsub_file("config/initializers/devise.rb", "# config.reload_routes = true", "config.reload_routes = false")
@@ -51,13 +44,19 @@ module Blacklight
51
44
  file_path = "app/models/#{model_name.underscore}.rb"
52
45
  if File.exist?(File.expand_path(file_path, destination_root))
53
46
  inject_into_class file_path, model_name.classify do
54
- "\n # Connects this user object to Blacklights Bookmarks." \
55
- "\n include Blacklight::User\n"
47
+ <<~EOS
48
+ # Connects this user object to Blacklights Bookmarks.
49
+ include Blacklight::User
50
+
51
+ # Blacklight::User uses a method on your User class to get a user-displayable
52
+ # label (e.g. login or identifier) for the account. Blacklight uses `email' by default.
53
+ # self.string_display_key = :email
54
+ EOS
56
55
  end
57
56
  else
58
57
  say_status "warning", <<~EOS, :yellow
59
58
  Blacklight authenticated user functionality not installed, as a user model
60
- could not be found at /app/models/user.rb. If you used a different name,
59
+ could not be found at #{file_path}. If you used a different name,
61
60
  please re-run the migration and provide that name as an argument. E.g.:
62
61
 
63
62
  `rails -g blacklight:user client`
data/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "blacklight-frontend",
3
- "version": "8.12.2",
3
+ "version": "9.0.0-beta1",
4
4
  "description": "The frontend code and styles for Blacklight",
5
- "main": "app/assets/javascripts/blacklight",
5
+ "exports": {
6
+ "./blacklight.esm.js": "./app/assets/javascripts/blacklight/blacklight.esm.js",
7
+ "./stylesheets/*": "./app/assets/stylesheets/blacklight/*",
8
+ ".": {
9
+ "import": "./app/javascript/blacklight-frontend/index.js",
10
+ "require": "./app/assets/javascripts/blacklight.js"
11
+ },
12
+ "./*": "./app/javascript/blacklight-frontend/*.js"
13
+ },
6
14
  "type": "module",
7
- "module": "app/assets/javascripts/blacklight/blacklight.esm.js",
8
15
  "scripts": {
16
+ "build": "sass ./app/assets/stylesheets/blacklight/build.scss:./app/assets/builds/blacklight.css --no-source-map --load-path=node_modules --quiet-deps",
9
17
  "prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
10
18
  },
11
19
  "repository": {
@@ -24,7 +32,9 @@
24
32
  "homepage": "https://github.com/projectblacklight/blacklight#readme",
25
33
  "devDependencies": {
26
34
  "rollup": "^4.24.0",
27
- "rollup-plugin-includepaths": "^0.2.4"
35
+ "rollup-plugin-includepaths": "^0.2.4",
36
+ "sass": "^1.80.3",
37
+ "bootstrap": "^5.3.3"
28
38
  },
29
39
  "browserslist": [
30
40
  "defaults",
data/rollup.config.js CHANGED
@@ -16,7 +16,7 @@ let includePathOptions = {
16
16
  };
17
17
 
18
18
  const rollupConfig = {
19
- input: 'app/javascript/blacklight/index.js',
19
+ input: 'app/javascript/blacklight-frontend/index.js',
20
20
  output: {
21
21
  file: `app/assets/javascripts/blacklight/${fileDest}.js`,
22
22
  format: ESM ? 'es' : 'umd',
@@ -23,11 +23,7 @@ RSpec.describe Blacklight::Document::ActionComponent, type: :component do
23
23
  end
24
24
 
25
25
  it 'renders an action link' do
26
- if Rails.version >= '6'
27
- allow(view_context).to receive(:some_tool_solr_document_path).with(document, { only_path: true }).and_return('/asdf')
28
- else
29
- allow(view_context).to receive(:some_tool_solr_document_path).with(document).and_return('/asdf')
30
- end
26
+ allow(view_context).to receive(:some_tool_solr_document_path).with(document, { only_path: true }).and_return('/asdf')
31
27
 
32
28
  expect(rendered).to have_link 'Some tool', href: '/asdf'
33
29
  end
@@ -33,29 +33,14 @@ RSpec.describe Blacklight::Document::SidebarComponent, type: :component do
33
33
  # rubocop:disable RSpec/SubjectStub
34
34
  before do
35
35
  allow(component).to receive(:render).with(an_instance_of(Blacklight::Document::MoreLikeThisComponent)).and_return("")
36
+ blacklight_config.show.show_tools_component = show_tools_component
37
+ allow(component).to receive(:render).with(an_instance_of(show_tools_component)).and_return(expected_html)
36
38
  end
37
39
 
38
- context "without a configured ShowTools component" do
39
- before do
40
- allow(component).to receive(:render).with('show_tools', document: presented_document, silence_deprecation: false).and_return(expected_html)
41
- end
40
+ let(:show_tools_component) { Class.new(Blacklight::Document::ShowToolsComponent) }
42
41
 
43
- it 'renders show_tools partial' do
44
- expect(rendered).to have_css 'div[@class="expected-show_tools"]'
45
- end
46
- end
47
-
48
- context "with a configured ShowTools component" do
49
- let(:show_tools_component) { Class.new(Blacklight::Document::ShowToolsComponent) }
50
-
51
- before do
52
- blacklight_config.show.show_tools_component = show_tools_component
53
- allow(component).to receive(:render).with(an_instance_of(show_tools_component)).and_return(expected_html)
54
- end
55
-
56
- it 'renders configured show_tools component' do
57
- expect(rendered).to have_css 'div[@class="expected-show_tools"]'
58
- end
42
+ it 'renders configured show_tools component' do
43
+ expect(rendered).to have_css 'div[@class="expected-show_tools"]'
59
44
  end
60
45
  # rubocop:enable RSpec/SubjectStub
61
46
  end