blacklight 7.32.0 → 8.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (390) hide show
  1. checksums.yaml +4 -4
  2. data/.env +2 -2
  3. data/.github/workflows/ruby.yml +32 -107
  4. data/.rubocop.yml +243 -2
  5. data/.rubocop_todo.yml +214 -270
  6. data/Gemfile +7 -6
  7. data/README.md +11 -3
  8. data/VERSION +1 -1
  9. data/app/assets/javascripts/blacklight/blacklight.esm.js +384 -0
  10. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -0
  11. data/app/assets/javascripts/blacklight/blacklight.js +351 -496
  12. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -0
  13. data/app/assets/stylesheets/blacklight/_autocomplete.scss +25 -0
  14. data/app/assets/stylesheets/blacklight/_blacklight_base.scss +1 -1
  15. data/app/assets/stylesheets/blacklight/_bookmark.scss +16 -0
  16. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +8 -0
  17. data/app/assets/stylesheets/blacklight/_controls.scss +5 -12
  18. data/app/assets/stylesheets/blacklight/_facets.scss +96 -44
  19. data/app/assets/stylesheets/blacklight/_header.scss +0 -15
  20. data/app/assets/stylesheets/blacklight/_icons.scss +0 -14
  21. data/app/assets/stylesheets/blacklight/_mixins.scss +20 -0
  22. data/app/assets/stylesheets/blacklight/_modal.scss +8 -2
  23. data/app/assets/stylesheets/blacklight/_search_form.scss +30 -3
  24. data/app/assets/stylesheets/blacklight/_search_history.scss +10 -1
  25. data/app/assets/stylesheets/blacklight/_search_results.scss +6 -2
  26. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +4 -1
  27. data/app/builders/blacklight/action_builder.rb +18 -9
  28. data/app/components/blacklight/advanced_search_form_component.html.erb +1 -1
  29. data/app/components/blacklight/advanced_search_form_component.rb +4 -6
  30. data/app/components/blacklight/constraints_component.rb +27 -37
  31. data/app/components/blacklight/document/action_component.html.erb +2 -9
  32. data/app/components/blacklight/document/action_component.rb +26 -8
  33. data/app/components/blacklight/document/actions_component.rb +1 -1
  34. data/app/components/blacklight/document/bookmark_component.html.erb +9 -0
  35. data/app/components/blacklight/document/bookmark_component.rb +4 -2
  36. data/app/components/blacklight/document/citation_component.rb +5 -3
  37. data/app/components/blacklight/document/group_component.rb +7 -3
  38. data/app/components/blacklight/document/sidebar_component.html.erb +2 -0
  39. data/app/components/blacklight/document/sidebar_component.rb +16 -0
  40. data/app/components/blacklight/document/thumbnail_component.html.erb +2 -7
  41. data/app/components/blacklight/document/thumbnail_component.rb +1 -9
  42. data/app/components/blacklight/document_component.html.erb +4 -0
  43. data/app/components/blacklight/document_component.rb +7 -23
  44. data/app/components/blacklight/document_metadata_component.rb +5 -6
  45. data/app/components/blacklight/document_title_component.rb +4 -1
  46. data/app/components/blacklight/facet_component.rb +1 -1
  47. data/app/components/blacklight/facet_field_checkboxes_component.html.erb +1 -1
  48. data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
  49. data/app/components/blacklight/facet_field_component.html.erb +5 -5
  50. data/app/components/blacklight/facet_field_component.rb +9 -2
  51. data/app/components/blacklight/facet_field_list_component.html.erb +1 -1
  52. data/app/components/blacklight/facet_field_list_component.rb +37 -5
  53. data/app/components/blacklight/facet_field_no_layout_component.rb +0 -2
  54. data/app/components/blacklight/facet_item_component.rb +1 -43
  55. data/app/components/blacklight/facet_item_pivot_component.rb +21 -23
  56. data/app/components/blacklight/header_component.html.erb +2 -0
  57. data/app/components/blacklight/header_component.rb +26 -0
  58. data/app/components/blacklight/hidden_search_state_component.rb +1 -2
  59. data/app/components/blacklight/icons/legacy_icon_component.rb +30 -0
  60. data/app/components/blacklight/icons/list_component.rb +16 -0
  61. data/app/components/blacklight/icons/search_component.rb +16 -0
  62. data/app/components/blacklight/metadata_field_component.rb +24 -8
  63. data/app/components/blacklight/metadata_field_layout_component.rb +0 -18
  64. data/app/components/blacklight/response/facet_group_component.html.erb +3 -5
  65. data/app/components/blacklight/response/facet_group_component.rb +29 -8
  66. data/app/components/blacklight/response/sort_component.rb +1 -1
  67. data/app/components/blacklight/response/spellcheck_component.rb +17 -6
  68. data/app/components/blacklight/response/view_type_button_component.rb +2 -6
  69. data/app/components/blacklight/response/view_type_component.rb +2 -4
  70. data/app/components/blacklight/search/sidebar_component.html.erb +8 -0
  71. data/app/components/blacklight/search/sidebar_component.rb +17 -0
  72. data/app/components/blacklight/search_bar_component.html.erb +20 -15
  73. data/app/components/blacklight/search_bar_component.rb +2 -16
  74. data/app/components/blacklight/search_button_component.rb +3 -3
  75. data/app/components/blacklight/search_context_component.rb +43 -9
  76. data/app/components/blacklight/search_header_component.html.erb +2 -0
  77. data/app/components/blacklight/search_header_component.rb +6 -0
  78. data/app/components/blacklight/search_navbar_component.html.erb +5 -0
  79. data/app/components/blacklight/search_navbar_component.rb +34 -0
  80. data/app/components/blacklight/start_over_button_component.rb +5 -3
  81. data/app/components/blacklight/system/flash_message_component.html.erb +3 -1
  82. data/app/components/blacklight/system/flash_message_component.rb +10 -1
  83. data/app/components/blacklight/system/modal_component.html.erb +1 -1
  84. data/app/components/blacklight/system/modal_component.rb +0 -2
  85. data/app/components/blacklight/top_navbar_component.html.erb +12 -0
  86. data/app/components/blacklight/top_navbar_component.rb +13 -0
  87. data/app/controllers/bookmarks_controller.rb +1 -0
  88. data/app/controllers/catalog_controller.rb +1 -0
  89. data/app/controllers/concerns/blacklight/bookmarks.rb +13 -10
  90. data/app/controllers/concerns/blacklight/catalog.rb +21 -72
  91. data/app/controllers/concerns/blacklight/controller.rb +6 -43
  92. data/app/controllers/concerns/blacklight/search_context.rb +25 -7
  93. data/app/controllers/concerns/blacklight/search_history.rb +2 -0
  94. data/app/controllers/concerns/blacklight/searchable.rb +12 -1
  95. data/app/controllers/concerns/blacklight/token_based_user.rb +1 -0
  96. data/app/controllers/search_history_controller.rb +1 -0
  97. data/app/helpers/blacklight/blacklight_helper_behavior.rb +10 -308
  98. data/app/helpers/blacklight/catalog_helper_behavior.rb +22 -137
  99. data/app/helpers/blacklight/component_helper_behavior.rb +2 -53
  100. data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -117
  101. data/app/helpers/blacklight/facets_helper_behavior.rb +4 -321
  102. data/app/helpers/blacklight/icon_helper_behavior.rb +5 -4
  103. data/app/helpers/blacklight/layout_helper_behavior.rb +1 -0
  104. data/app/helpers/blacklight/render_partials_helper_behavior.rb +11 -30
  105. data/app/helpers/blacklight/url_helper_behavior.rb +13 -97
  106. data/app/helpers/blacklight_helper.rb +1 -0
  107. data/app/helpers/catalog_helper.rb +1 -0
  108. data/app/javascript/blacklight/bookmark_toggle.js +13 -19
  109. data/app/javascript/blacklight/button_focus.js +12 -10
  110. data/app/javascript/blacklight/checkbox_submit.js +68 -122
  111. data/app/javascript/blacklight/core.js +6 -5
  112. data/app/javascript/blacklight/index.js +13 -0
  113. data/app/javascript/blacklight/modal.js +99 -164
  114. data/app/javascript/blacklight/modalForm.js +60 -0
  115. data/app/javascript/blacklight/search_context.js +45 -55
  116. data/app/models/blacklight/facet_paginator.rb +3 -2
  117. data/app/models/blacklight/icon.rb +4 -2
  118. data/app/models/bookmark.rb +0 -2
  119. data/app/models/concerns/blacklight/configurable.rb +5 -4
  120. data/app/models/concerns/blacklight/document/active_model_shim.rb +1 -0
  121. data/app/models/concerns/blacklight/document/attributes.rb +50 -0
  122. data/app/models/concerns/blacklight/document/cache_key.rb +1 -0
  123. data/app/models/concerns/blacklight/document/dublin_core.rb +2 -1
  124. data/app/models/concerns/blacklight/document/email.rb +1 -0
  125. data/app/models/concerns/blacklight/document/export.rb +2 -1
  126. data/app/models/concerns/blacklight/document/extensions.rb +1 -0
  127. data/app/models/concerns/blacklight/document/schema_org.rb +1 -0
  128. data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -0
  129. data/app/models/concerns/blacklight/document/sms.rb +1 -0
  130. data/app/models/concerns/blacklight/document.rb +12 -20
  131. data/app/models/concerns/blacklight/suggest/response.rb +1 -0
  132. data/app/models/concerns/blacklight/user.rb +17 -8
  133. data/app/models/record_mailer.rb +13 -12
  134. data/app/models/search.rb +0 -1
  135. data/app/models/solr_document.rb +1 -0
  136. data/app/presenters/blacklight/clause_presenter.rb +1 -1
  137. data/app/presenters/blacklight/document_presenter.rb +13 -21
  138. data/app/presenters/blacklight/facet_field_presenter.rb +39 -14
  139. data/app/presenters/blacklight/facet_grouped_item_presenter.rb +1 -5
  140. data/app/presenters/blacklight/facet_item_pivot_presenter.rb +60 -0
  141. data/app/presenters/blacklight/facet_item_presenter.rb +3 -9
  142. data/app/presenters/blacklight/field_presenter.rb +1 -0
  143. data/app/presenters/blacklight/index_presenter.rb +2 -40
  144. data/app/presenters/blacklight/json_presenter.rb +7 -5
  145. data/app/presenters/blacklight/rendering/join.rb +1 -1
  146. data/app/presenters/blacklight/rendering/link_to_facet.rb +2 -5
  147. data/app/presenters/blacklight/show_presenter.rb +1 -9
  148. data/app/presenters/blacklight/thumbnail_presenter.rb +1 -1
  149. data/app/services/blacklight/bookmarks_search_builder.rb +22 -0
  150. data/app/services/blacklight/field_retriever.rb +1 -8
  151. data/app/services/blacklight/search_service.rb +8 -7
  152. data/app/values/blacklight/types.rb +95 -11
  153. data/app/views/bookmarks/_clear_bookmarks_widget.html.erb +8 -1
  154. data/app/views/bookmarks/_tools.html.erb +7 -12
  155. data/app/views/catalog/_advanced_search_form.html.erb +0 -1
  156. data/app/views/catalog/_bookmark_control.html.erb +1 -1
  157. data/app/views/catalog/_constraints.html.erb +1 -14
  158. data/app/views/catalog/_document.atom.builder +12 -14
  159. data/app/views/catalog/_document.html.erb +5 -3
  160. data/app/views/catalog/_document.rss.builder +2 -4
  161. data/app/views/catalog/_facets.html.erb +5 -4
  162. data/app/views/catalog/_home_text.html.erb +2 -14
  163. data/app/views/catalog/_search_form.html.erb +3 -3
  164. data/app/views/catalog/_search_header.html.erb +1 -2
  165. data/app/views/catalog/_search_results.html.erb +2 -2
  166. data/app/views/catalog/_search_sidebar.html.erb +5 -1
  167. data/app/views/catalog/_show_main_content.html.erb +10 -15
  168. data/app/views/catalog/_show_sidebar.html.erb +2 -2
  169. data/app/views/catalog/_show_tools.html.erb +7 -12
  170. data/app/views/catalog/_view_type_group.html.erb +1 -1
  171. data/app/views/catalog/email_success.html.erb +5 -6
  172. data/app/views/catalog/facet.html.erb +4 -2
  173. data/app/views/catalog/index.atom.builder +12 -14
  174. data/app/views/catalog/index.html.erb +4 -1
  175. data/app/views/catalog/index.json.jbuilder +21 -19
  176. data/app/views/catalog/index.rss.builder +1 -1
  177. data/app/views/catalog/opensearch.xml.builder +1 -1
  178. data/app/views/catalog/show.json.jbuilder +2 -0
  179. data/app/views/catalog/sms_success.html.erb +5 -6
  180. data/app/views/catalog/suggest.html.erb +3 -0
  181. data/app/views/layouts/blacklight/base.html.erb +23 -9
  182. data/app/views/search_history/index.html.erb +6 -2
  183. data/app/views/shared/_header_navbar.html.erb +1 -22
  184. data/app/views/shared/_modal.html.erb +3 -3
  185. data/blacklight.gemspec +6 -8
  186. data/config/importmap.rb +3 -0
  187. data/config/locales/blacklight.ar.yml +0 -1
  188. data/config/locales/blacklight.ca.yml +0 -1
  189. data/config/locales/blacklight.de.yml +0 -1
  190. data/config/locales/blacklight.en.yml +0 -1
  191. data/config/locales/blacklight.es.yml +0 -1
  192. data/config/locales/blacklight.fr.yml +0 -1
  193. data/config/locales/blacklight.hu.yml +0 -1
  194. data/config/locales/blacklight.it.yml +0 -1
  195. data/config/locales/blacklight.nl.yml +0 -1
  196. data/config/locales/blacklight.pt-BR.yml +0 -1
  197. data/config/locales/blacklight.sq.yml +0 -1
  198. data/config/locales/blacklight.zh.yml +0 -1
  199. data/config/routes.rb +3 -2
  200. data/db/migrate/20140202020201_create_searches.rb +1 -0
  201. data/db/migrate/20140202020202_create_bookmarks.rb +1 -0
  202. data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +1 -0
  203. data/lib/blacklight/abstract_repository.rb +1 -0
  204. data/lib/blacklight/configuration/context.rb +4 -4
  205. data/lib/blacklight/configuration/display_field.rb +7 -9
  206. data/lib/blacklight/configuration/facet_field.rb +17 -11
  207. data/lib/blacklight/configuration/field.rb +1 -0
  208. data/lib/blacklight/configuration/fields.rb +12 -15
  209. data/lib/blacklight/configuration/index_field.rb +1 -0
  210. data/lib/blacklight/configuration/null_display_field.rb +17 -0
  211. data/lib/blacklight/configuration/search_field.rb +1 -0
  212. data/lib/blacklight/configuration/show_field.rb +1 -0
  213. data/lib/blacklight/configuration/sort_field.rb +1 -0
  214. data/lib/blacklight/configuration/tool_config.rb +1 -0
  215. data/lib/blacklight/configuration/view_config.rb +16 -6
  216. data/lib/blacklight/configuration.rb +318 -341
  217. data/lib/blacklight/engine.rb +10 -11
  218. data/lib/blacklight/exceptions.rb +2 -2
  219. data/lib/blacklight/nested_open_struct_with_hash_access.rb +6 -12
  220. data/lib/blacklight/open_struct_with_hash_access.rb +19 -17
  221. data/lib/blacklight/parameters.rb +7 -21
  222. data/lib/blacklight/routes/exportable.rb +1 -0
  223. data/lib/blacklight/routes/searchable.rb +2 -1
  224. data/lib/blacklight/routes.rb +1 -0
  225. data/lib/blacklight/search_builder.rb +10 -10
  226. data/lib/blacklight/search_state/filter_field.rb +8 -25
  227. data/lib/blacklight/search_state/pivot_filter_field.rb +144 -0
  228. data/lib/blacklight/search_state.rb +23 -79
  229. data/lib/blacklight/solr/document.rb +1 -0
  230. data/lib/blacklight/solr/facet_paginator.rb +1 -0
  231. data/lib/blacklight/solr/repository.rb +1 -0
  232. data/lib/blacklight/solr/request.rb +3 -0
  233. data/lib/blacklight/solr/response/facets.rb +21 -5
  234. data/lib/blacklight/solr/response/group.rb +1 -0
  235. data/lib/blacklight/solr/response/group_response.rb +1 -0
  236. data/lib/blacklight/solr/response/more_like_this.rb +1 -0
  237. data/lib/blacklight/solr/response/pagination_methods.rb +4 -3
  238. data/lib/blacklight/solr/response/params.rb +5 -4
  239. data/lib/blacklight/solr/response/response.rb +1 -0
  240. data/lib/blacklight/solr/response/spelling.rb +1 -0
  241. data/lib/blacklight/solr/response.rb +4 -3
  242. data/lib/blacklight/solr/search_builder_behavior.rb +16 -32
  243. data/lib/blacklight/solr.rb +1 -0
  244. data/lib/blacklight/version.rb +1 -0
  245. data/lib/blacklight.rb +8 -11
  246. data/lib/generators/blacklight/assets/importmap_generator.rb +55 -0
  247. data/lib/generators/blacklight/assets/propshaft_generator.rb +25 -0
  248. data/lib/generators/blacklight/assets/sprockets_generator.rb +66 -0
  249. data/lib/generators/blacklight/assets_generator.rb +13 -89
  250. data/lib/generators/blacklight/controller_generator.rb +3 -2
  251. data/lib/generators/blacklight/document_generator.rb +1 -0
  252. data/lib/generators/blacklight/install_generator.rb +5 -4
  253. data/lib/generators/blacklight/models_generator.rb +1 -0
  254. data/lib/generators/blacklight/search_builder_generator.rb +1 -0
  255. data/lib/generators/blacklight/solr_generator.rb +1 -1
  256. data/lib/generators/blacklight/templates/catalog_controller.rb +37 -7
  257. data/lib/generators/blacklight/templates/solr_document.rb +1 -1
  258. data/lib/generators/blacklight/test_support_generator.rb +4 -2
  259. data/lib/generators/blacklight/user_generator.rb +7 -9
  260. data/lib/railties/blacklight.rake +2 -3
  261. data/package.json +9 -12
  262. data/rollup.config.js +27 -0
  263. data/spec/components/blacklight/constraints_component_spec.rb +17 -13
  264. data/spec/components/blacklight/document_component_spec.rb +12 -22
  265. data/spec/components/blacklight/facet_component_spec.rb +2 -7
  266. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +1 -2
  267. data/spec/components/blacklight/facet_field_list_component_spec.rb +7 -6
  268. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +9 -7
  269. data/spec/components/blacklight/response/view_type_component_spec.rb +66 -0
  270. data/spec/components/blacklight/search_context_component_spec.rb +40 -0
  271. data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +1 -6
  272. data/spec/controllers/blacklight/{base_spec.rb → catalog_spec.rb} +2 -2
  273. data/spec/controllers/bookmarks_controller_spec.rb +2 -3
  274. data/spec/controllers/catalog_controller_spec.rb +15 -129
  275. data/spec/features/autocomplete_spec.rb +1 -1
  276. data/spec/features/axe_spec.rb +1 -1
  277. data/spec/features/bookmarks_spec.rb +9 -0
  278. data/spec/features/facets_spec.rb +1 -1
  279. data/spec/features/search_context_spec.rb +4 -10
  280. data/spec/features/search_results_spec.rb +0 -33
  281. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +2 -138
  282. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +0 -387
  283. data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +8 -0
  284. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +5 -7
  285. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +9 -131
  286. data/spec/helpers/blacklight_helper_spec.rb +3 -242
  287. data/spec/helpers/catalog_helper_spec.rb +7 -118
  288. data/spec/i18n_spec.rb +1 -0
  289. data/spec/integration/generators/blacklight/solr_generator_spec.rb +1 -1
  290. data/spec/lib/blacklight/configuration/facet_field_spec.rb +27 -16
  291. data/spec/lib/blacklight/configuration/field_spec.rb +1 -1
  292. data/spec/lib/blacklight/configuration/view_config_spec.rb +1 -1
  293. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +2 -2
  294. data/spec/lib/blacklight/parameters_spec.rb +1 -4
  295. data/spec/lib/blacklight/search_state/filter_field_spec.rb +4 -4
  296. data/spec/lib/blacklight/search_state/pivot_filter_field_spec.rb +117 -0
  297. data/spec/lib/blacklight/search_state_spec.rb +80 -198
  298. data/spec/lib/tasks/blacklight_task_spec.rb +1 -0
  299. data/spec/models/blacklight/configuration_spec.rb +39 -51
  300. data/spec/models/blacklight/document/active_model_shim_spec.rb +2 -2
  301. data/spec/models/blacklight/icon_spec.rb +31 -15
  302. data/spec/models/blacklight/search_builder_spec.rb +9 -9
  303. data/spec/models/blacklight/solr/document_spec.rb +3 -3
  304. data/spec/models/blacklight/solr/response/facets_spec.rb +27 -27
  305. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -0
  306. data/spec/models/blacklight/solr/response/group_spec.rb +1 -0
  307. data/spec/models/blacklight/solr/response_spec.rb +9 -2
  308. data/spec/models/blacklight/solr/search_builder_spec.rb +32 -23
  309. data/spec/models/blacklight/user_spec.rb +22 -0
  310. data/spec/models/solr_document_spec.rb +21 -3
  311. data/spec/presenters/blacklight/clause_presenter_spec.rb +1 -0
  312. data/spec/presenters/blacklight/document_presenter_spec.rb +2 -2
  313. data/spec/presenters/blacklight/facet_field_presenter_spec.rb +85 -12
  314. data/spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb +1 -0
  315. data/spec/presenters/blacklight/facet_item_presenter_spec.rb +14 -13
  316. data/spec/presenters/blacklight/field_presenter_spec.rb +0 -14
  317. data/spec/presenters/blacklight/index_presenter_spec.rb +2 -4
  318. data/spec/presenters/blacklight/json_presenter_spec.rb +1 -0
  319. data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +3 -2
  320. data/spec/presenters/blacklight/show_presenter_spec.rb +10 -25
  321. data/spec/presenters/thumbnail_presenter_spec.rb +1 -1
  322. data/spec/requests/load_suggestions_spec.rb +16 -0
  323. data/spec/routing/catalog_routing_spec.rb +2 -1
  324. data/spec/services/blacklight/search_service_spec.rb +31 -68
  325. data/spec/spec_helper.rb +3 -2
  326. data/spec/support/controller_level_helpers.rb +1 -2
  327. data/spec/support/features/search_helpers.rb +39 -0
  328. data/spec/support/features/session_helpers.rb +1 -0
  329. data/spec/support/features.rb +3 -0
  330. data/spec/test_app_templates/lib/generators/test_app_generator.rb +9 -2
  331. data/spec/views/catalog/_document.html.erb_spec.rb +3 -34
  332. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +1 -1
  333. data/spec/views/catalog/_search_header.erb_spec.rb +1 -0
  334. data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -0
  335. data/spec/views/catalog/_show_tools.html.erb_spec.rb +7 -54
  336. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +17 -9
  337. data/spec/views/catalog/email_success.html.erb_spec.rb +2 -2
  338. data/spec/views/catalog/facet.html.erb_spec.rb +6 -3
  339. data/spec/views/catalog/index.atom.builder_spec.rb +18 -11
  340. data/spec/views/catalog/index.html.erb_spec.rb +5 -6
  341. data/spec/views/catalog/index.json.jbuilder_spec.rb +5 -19
  342. data/spec/views/catalog/show.html.erb_spec.rb +3 -25
  343. data/spec/views/catalog/show.json.jbuilder_spec.rb +2 -9
  344. data/spec/views/catalog/sms_success.html.erb_spec.rb +2 -2
  345. data/tasks/blacklight.rake +6 -4
  346. metadata +66 -112
  347. data/.babelrc +0 -11
  348. data/app/assets/images/blacklight/list.svg +0 -1
  349. data/app/assets/images/blacklight/search.svg +0 -1
  350. data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +0 -37
  351. data/app/components/blacklight/content_areas_shim.rb +0 -13
  352. data/app/controllers/concerns/blacklight/base.rb +0 -7
  353. data/app/controllers/concerns/blacklight/default_component_configuration.rb +0 -64
  354. data/app/controllers/concerns/blacklight/facet.rb +0 -69
  355. data/app/controllers/concerns/blacklight/search_fields.rb +0 -46
  356. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +0 -27
  357. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +0 -188
  358. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +0 -97
  359. data/app/helpers/blacklight/suggest_helper_behavior.rb +0 -13
  360. data/app/javascript/blacklight/autocomplete.js +0 -36
  361. data/app/javascript/blacklight/facet_load.js +0 -22
  362. data/app/presenters/blacklight/search_bar_presenter.rb +0 -47
  363. data/app/views/catalog/_constraints_element.html.erb +0 -14
  364. data/app/views/catalog/_document_action.html.erb +0 -5
  365. data/app/views/catalog/_facet_group.html.erb +0 -5
  366. data/app/views/catalog/_facet_limit.html.erb +0 -3
  367. data/app/views/catalog/_index.html.erb +0 -1
  368. data/app/views/catalog/_index_header.html.erb +0 -22
  369. data/app/views/catalog/_previous_next_doc.html.erb +0 -2
  370. data/app/views/catalog/_show.html.erb +0 -6
  371. data/app/views/catalog/_show_header.html.erb +0 -2
  372. data/app/views/catalog/_thumbnail.html.erb +0 -1
  373. data/lib/blacklight/deprecations/engine_configuration.rb +0 -66
  374. data/lib/blacklight/deprecations/search_state_normalization.rb +0 -52
  375. data/spec/controllers/blacklight/facet_spec.rb +0 -33
  376. data/spec/controllers/blacklight/search_fields_spec.rb +0 -62
  377. data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +0 -26
  378. data/spec/helpers/blacklight/render_constraints_helper_behavior_spec.rb +0 -92
  379. data/spec/helpers/blacklight/search_history_constraints_helper_behavior_spec.rb +0 -108
  380. data/spec/helpers/blacklight/suggest_helper_behavior_spec.rb +0 -48
  381. data/spec/lib/blacklight/engine_spec.rb +0 -41
  382. data/spec/presenters/blacklight/search_bar_presenter_spec.rb +0 -94
  383. data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -33
  384. data/spec/views/catalog/_facet_group.html.erb_spec.rb +0 -84
  385. data/spec/views/catalog/_facets.html.erb_spec.rb +0 -15
  386. data/spec/views/catalog/_index.html.erb_spec.rb +0 -62
  387. data/spec/views/catalog/_index_header.html.erb_spec.rb +0 -35
  388. data/spec/views/catalog/_previous_next_doc.html.erb_spec.rb +0 -22
  389. data/spec/views/catalog/_show.html.erb_spec.rb +0 -62
  390. data/spec/views/catalog/_thumbnail.html.erb_spec.rb +0 -38
@@ -5,17 +5,28 @@
5
5
  # would be provided by Blacklight::Controller
6
6
  # 1. search_state
7
7
  # 2. blacklight_config
8
- # 3. search_service_class
9
8
  #
10
9
  # Additionally, the including class may override the search_service_context method to provide
11
10
  # further context to the SearchService. For example you could override this to provide the
12
11
  # currently signed in user.
13
12
  module Blacklight::Searchable
13
+ extend ActiveSupport::Concern
14
+
15
+ included do
16
+ # Which class to use for the search service. You can subclass SearchService if you
17
+ # want to override any of the methods (e.g. SearchService#fetch)
18
+ class_attribute :search_service_class
19
+ self.search_service_class = Blacklight::SearchService
20
+ end
21
+
14
22
  # @return [Blacklight::SearchService]
15
23
  def search_service
16
24
  search_service_class.new(config: blacklight_config, search_state: search_state, user_params: search_state.to_h, **search_service_context)
17
25
  end
18
26
 
27
+ # Override this method on the class that includes Blacklight::Searchable to provide more context to the search service if necessary.
28
+ # For example, if your search builder needs to be aware of the current user, override this method to return a hash including the current user.
29
+ # Then the search builder could use some property about the current user to construct a constraint on the search.
19
30
  # @return [Hash] a hash of context information to pass through to the search service
20
31
  def search_service_context
21
32
  {}
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Blacklight::TokenBasedUser
3
4
  extend ActiveSupport::Concern
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class SearchHistoryController < ApplicationController
3
4
  include Blacklight::SearchHistory
4
5
  end
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Methods added to this helper will be available to all templates in the hosting application
3
4
  module Blacklight::BlacklightHelperBehavior
4
- extend Deprecation
5
-
6
5
  include Blacklight::UrlHelperBehavior
7
- include Blacklight::HashAsHiddenFieldsHelperBehavior
8
6
  include Blacklight::LayoutHelperBehavior
9
7
  include Blacklight::IconHelperBehavior
10
8
 
@@ -51,15 +49,6 @@ module Blacklight::BlacklightHelperBehavior
51
49
  document_presenter(document).link_rel_alternates(options)
52
50
  end
53
51
 
54
- ##
55
- # Render OpenSearch headers for this search
56
- # @deprecated
57
- # @return [String]
58
- def render_opensearch_response_metadata
59
- render partial: 'catalog/opensearch_response_metadata', locals: { response: @response }
60
- end
61
- deprecation_deprecate render_opensearch_response_metadata: 'Use `render "catalog/opensearch_response_metadata"\' instead'
62
-
63
52
  ##
64
53
  # Render classes for the <body> element
65
54
  # @return [String]
@@ -72,198 +61,8 @@ module Blacklight::BlacklightHelperBehavior
72
61
  # @see render_body_class
73
62
  # @return [Array<String>]
74
63
  def extra_body_classes
75
- @extra_body_classes ||= ['blacklight-' + controller.controller_name, 'blacklight-' + [controller.controller_name, controller.action_name].join('-')]
76
- end
77
-
78
- ##
79
- # Render the search navbar
80
- # @return [String]
81
- def render_search_bar
82
- if search_bar_presenter_class == Blacklight::SearchBarPresenter && partial_from_blacklight?(Blacklight::SearchBarPresenter.partial)
83
- component_class = blacklight_config&.view_config(document_index_view_type)&.search_bar_component || Blacklight::SearchBarComponent
84
- render component_class.new(
85
- url: search_action_url,
86
- advanced_search_url: search_action_url(action: 'advanced_search'),
87
- params: search_state.params_for_search.except(:qt),
88
- search_fields: Deprecation.silence(Blacklight::ConfigurationHelperBehavior) { search_fields },
89
- autocomplete_path: search_action_path(action: :suggest)
90
- )
91
- else
92
- search_bar_presenter.render
93
- end
94
- end
95
- deprecation_deprecate render_search_bar: "Call `render Blacklight::SearchBarComponent.new' instead"
96
-
97
- # @!group Presenter extension helpers
98
- ##
99
- # @return [Blacklight::SearchBarPresenter]
100
- def search_bar_presenter
101
- @search_bar ||= search_bar_presenter_class.new(controller, blacklight_config)
102
- end
103
- deprecation_deprecate :search_bar_presenter
104
-
105
- # @!group Document helpers
106
- ##
107
- # Determine whether to render a given field in the index view.
108
- #
109
- # @deprecated
110
- # @param [SolrDocument] document
111
- # @param [Blacklight::Configuration::Field] field_config
112
- # @return [Boolean]
113
- def should_render_index_field? document, field_config
114
- Deprecation.warn self, "should_render_index_field? is deprecated and will be removed in Blacklight 8. Use IndexPresenter#render_field? instead."
115
- should_render_field?(field_config, document) && document_has_value?(document, field_config)
116
- end
117
-
118
- ##
119
- # Determine whether to render a given field in the show view
120
- #
121
- # @deprecated
122
- # @param [SolrDocument] document
123
- # @param [Blacklight::Configuration::Field] field_config
124
- # @return [Boolean]
125
- def should_render_show_field? document, field_config
126
- Deprecation.warn self, "should_render_show_field? is deprecated and will be removed in Blacklight 8. Use ShowPresenter#render_field? instead."
127
- should_render_field?(field_config, document) && document_has_value?(document, field_config)
128
- end
129
-
130
- ##
131
- # Check if a document has (or, might have, in the case of accessor methods) a value for
132
- # the given solr
133
- # @deprecated
134
- # @param [SolrDocument] document
135
- # @param [Blacklight::Configuration::Field] field_config
136
- # @return [Boolean]
137
- def document_has_value? document, field_config
138
- Deprecation.warn self, "document_has_value? is deprecated and will be removed in Blacklight 8. Use DocumentPresenter#has_value? instead."
139
- document.has?(field_config.field) ||
140
- (document.has_highlight_field? field_config.field if field_config.highlight) ||
141
- field_config.accessor
142
- end
143
-
144
- # @!group Search result helpers
145
- ##
146
- # Determine whether to display spellcheck suggestions
147
- #
148
- # @deprecated
149
- # @param [Blacklight::Solr::Response] response
150
- # @return [Boolean]
151
- def should_show_spellcheck_suggestions? response
152
- Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
153
- # The spelling response field may be missing from non solr repositories.
154
- response.total <= spell_check_max &&
155
- (response.spelling&.words&.any? || response.spelling&.collation&.present? || false)
156
- end
157
- end
158
- deprecation_deprecate should_show_spellcheck_suggestions?: 'moving into a private method of Blacklight::Response::SpellcheckComponent'
159
-
160
- # @!group Document helpers
161
- ##
162
- # Render the index field label for a document
163
- #
164
- # Translations for index field labels should go under blacklight.search.fields
165
- # They are picked up from there by a value "%{label}" in blacklight.search.index.label
166
- #
167
- # @deprecated
168
- # @overload render_index_field_label(options)
169
- # Use the default, document-agnostic configuration
170
- # @param [Hash] opts
171
- # @option opts [String] :field
172
- # @overload render_index_field_label(document, options)
173
- # Allow an extention point where information in the document
174
- # may drive the value of the field
175
- # @param [SolrDocument] doc
176
- # @param [Hash] opts
177
- # @option opts [String] :field
178
- # @return [String]
179
- def render_index_field_label *args
180
- options = args.extract_options!
181
- document = args.first
182
-
183
- field = options[:field]
184
- label = Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
185
- options[:label] || index_field_label(document, field)
186
- end
187
- html_escape t(:"blacklight.search.index.#{document_index_view_type}.label", default: :'blacklight.search.index.label', label: label)
188
- end
189
- deprecation_deprecate render_index_field_label: 'Use Blacklight::MetadataFieldComponent instead'
190
-
191
- ##
192
- # Render the show field label for a document
193
- #
194
- # @deprecated
195
- # @overload render_document_show_field_label(options)
196
- # Use the default, document-agnostic configuration
197
- # @param [Hash] opts
198
- # @option opts [String] :field
199
- # @overload render_document_show_field_label(document, options)
200
- # Allow an extention point where information in the document
201
- # may drive the value of the field
202
- # @param [SolrDocument] doc
203
- # @param [Hash] opts
204
- # @option opts [String] :field
205
- # @return [String]
206
- def render_document_show_field_label *args
207
- options = args.extract_options!
208
- document = args.first
209
-
210
- field = options[:field]
211
- label = Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
212
- options[:label] || document_show_field_label(document, field)
213
- end
214
-
215
- t(:'blacklight.search.show.label', label: label)
64
+ @extra_body_classes ||= ["blacklight-#{controller.controller_name}", "blacklight-#{[controller.controller_name, controller.action_name].join('-')}"]
216
65
  end
217
- deprecation_deprecate render_document_show_field_label: 'Use Blacklight::MetadataFieldComponent instead'
218
-
219
- ##
220
- # Get the value of the document's "title" field, or a placeholder
221
- # value (if empty)
222
- #
223
- # @deprecated
224
- # @param [SolrDocument] document
225
- # @return [String]
226
- def document_heading document = nil
227
- document ||= @document
228
- document_presenter(document).heading
229
- end
230
- deprecation_deprecate document_heading: 'Use Blacklight::DocumentPresenter#heading instead'
231
-
232
- ##
233
- # Get the document's "title" to display in the <title> element.
234
- # (by default, use the #document_heading)
235
- #
236
- # @deprecated
237
- # @see #document_heading
238
- # @param [SolrDocument] document
239
- # @return [String]
240
- def document_show_html_title document = nil
241
- document ||= @document
242
-
243
- document_presenter(document).html_title
244
- end
245
- deprecation_deprecate document_show_html_title: 'Use Blacklight::DocumentPresenter#html_title instead'
246
-
247
- ##
248
- # Render the document "heading" (title) in a content tag
249
- # @deprecated
250
- # @overload render_document_heading(document, options)
251
- # @param [SolrDocument] document
252
- # @param [Hash] options
253
- # @option options [Symbol] :tag
254
- # @overload render_document_heading(options)
255
- # @param [Hash] options
256
- # @option options [Symbol] :tag
257
- # @return [String]
258
- def render_document_heading(*args)
259
- options = args.extract_options!
260
- document = args.first
261
- tag = options.fetch(:tag, :h4)
262
- document ||= @document
263
-
264
- content_tag(tag, document_presenter(document).heading, itemprop: "name")
265
- end
266
- deprecation_deprecate render_document_heading: 'Removed without replacement'
267
66
 
268
67
  ##
269
68
  # Get the current "view type" (and ensure it is a valid type)
@@ -309,101 +108,24 @@ module Blacklight::BlacklightHelperBehavior
309
108
  response&.grouped?
310
109
  end
311
110
 
312
- # @!group Presenter extension helpers
313
- ##
314
- # Returns a document presenter for the given document
315
- # TODO: Move this to the controller. It can just pass a presenter or set of presenters.
316
- # @deprecated
317
- # @return [Blacklight::DocumentPresenter]
318
- def presenter(document)
319
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#presenter is deprecated; use #document_presenter instead')
320
-
321
- # As long as the presenter methods haven't been overridden, we can use the new behavior
322
- if method(:show_presenter).owner == Blacklight::BlacklightHelperBehavior &&
323
- method(:index_presenter).owner == Blacklight::BlacklightHelperBehavior
324
- return document_presenter_class(document).new(document, self)
325
- end
326
-
327
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#show_presenter and/or #index_presenter have been overridden; please override #document_presenter instead')
328
-
329
- Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
330
- case action_name
331
- when 'show', 'citation'
332
- show_presenter(document)
333
- else
334
- index_presenter(document)
335
- end
336
- end
337
- end
338
-
339
111
  ##
340
112
  # Returns a document presenter for the given document
341
113
  def document_presenter(document)
342
- Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
343
- presenter(document)
344
- end
345
- end
346
-
347
- # @deprecated
348
- # @return [Blacklight::ShowPresenter]
349
- def show_presenter(document)
350
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#show_presenter is deprecated; use #document_presenter instead')
351
-
352
- if method(:show_presenter_class).owner != Blacklight::BlacklightHelperBehavior
353
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#show_presenter_class has been overridden; please override #document_presenter_class instead')
354
- end
355
-
356
- Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
357
- show_presenter_class(document).new(document, self)
358
- end
359
- end
360
-
361
- # @deprecated
362
- # @return [Blacklight::IndexPresenter]
363
- def index_presenter(document)
364
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#index_presenter is deprecated; use #document_presenter instead')
365
-
366
- if method(:index_presenter_class).owner != Blacklight::BlacklightHelperBehavior
367
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#index_presenter_class has been overridden; please override #document_presenter_class instead')
368
- end
369
-
370
- Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
371
- index_presenter_class(document).new(document, self)
372
- end
114
+ document_presenter_class(document).new(document, self)
373
115
  end
374
116
 
375
117
  ##
376
118
  # Override this method if you want to use a differnet presenter for your documents
377
- # @param [Blacklight::Document] document optional, here for extension + backwards compatibility only
378
- def document_presenter_class(document = nil)
379
- Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
380
- case action_name
381
- when 'show', 'citation'
382
- show_presenter_class(document)
383
- else
384
- index_presenter_class(document)
385
- end
119
+ # @param [Blacklight::Document] _document optional, here for extension + backwards compatibility only
120
+ def document_presenter_class(_document = nil)
121
+ case action_name
122
+ when 'show', 'citation'
123
+ blacklight_config.view_config(:show, action_name: action_name).document_presenter_class
124
+ else
125
+ blacklight_config.view_config(document_index_view_type, action_name: action_name).document_presenter_class
386
126
  end
387
127
  end
388
128
 
389
- ##
390
- # Override this method if you want to use a different presenter class
391
- # @deprecated
392
- # @return [Class]
393
- def show_presenter_class(_document)
394
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#show_presenter_class is deprecated; use #document_presenter_class instead')
395
-
396
- blacklight_config.view_config(:show, action_name: action_name).document_presenter_class
397
- end
398
-
399
- # @deprecated
400
- # @return [Class]
401
- def index_presenter_class(_document)
402
- Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#index_presenter_class is deprecated; use #document_presenter_class instead')
403
-
404
- blacklight_config.view_config(document_index_view_type, action_name: action_name).document_presenter_class
405
- end
406
-
407
129
  # @return [Class]
408
130
  def search_bar_presenter_class
409
131
  blacklight_config.view_config(action_name: :index).search_bar_presenter_class
@@ -416,24 +138,4 @@ module Blacklight::BlacklightHelperBehavior
416
138
  def opensearch_description_tag title, href
417
139
  tag :link, href: href, title: title, type: "application/opensearchdescription+xml", rel: "search"
418
140
  end
419
-
420
- # @private
421
-
422
- def self.blacklight_path
423
- @blacklight_path ||= Gem.loaded_specs["blacklight"].full_gem_path
424
- end
425
-
426
- def partial_from_blacklight?(partial)
427
- path = if Rails::VERSION::MAJOR >= 6
428
- name = partial.split('/').last
429
- prefix = partial.split('/').first if partial.include?('/')
430
- logger&.debug "Looking for document index partial #{partial}"
431
- prefixes = lookup_context.prefixes + [prefix, ""].compact
432
- lookup_context.find_all(name, prefixes, true).first&.identifier
433
- else
434
- lookup_context.find_all(partial, lookup_context.prefixes + [""], true).first&.identifier
435
- end
436
-
437
- path&.starts_with?(Blacklight::BlacklightHelperBehavior.blacklight_path)
438
- end
439
141
  end
@@ -1,16 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Helper methods for catalog-like controllers
3
4
  module Blacklight::CatalogHelperBehavior
4
- extend Deprecation
5
- self.deprecation_horizon = 'blacklight 8.0'
6
-
7
5
  include Blacklight::ConfigurationHelperBehavior
8
6
  include Blacklight::ComponentHelperBehavior
9
7
  include Blacklight::FacetsHelperBehavior
10
- include Blacklight::RenderConstraintsHelperBehavior
11
8
  include Blacklight::RenderPartialsHelperBehavior
12
- include Blacklight::SearchHistoryConstraintsHelperBehavior
13
- include Blacklight::SuggestHelperBehavior
14
9
 
15
10
  # @param [Hash] options
16
11
  # @option options :route_set the route scope to use when constructing the link
@@ -64,18 +59,18 @@ module Blacklight::CatalogHelperBehavior
64
59
  end
65
60
 
66
61
  case collection.total_count
67
- when 0
68
- t('blacklight.search.pagination_info.no_items_found', entry_name: entry_name).html_safe
69
- when 1
70
- t('blacklight.search.pagination_info.single_item_found', entry_name: entry_name).html_safe
71
- else
72
- t('blacklight.search.pagination_info.pages', entry_name: entry_name,
73
- current_page: collection.current_page,
74
- num_pages: collection.total_pages,
75
- start_num: number_with_delimiter(collection.offset_value + 1),
76
- end_num: number_with_delimiter(end_num),
77
- total_num: number_with_delimiter(collection.total_count),
78
- count: collection.total_pages).html_safe
62
+ when 0
63
+ t('blacklight.search.pagination_info.no_items_found', entry_name: entry_name).html_safe
64
+ when 1
65
+ t('blacklight.search.pagination_info.single_item_found', entry_name: entry_name).html_safe
66
+ else
67
+ t('blacklight.search.pagination_info.pages', entry_name: entry_name,
68
+ current_page: collection.current_page,
69
+ num_pages: collection.total_pages,
70
+ start_num: number_with_delimiter(collection.offset_value + 1),
71
+ end_num: number_with_delimiter(end_num),
72
+ total_num: number_with_delimiter(collection.total_count),
73
+ count: collection.total_pages).html_safe
79
74
  end
80
75
  end
81
76
 
@@ -94,20 +89,6 @@ module Blacklight::CatalogHelperBehavior
94
89
  end
95
90
  end
96
91
 
97
- ##
98
- # Like #page_entries_info above, but for an individual
99
- # item show page. Displays "showing X of Y items" message.
100
- #
101
- # @deprecated
102
- # @see #page_entries_info
103
- # @return [String]
104
- def item_page_entry_info
105
- t('blacklight.search.entry_pagination_info.other', current: number_with_delimiter(search_session['counter']),
106
- total: number_with_delimiter(search_session['total']),
107
- count: search_session['total'].to_i).html_safe
108
- end
109
- deprecation_deprecate item_page_entry_info: 'Use Blacklight::SearchContextComponent methods instead'
110
-
111
92
  ##
112
93
  # Look up search field user-displayable label
113
94
  # based on params[:qt] and blacklight_configuration.
@@ -162,27 +143,10 @@ module Blacklight::CatalogHelperBehavior
162
143
  #
163
144
  # @param [SolrDocument] document
164
145
  # @return [String]
165
- def render_document_sidebar_partial(document = nil)
166
- unless document
167
- Deprecation.warn(self, 'render_document_sidebar_partial expects one argument ' \
168
- '(@document) and you passed none. This behavior will be removed in version 8')
169
- document = @document
170
- end
146
+ def render_document_sidebar_partial(document)
171
147
  render 'show_sidebar', document: document
172
148
  end
173
149
 
174
- ##
175
- # Render the main content partial for a document
176
- # This is widely used as by downstream apps when they override their show view.
177
- # See https://github.com/search?q=render_document_main_content_partial&type=Code
178
- #
179
- # @param [SolrDocument] _document
180
- # @return [String]
181
- def render_document_main_content_partial(_document = @document)
182
- render partial: 'show_main_content'
183
- end
184
- deprecation_deprecate render_document_main_content_partial: "Use \"render 'show_main_content'\" instead"
185
-
186
150
  ##
187
151
  # Should we display the sort and per page widget?
188
152
  #
@@ -204,95 +168,16 @@ module Blacklight::CatalogHelperBehavior
204
168
  end
205
169
 
206
170
  ##
207
- # If no search parameters have been given, we should
208
- # auto-focus the user's cursor into the searchbox
209
- #
210
- # @deprecated
211
- # @return [Boolean]
212
- def should_autofocus_on_search_box?
213
- controller.is_a?(Blacklight::Catalog) &&
214
- action_name == "index" &&
215
- !has_search_parameters?
216
- end
217
- deprecation_deprecate should_autofocus_on_search_box?: "use SearchBarPresenter#autofocus?"
218
-
219
- ##
220
- # Does the document have a thumbnail to render?
221
- #
222
- # @deprecated
223
- # @param [SolrDocument] document
224
- # @return [Boolean]
225
- def has_thumbnail? document
226
- document_presenter(document).thumbnail.exists?
227
- end
228
- deprecation_deprecate has_thumbnail?: "use IndexPresenter#thumbnail.exists?"
229
-
230
- ##
231
- # Render the thumbnail, if available, for a document and
232
- # link it to the document record.
233
- #
234
- # @deprecated
235
- # @param [SolrDocument] document
236
- # @param [Hash] image_options to pass to the image tag
237
- # @param [Hash] url_options to pass to #link_to_document
238
- # @return [String]
239
- def render_thumbnail_tag document, image_options = {}, url_options = {}
240
- document_presenter(document).thumbnail.thumbnail_tag(image_options, url_options)
241
- end
242
- deprecation_deprecate render_thumbnail_tag: "Use IndexPresenter#thumbnail.thumbnail_tag"
243
-
244
- ##
245
- # Get the URL to a document's thumbnail image
246
- #
247
- # @deprecated
248
- # @param [SolrDocument] document
249
- # @return [String]
250
- def thumbnail_url document
251
- if document.has? blacklight_config.view_config(document_index_view_type).thumbnail_field
252
- document.first(blacklight_config.view_config(document_index_view_type).thumbnail_field)
253
- end
254
- end
255
- deprecation_deprecate thumbnail_url: "this method will be removed without replacement"
256
-
257
- ##
258
- # Render the view type icon for the results view picker
259
- #
260
- # @deprecated
261
- # @param [String] view
262
- # @return [String]
263
- def render_view_type_group_icon view
264
- blacklight_icon(view)
265
- end
266
- deprecation_deprecate render_view_type_group_icon: 'call blacklight_icon instead'
267
-
268
- ##
269
- # Get the default view type classes for a view in the results view picker
270
- #
271
- # @deprecated
272
- # @param [String] view
273
- # @return [String]
274
- def default_view_type_group_icon_classes view
275
- Deprecation.warn(Blacklight::CatalogHelperBehavior, 'This method has been deprecated, use blacklight_icons helper instead')
276
- "glyphicon-#{view.to_s.parameterize} view-icon-#{view.to_s.parameterize}"
277
- end
278
-
279
- ##
280
- # return the Bookmarks on a set of documents
281
- # @param [Enumerable<Blacklight::Document>] documents_or_response
171
+ # return the Bookmarks on a set of documents (all bookmarks on the page)
172
+ # @private
282
173
  # @return [Enumerable<Bookmark>]
283
- def current_bookmarks documents_or_response = nil
284
- documents = if documents_or_response.respond_to? :documents
285
- Deprecation.warn(Blacklight::CatalogHelperBehavior, "Passing a response to #current_bookmarks is deprecated; pass response.documents instead")
286
- documents_or_response.documents
287
- else
288
- documents_or_response
289
- end
290
-
291
- documents ||= [@document] if @document.present?
292
- documents ||= @response.documents
293
-
294
- @current_bookmarks ||= current_or_guest_user.bookmarks_for_documents(documents).to_a
174
+ def current_bookmarks
175
+ @current_bookmarks ||= begin
176
+ documents = @document.presence || @response.documents
177
+ current_or_guest_user.bookmarks_for_documents(Array(documents)).to_a
178
+ end
295
179
  end
180
+ private :current_bookmarks
296
181
 
297
182
  ##
298
183
  # Check if the document is in the user's bookmarks
@@ -1,31 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Blacklight
3
4
  module ComponentHelperBehavior
4
- extend Deprecation
5
-
6
- # @deprecated
7
- def document_action_label action, opts
8
- t("blacklight.tools.#{action}", default: opts.label || action.to_s.humanize)
9
- end
10
- deprecation_deprecate :document_action_label
11
-
12
- # @deprecated
13
- def document_action_path action_opts, url_opts = {}
14
- if action_opts.path
15
- send(action_opts.path, url_opts)
16
- elsif url_opts[:id].class.respond_to?(:model_name)
17
- url_for([action_opts.key.to_sym, url_opts[:id]])
18
- else
19
- send("#{action_opts.key}_#{controller_name}_path", url_opts)
20
- end
21
- end
22
- deprecation_deprecate :document_action_path
23
-
24
5
  ##
25
6
  # Render "document actions" area for navigation header
26
7
  # (normally renders "Saved Searches", "History", "Bookmarks")
27
- # These things are added by add_nav_action and the default config is
28
- # provided by DefaultComponentConfiguration
8
+ # These things are added by add_nav_action
29
9
  #
30
10
  # @param [Hash] options
31
11
  # @return [String]
@@ -60,37 +40,6 @@ module Blacklight
60
40
  render(component.new(actions: actions, classes: wrapping_class))
61
41
  end
62
42
 
63
- ##
64
- # Render "document actions" for the item detail 'show' view.
65
- # (this normally renders next to title)
66
- #
67
- # By default includes 'Bookmarks'
68
- #
69
- # @param [SolrDocument] document
70
- # @param [Hash] options
71
- # @return [String]
72
- def render_show_doc_actions(document = @document, url_opts: {}, **options)
73
- document = options[:document] if options.key? :document
74
-
75
- actions = document_actions(document, options: options)
76
-
77
- if block_given?
78
- # TODO: Deprecate this behavior and replace it with a separate component?
79
- # Deprecation.warn(Blacklight::ComponentHelperBehavior, 'Pass a block to #render_show_doc_actions is deprecated')
80
- actions.each do |action|
81
- yield action, render((action.component || Blacklight::Document::ActionComponent).new(action: action, document: document, options: options, url_opts: url_opts))
82
- end
83
-
84
- nil
85
- else
86
- render(Blacklight::Document::ActionsComponent.new(document: document, actions: actions, options: options, url_opts: url_opts))
87
- end
88
- end
89
-
90
- def render_show_doc_actions_method_from_blacklight?
91
- method(:render_show_doc_actions).owner == Blacklight::ComponentHelperBehavior
92
- end
93
-
94
43
  def show_doc_actions?(document = @document, options = {})
95
44
  filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge(options)).any?
96
45
  end