blacklight 8.0.0.beta1 → 8.0.0

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -0
  3. data/.github/workflows/ruby.yml +6 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop_todo.yml +3 -1
  6. data/README.md +1 -1
  7. data/Rakefile +18 -0
  8. data/VERSION +1 -1
  9. data/app/assets/config/blacklight/manifest.js +3 -0
  10. data/app/assets/javascripts/blacklight/blacklight.esm.js +132 -140
  11. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  12. data/app/assets/javascripts/blacklight/blacklight.js +132 -140
  13. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  14. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +1 -1
  15. data/app/assets/stylesheets/blacklight/_facets.scss +32 -5
  16. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +1 -1
  17. data/app/components/blacklight/advanced_search_form_component.rb +3 -3
  18. data/app/components/blacklight/document/actions_component.rb +1 -1
  19. data/app/components/blacklight/document/show_tools_component.html.erb +12 -0
  20. data/app/components/blacklight/document/show_tools_component.rb +23 -0
  21. data/app/components/blacklight/document_component.rb +48 -20
  22. data/app/components/blacklight/document_metadata_component.html.erb +4 -2
  23. data/app/components/blacklight/document_metadata_component.rb +8 -2
  24. data/app/components/blacklight/facet_field_checkboxes_component.html.erb +2 -2
  25. data/app/components/blacklight/facet_field_list_component.html.erb +2 -2
  26. data/app/components/blacklight/metadata_field_component.html.erb +2 -2
  27. data/app/components/blacklight/metadata_field_layout_component.rb +7 -4
  28. data/app/components/blacklight/metadata_field_plain_text_layout_component.rb +17 -0
  29. data/app/components/blacklight/response/facet_group_component.html.erb +2 -1
  30. data/app/components/blacklight/response/facet_group_component.rb +1 -1
  31. data/app/components/blacklight/response/sort_component.rb +1 -1
  32. data/app/components/blacklight/response/spellcheck_component.rb +1 -1
  33. data/app/components/blacklight/response/view_type_button_component.rb +1 -1
  34. data/app/components/blacklight/response/view_type_component.rb +2 -2
  35. data/app/components/blacklight/search/sidebar_component.html.erb +1 -1
  36. data/app/components/blacklight/search_context/server_applied_params_component.html.erb +4 -0
  37. data/app/components/blacklight/search_context/server_applied_params_component.rb +13 -0
  38. data/app/components/blacklight/search_context/server_item_pagination_component.rb +71 -0
  39. data/app/components/blacklight/system/dropdown_component.rb +3 -3
  40. data/app/components/blacklight/system/flash_message_component.rb +2 -2
  41. data/app/components/blacklight/system/modal_component.rb +1 -1
  42. data/app/components/blacklight/top_navbar_component.html.erb +1 -1
  43. data/app/components/blacklight/top_navbar_component.rb +4 -0
  44. data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
  45. data/app/controllers/concerns/blacklight/search_context.rb +46 -6
  46. data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -101
  47. data/app/helpers/blacklight/catalog_helper_behavior.rb +27 -54
  48. data/app/helpers/blacklight/component_helper_behavior.rb +0 -11
  49. data/app/helpers/blacklight/document_helper_behavior.rb +76 -0
  50. data/app/helpers/blacklight/layout_helper_behavior.rb +59 -0
  51. data/app/helpers/blacklight/render_partials_helper_behavior.rb +1 -0
  52. data/app/helpers/blacklight/url_helper_behavior.rb +11 -3
  53. data/app/javascript/blacklight/bookmark_toggle.js +8 -15
  54. data/app/javascript/blacklight/button_focus.js +10 -10
  55. data/app/javascript/blacklight/index.js +6 -5
  56. data/app/javascript/blacklight/modal.js +24 -24
  57. data/app/javascript/blacklight/search_context.js +51 -57
  58. data/app/models/concerns/blacklight/document.rb +11 -0
  59. data/app/models/record_mailer.rb +19 -15
  60. data/app/presenters/blacklight/document_presenter.rb +13 -11
  61. data/app/presenters/blacklight/index_presenter.rb +1 -1
  62. data/app/presenters/blacklight/rendering/abstract_step.rb +4 -0
  63. data/app/presenters/blacklight/rendering/join.rb +7 -1
  64. data/app/presenters/blacklight/rendering/link_to_facet.rb +1 -1
  65. data/app/presenters/blacklight/rendering/microdata.rb +1 -1
  66. data/app/services/blacklight/search_service.rb +2 -1
  67. data/app/views/catalog/_document.atom.builder +1 -1
  68. data/app/views/catalog/_document.html.erb +3 -8
  69. data/app/views/catalog/_document_list.html.erb +2 -1
  70. data/app/views/catalog/_facet_layout.html.erb +2 -2
  71. data/app/views/catalog/_show_main_content.html.erb +5 -11
  72. data/app/views/catalog/_show_tools.html.erb +1 -14
  73. data/app/views/catalog/facet.html.erb +3 -3
  74. data/app/views/catalog/index.html.erb +3 -0
  75. data/app/views/catalog/show.html.erb +1 -6
  76. data/app/views/layouts/blacklight/base.html.erb +4 -5
  77. data/app/views/record_mailer/email_record.text.erb +4 -3
  78. data/app/views/record_mailer/sms_record.text.erb +4 -4
  79. data/blacklight.gemspec +2 -2
  80. data/config/importmap.rb +1 -1
  81. data/config/locales/blacklight.ar.yml +209 -232
  82. data/config/locales/blacklight.ca.yml +0 -6
  83. data/config/locales/blacklight.de.yml +197 -215
  84. data/config/locales/blacklight.en.yml +2 -6
  85. data/config/locales/blacklight.es.yml +196 -215
  86. data/config/locales/blacklight.fr.yml +196 -219
  87. data/config/locales/blacklight.hu.yml +193 -212
  88. data/config/locales/blacklight.it.yml +197 -215
  89. data/config/locales/blacklight.nl.yml +193 -212
  90. data/config/locales/blacklight.pt-BR.yml +195 -215
  91. data/config/locales/blacklight.sq.yml +193 -212
  92. data/config/locales/blacklight.zh.yml +194 -213
  93. data/docker-compose.yml +1 -0
  94. data/lib/blacklight/configuration/session_tracking_config.rb +45 -0
  95. data/lib/blacklight/configuration/view_config.rb +0 -4
  96. data/lib/blacklight/configuration.rb +8 -4
  97. data/lib/blacklight/engine.rb +6 -7
  98. data/lib/blacklight/routes/searchable.rb +1 -0
  99. data/lib/generators/blacklight/assets/importmap_generator.rb +9 -8
  100. data/lib/generators/blacklight/assets/propshaft_generator.rb +11 -2
  101. data/lib/generators/blacklight/assets/sprockets_generator.rb +2 -0
  102. data/lib/generators/blacklight/assets_generator.rb +3 -1
  103. data/lib/generators/blacklight/install_generator.rb +3 -1
  104. data/lib/generators/blacklight/templates/solr_document.rb +0 -6
  105. data/package.json +7 -4
  106. data/rollup.config.js +11 -1
  107. data/spec/components/blacklight/document_component_spec.rb +66 -15
  108. data/spec/components/blacklight/header_component_spec.rb +20 -0
  109. data/spec/components/blacklight/response/view_type_component_spec.rb +17 -0
  110. data/spec/components/blacklight/search_bar_component_spec.rb +1 -1
  111. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +29 -0
  112. data/spec/components/blacklight/{search_context_component_spec.rb → search_context/server_item_pagination_component_spec.rb} +15 -4
  113. data/spec/controllers/bookmarks_controller_spec.rb +1 -1
  114. data/spec/controllers/catalog_controller_spec.rb +18 -6
  115. data/spec/features/component_template_override_spec.rb +8 -0
  116. data/spec/features/modal_spec.rb +12 -0
  117. data/spec/features/sitelinks_search_box_spec.rb +13 -0
  118. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +1 -1
  119. data/spec/helpers/blacklight_helper_spec.rb +0 -56
  120. data/spec/helpers/catalog_helper_spec.rb +56 -0
  121. data/spec/lib/blacklight/configuration/session_tracking_config_spec.rb +38 -0
  122. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +2 -2
  123. data/spec/models/blacklight/configuration_spec.rb +2 -2
  124. data/spec/models/blacklight/icon_spec.rb +0 -2
  125. data/spec/models/blacklight/search_builder_spec.rb +3 -3
  126. data/spec/models/blacklight/solr/request_spec.rb +2 -2
  127. data/spec/models/record_mailer_spec.rb +36 -23
  128. data/spec/presenters/blacklight/document_presenter_spec.rb +1 -0
  129. data/spec/presenters/blacklight/field_presenter_spec.rb +2 -2
  130. data/spec/presenters/blacklight/index_presenter_spec.rb +1 -0
  131. data/spec/presenters/blacklight/show_presenter_spec.rb +1 -0
  132. data/spec/presenters/pipeline_spec.rb +13 -2
  133. data/spec/routing/catalog_routing_spec.rb +4 -0
  134. data/spec/spec_helper.rb +1 -1
  135. data/spec/support/view_component_test_helpers.rb +21 -0
  136. data/spec/test_app_templates/Gemfile.extra +4 -0
  137. data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -0
  138. data/spec/views/catalog/_document.html.erb_spec.rb +22 -1
  139. data/spec/views/catalog/_document_list.html.erb_spec.rb +7 -2
  140. data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -2
  141. data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -1
  142. data/tasks/blacklight.rake +1 -1
  143. metadata +39 -21
  144. data/app/components/blacklight/search_context_component.rb +0 -68
  145. data/app/models/concerns/blacklight/document/email.rb +0 -27
  146. data/app/models/concerns/blacklight/document/sms.rb +0 -25
  147. data/spec/features/sitelinks_search_box.rb +0 -13
  148. data/spec/models/blacklight/document/email_spec.rb +0 -57
  149. data/spec/models/blacklight/document/sms_spec.rb +0 -58
  150. data/spec/support/view_component_capybara_test_helpers.rb +0 -8
  151. /data/app/components/blacklight/{search_context_component.html.erb → search_context/server_item_pagination_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: 8.0.0.beta1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2023-01-23 00:00:00.000000000 Z
20
+ date: 2023-03-16 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -113,16 +113,22 @@ dependencies:
113
113
  name: view_component
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '2.66'
119
+ - - "<"
120
+ - !ruby/object:Gem::Version
121
+ version: '3.1'
119
122
  type: :runtime
120
123
  prerelease: false
121
124
  version_requirements: !ruby/object:Gem::Requirement
122
125
  requirements:
123
- - - "~>"
126
+ - - ">="
124
127
  - !ruby/object:Gem::Version
125
128
  version: '2.66'
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.1'
126
132
  - !ruby/object:Gem::Dependency
127
133
  name: rsolr
128
134
  requirement: !ruby/object:Gem::Requirement
@@ -369,6 +375,7 @@ files:
369
375
  - README.md
370
376
  - Rakefile
371
377
  - VERSION
378
+ - app/assets/config/blacklight/manifest.js
372
379
  - app/assets/images/blacklight/logo.png
373
380
  - app/assets/images/favicon.ico
374
381
  - app/assets/javascripts/blacklight/blacklight.esm.js
@@ -416,6 +423,8 @@ files:
416
423
  - app/components/blacklight/document/group_component.rb
417
424
  - app/components/blacklight/document/more_like_this_component.html.erb
418
425
  - app/components/blacklight/document/more_like_this_component.rb
426
+ - app/components/blacklight/document/show_tools_component.html.erb
427
+ - app/components/blacklight/document/show_tools_component.rb
419
428
  - app/components/blacklight/document/sidebar_component.html.erb
420
429
  - app/components/blacklight/document/sidebar_component.rb
421
430
  - app/components/blacklight/document/thumbnail_component.html.erb
@@ -453,6 +462,7 @@ files:
453
462
  - app/components/blacklight/metadata_field_component.rb
454
463
  - app/components/blacklight/metadata_field_layout_component.html.erb
455
464
  - app/components/blacklight/metadata_field_layout_component.rb
465
+ - app/components/blacklight/metadata_field_plain_text_layout_component.rb
456
466
  - app/components/blacklight/response/facet_group_component.html.erb
457
467
  - app/components/blacklight/response/facet_group_component.rb
458
468
  - app/components/blacklight/response/pagination_component.html.erb
@@ -470,8 +480,10 @@ files:
470
480
  - app/components/blacklight/search_bar_component.html.erb
471
481
  - app/components/blacklight/search_bar_component.rb
472
482
  - app/components/blacklight/search_button_component.rb
473
- - app/components/blacklight/search_context_component.html.erb
474
- - app/components/blacklight/search_context_component.rb
483
+ - app/components/blacklight/search_context/server_applied_params_component.html.erb
484
+ - app/components/blacklight/search_context/server_applied_params_component.rb
485
+ - app/components/blacklight/search_context/server_item_pagination_component.html.erb
486
+ - app/components/blacklight/search_context/server_item_pagination_component.rb
475
487
  - app/components/blacklight/search_header_component.html.erb
476
488
  - app/components/blacklight/search_header_component.rb
477
489
  - app/components/blacklight/search_history_constraint_layout_component.rb
@@ -500,6 +512,7 @@ files:
500
512
  - app/helpers/blacklight/catalog_helper_behavior.rb
501
513
  - app/helpers/blacklight/component_helper_behavior.rb
502
514
  - app/helpers/blacklight/configuration_helper_behavior.rb
515
+ - app/helpers/blacklight/document_helper_behavior.rb
503
516
  - app/helpers/blacklight/facets_helper_behavior.rb
504
517
  - app/helpers/blacklight/icon_helper_behavior.rb
505
518
  - app/helpers/blacklight/layout_helper_behavior.rb
@@ -525,12 +538,10 @@ files:
525
538
  - app/models/concerns/blacklight/document/attributes.rb
526
539
  - app/models/concerns/blacklight/document/cache_key.rb
527
540
  - app/models/concerns/blacklight/document/dublin_core.rb
528
- - app/models/concerns/blacklight/document/email.rb
529
541
  - app/models/concerns/blacklight/document/export.rb
530
542
  - app/models/concerns/blacklight/document/extensions.rb
531
543
  - app/models/concerns/blacklight/document/schema_org.rb
532
544
  - app/models/concerns/blacklight/document/semantic_fields.rb
533
- - app/models/concerns/blacklight/document/sms.rb
534
545
  - app/models/concerns/blacklight/suggest/response.rb
535
546
  - app/models/concerns/blacklight/user.rb
536
547
  - app/models/record_mailer.rb
@@ -681,6 +692,7 @@ files:
681
692
  - lib/blacklight/configuration/null_display_field.rb
682
693
  - lib/blacklight/configuration/null_field.rb
683
694
  - lib/blacklight/configuration/search_field.rb
695
+ - lib/blacklight/configuration/session_tracking_config.rb
684
696
  - lib/blacklight/configuration/show_field.rb
685
697
  - lib/blacklight/configuration/sort_field.rb
686
698
  - lib/blacklight/configuration/tool_config.rb
@@ -766,12 +778,14 @@ files:
766
778
  - spec/components/blacklight/facet_field_list_component_spec.rb
767
779
  - spec/components/blacklight/facet_item_component_spec.rb
768
780
  - spec/components/blacklight/facet_item_pivot_component_spec.rb
781
+ - spec/components/blacklight/header_component_spec.rb
769
782
  - spec/components/blacklight/hidden_search_state_component_spec.rb
770
783
  - spec/components/blacklight/metadata_field_component_spec.rb
771
784
  - spec/components/blacklight/response/spellcheck_component_spec.rb
772
785
  - spec/components/blacklight/response/view_type_component_spec.rb
773
786
  - spec/components/blacklight/search_bar_component_spec.rb
774
- - spec/components/blacklight/search_context_component_spec.rb
787
+ - spec/components/blacklight/search_context/server_applied_params_component_spec.rb
788
+ - spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
775
789
  - spec/components/blacklight/start_over_button_component_spec.rb
776
790
  - spec/components/blacklight/system/flash_message_component_spec.rb
777
791
  - spec/controllers/alternate_controller_spec.rb
@@ -786,9 +800,11 @@ files:
786
800
  - spec/features/autocomplete_spec.rb
787
801
  - spec/features/axe_spec.rb
788
802
  - spec/features/bookmarks_spec.rb
803
+ - spec/features/component_template_override_spec.rb
789
804
  - spec/features/did_you_mean_spec.rb
790
805
  - spec/features/facet_missing_spec.rb
791
806
  - spec/features/facets_spec.rb
807
+ - spec/features/modal_spec.rb
792
808
  - spec/features/record_view_spec.rb
793
809
  - spec/features/search_context_spec.rb
794
810
  - spec/features/search_crawler_spec.rb
@@ -799,7 +815,7 @@ files:
799
815
  - spec/features/search_results_spec.rb
800
816
  - spec/features/search_sort_spec.rb
801
817
  - spec/features/search_spec.rb
802
- - spec/features/sitelinks_search_box.rb
818
+ - spec/features/sitelinks_search_box_spec.rb
803
819
  - spec/fixtures/sample_solr_documents.yml
804
820
  - spec/helpers/blacklight/configuration_helper_behavior_spec.rb
805
821
  - spec/helpers/blacklight/facets_helper_behavior_spec.rb
@@ -814,6 +830,7 @@ files:
814
830
  - spec/lib/blacklight/component_spec.rb
815
831
  - spec/lib/blacklight/configuration/facet_field_spec.rb
816
832
  - spec/lib/blacklight/configuration/field_spec.rb
833
+ - spec/lib/blacklight/configuration/session_tracking_config_spec.rb
817
834
  - spec/lib/blacklight/configuration/view_config_spec.rb
818
835
  - spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb
819
836
  - spec/lib/blacklight/open_struct_with_hash_access_spec.rb
@@ -829,8 +846,6 @@ files:
829
846
  - spec/models/blacklight/document/active_model_shim_spec.rb
830
847
  - spec/models/blacklight/document/cache_key_spec.rb
831
848
  - spec/models/blacklight/document/dublin_core_spec.rb
832
- - spec/models/blacklight/document/email_spec.rb
833
- - spec/models/blacklight/document/sms_spec.rb
834
849
  - spec/models/blacklight/document_spec.rb
835
850
  - spec/models/blacklight/facet_paginator_spec.rb
836
851
  - spec/models/blacklight/icon_spec.rb
@@ -873,7 +888,7 @@ files:
873
888
  - spec/support/features/search_helpers.rb
874
889
  - spec/support/features/session_helpers.rb
875
890
  - spec/support/presenter_test_helpers.rb
876
- - spec/support/view_component_capybara_test_helpers.rb
891
+ - spec/support/view_component_test_helpers.rb
877
892
  - spec/test_app_templates/Gemfile.extra
878
893
  - spec/test_app_templates/lib/generators/test_app_generator.rb
879
894
  - spec/views/catalog/_document.html.erb_spec.rb
@@ -915,11 +930,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
915
930
  version: '2.7'
916
931
  required_rubygems_version: !ruby/object:Gem::Requirement
917
932
  requirements:
918
- - - ">"
933
+ - - ">="
919
934
  - !ruby/object:Gem::Version
920
- version: 1.3.1
935
+ version: '0'
921
936
  requirements: []
922
- rubygems_version: 3.3.26
937
+ rubygems_version: 3.1.6
923
938
  signing_key:
924
939
  specification_version: 4
925
940
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
@@ -937,12 +952,14 @@ test_files:
937
952
  - spec/components/blacklight/facet_field_list_component_spec.rb
938
953
  - spec/components/blacklight/facet_item_component_spec.rb
939
954
  - spec/components/blacklight/facet_item_pivot_component_spec.rb
955
+ - spec/components/blacklight/header_component_spec.rb
940
956
  - spec/components/blacklight/hidden_search_state_component_spec.rb
941
957
  - spec/components/blacklight/metadata_field_component_spec.rb
942
958
  - spec/components/blacklight/response/spellcheck_component_spec.rb
943
959
  - spec/components/blacklight/response/view_type_component_spec.rb
944
960
  - spec/components/blacklight/search_bar_component_spec.rb
945
- - spec/components/blacklight/search_context_component_spec.rb
961
+ - spec/components/blacklight/search_context/server_applied_params_component_spec.rb
962
+ - spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
946
963
  - spec/components/blacklight/start_over_button_component_spec.rb
947
964
  - spec/components/blacklight/system/flash_message_component_spec.rb
948
965
  - spec/controllers/alternate_controller_spec.rb
@@ -957,9 +974,11 @@ test_files:
957
974
  - spec/features/autocomplete_spec.rb
958
975
  - spec/features/axe_spec.rb
959
976
  - spec/features/bookmarks_spec.rb
977
+ - spec/features/component_template_override_spec.rb
960
978
  - spec/features/did_you_mean_spec.rb
961
979
  - spec/features/facet_missing_spec.rb
962
980
  - spec/features/facets_spec.rb
981
+ - spec/features/modal_spec.rb
963
982
  - spec/features/record_view_spec.rb
964
983
  - spec/features/search_context_spec.rb
965
984
  - spec/features/search_crawler_spec.rb
@@ -970,7 +989,7 @@ test_files:
970
989
  - spec/features/search_results_spec.rb
971
990
  - spec/features/search_sort_spec.rb
972
991
  - spec/features/search_spec.rb
973
- - spec/features/sitelinks_search_box.rb
992
+ - spec/features/sitelinks_search_box_spec.rb
974
993
  - spec/fixtures/sample_solr_documents.yml
975
994
  - spec/helpers/blacklight/configuration_helper_behavior_spec.rb
976
995
  - spec/helpers/blacklight/facets_helper_behavior_spec.rb
@@ -985,6 +1004,7 @@ test_files:
985
1004
  - spec/lib/blacklight/component_spec.rb
986
1005
  - spec/lib/blacklight/configuration/facet_field_spec.rb
987
1006
  - spec/lib/blacklight/configuration/field_spec.rb
1007
+ - spec/lib/blacklight/configuration/session_tracking_config_spec.rb
988
1008
  - spec/lib/blacklight/configuration/view_config_spec.rb
989
1009
  - spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb
990
1010
  - spec/lib/blacklight/open_struct_with_hash_access_spec.rb
@@ -1000,8 +1020,6 @@ test_files:
1000
1020
  - spec/models/blacklight/document/active_model_shim_spec.rb
1001
1021
  - spec/models/blacklight/document/cache_key_spec.rb
1002
1022
  - spec/models/blacklight/document/dublin_core_spec.rb
1003
- - spec/models/blacklight/document/email_spec.rb
1004
- - spec/models/blacklight/document/sms_spec.rb
1005
1023
  - spec/models/blacklight/document_spec.rb
1006
1024
  - spec/models/blacklight/facet_paginator_spec.rb
1007
1025
  - spec/models/blacklight/icon_spec.rb
@@ -1044,7 +1062,7 @@ test_files:
1044
1062
  - spec/support/features/search_helpers.rb
1045
1063
  - spec/support/features/session_helpers.rb
1046
1064
  - spec/support/presenter_test_helpers.rb
1047
- - spec/support/view_component_capybara_test_helpers.rb
1065
+ - spec/support/view_component_test_helpers.rb
1048
1066
  - spec/test_app_templates/Gemfile.extra
1049
1067
  - spec/test_app_templates/lib/generators/test_app_generator.rb
1050
1068
  - spec/views/catalog/_document.html.erb_spec.rb
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Blacklight
4
- class SearchContextComponent < Blacklight::Component
5
- with_collection_parameter :search_context
6
-
7
- def initialize(search_context:, search_session:)
8
- @search_context = search_context
9
- @search_session = search_session
10
- end
11
-
12
- def render?
13
- @search_context.present? && (@search_context[:prev] || @search_context[:next])
14
- end
15
-
16
- ##
17
- # Displays "showing X of Y items" message.
18
- #
19
- # @return [String]
20
- def item_page_entry_info
21
- t('blacklight.search.entry_pagination_info.other', current: number_with_delimiter(count),
22
- total: number_with_delimiter(total),
23
- count: total).html_safe
24
- end
25
-
26
- def link_to_previous_document(previous_document = nil, classes: 'previous', **link_opts)
27
- previous_document ||= @search_context[:prev]
28
- link_opts = session_tracking_params(previous_document, count - 1, per_page: per_page, search_id: search_id).merge(class: classes, rel: 'prev').merge(link_opts)
29
- link_to_unless previous_document.nil?, raw(t('views.pagination.previous')), url_for_document(previous_document), link_opts do
30
- tag.span raw(t('views.pagination.previous')), class: 'previous'
31
- end
32
- end
33
-
34
- def link_to_next_document(next_document = nil, classes: 'next', **link_opts)
35
- next_document ||= @search_context[:next]
36
- link_opts = session_tracking_params(next_document, count + 1, per_page: per_page, search_id: search_id).merge(class: classes, rel: 'next').merge(link_opts)
37
- link_to_unless next_document.nil?, raw(t('views.pagination.next')), url_for_document(next_document), link_opts do
38
- tag.span raw(t('views.pagination.next')), class: 'next'
39
- end
40
- end
41
-
42
- private
43
-
44
- def count
45
- @search_session['counter'].to_i
46
- end
47
-
48
- def per_page
49
- @search_session['per_page']
50
- end
51
-
52
- def total
53
- @search_session['total'].to_i
54
- end
55
-
56
- def search_id
57
- controller.current_search_session&.id
58
- end
59
-
60
- def session_tracking_params(...)
61
- helpers.session_tracking_params(...)
62
- end
63
-
64
- def url_for_document(...)
65
- helpers.search_state.url_for_document(...)
66
- end
67
- end
68
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides the body of an email export based on the document's semantic values
4
- module Blacklight::Document::Email
5
- # Return a text string that will be the body of the email
6
- def to_email_text(config = nil)
7
- body = []
8
-
9
- if config
10
- body = config.email_fields.map do |name, field|
11
- values = [self[name]].flatten
12
- "#{field.label} #{values.join(' ')}" if self[name].present?
13
- end
14
- end
15
-
16
- # Use to_semantic_values for backwards compatibility
17
- if body.empty?
18
- semantics = to_semantic_values
19
- body << I18n.t('blacklight.email.text.title', value: semantics[:title].join(" ")) if semantics[:title].present?
20
- body << I18n.t('blacklight.email.text.author', value: semantics[:author].join(" ")) if semantics[:author].present?
21
- body << I18n.t('blacklight.email.text.format', value: semantics[:format].join(" ")) if semantics[:format].present?
22
- body << I18n.t('blacklight.email.text.language', value: semantics[:language].join(" ")) if semantics[:language].present?
23
- end
24
-
25
- return body.join("\n") unless body.empty?
26
- end
27
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides the body of an email export based on the document's semantic values
4
- module Blacklight::Document::Sms
5
- # Return a text string that will be the body of the email
6
- def to_sms_text(config = nil)
7
- body = []
8
-
9
- if config
10
- body = config.sms_fields.map do |name, field|
11
- values = [self[name]].flatten
12
- "#{field.label} #{values.first}" if self[name].present?
13
- end
14
- end
15
-
16
- # Use to_semantic_values for backwards compatibility
17
- if body.empty?
18
- semantics = to_semantic_values
19
- body << I18n.t('blacklight.sms.text.title', value: semantics[:title].first) if semantics[:title].present?
20
- body << I18n.t('blacklight.sms.text.author', value: semantics[:author].first) if semantics[:author].present?
21
- end
22
-
23
- return body.join unless body.empty?
24
- end
25
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'Sitelinks search box' do
4
- it 'is home page' do
5
- visit root_path
6
- expect(page).to have_css 'script[type="application/ld+json"]'
7
- end
8
-
9
- it 'on search page' do
10
- visit search_catalog_path q: 'book'
11
- expect(page).not_to have_css 'script[type="application/ld+json"]'
12
- end
13
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe "Blacklight::Document::Email" do
4
- let(:config) do
5
- Blacklight::Configuration.new
6
- end
7
-
8
- before(:all) do
9
- SolrDocument.use_extension(Blacklight::Document::Email)
10
- end
11
-
12
- it "onlies return values that are available in the field semantics" do
13
- doc = SolrDocument.new(id: "1234", title_tsim: "My Title")
14
- email_body = doc.to_email_text
15
- expect(email_body).to match(/Title: My Title/)
16
- expect(email_body).not_to match(/Author/)
17
- end
18
-
19
- it "handles multi-values fields correctly" do
20
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
21
- email_body = doc.to_email_text
22
- expect(email_body).to match(/Title: My Title My Alt. Title/)
23
- end
24
-
25
- it "returns nil if there are no valid field semantics to build the email body from" do
26
- doc = SolrDocument.new(id: "1234")
27
- expect(doc.to_email_text).to be_nil
28
- end
29
-
30
- context "we pass in configuration with email fields set" do
31
- it "uses the email fields for to_email_text" do
32
- config.add_email_field("foo", label: "Foo:")
33
- config.add_email_field("bar", label: "Bar:")
34
- doc = SolrDocument.new(id: "1234", foo: ["Fuzz Fuzz", "Fizz Fizz"], bar: ["Buzz Buzz", "Bizz Bizz"])
35
-
36
- expect(doc.to_email_text(config)).to eq("Foo: Fuzz Fuzz Fizz Fizz\nBar: Buzz Buzz Bizz Bizz")
37
- end
38
- end
39
-
40
- context "we pass in configuration with email fields no set" do
41
- it "falls back on default semantics setup" do
42
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
43
- email_body = doc.to_email_text(config)
44
- expect(email_body).to match(/Title: My Title/)
45
- end
46
- end
47
-
48
- context "document field is single valued" do
49
- it "handles the single value field correctly" do
50
- config.add_email_field("foo", label: "Foo:")
51
- config.add_email_field("bar", label: "Bar:")
52
- doc = SolrDocument.new(id: "1234", foo: "Fuzz Fuzz", bar: ["Buzz Buzz", "Bizz Bizz"])
53
-
54
- expect(doc.to_email_text(config)).to eq("Foo: Fuzz Fuzz\nBar: Buzz Buzz Bizz Bizz")
55
- end
56
- end
57
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe "Blacklight::Document::Email" do
4
- let(:config) do
5
- Blacklight::Configuration.new
6
- end
7
-
8
- before(:all) do
9
- SolrDocument.use_extension(Blacklight::Document::Sms)
10
- end
11
-
12
- it "onlies return values that are available in the field semantics" do
13
- doc = SolrDocument.new(id: "1234", title_tsim: "My Title", author_tsim: "Joe Schmoe")
14
- sms_text = doc.to_sms_text
15
- expect(sms_text).to match(/My Title by Joe Schmoe/)
16
- end
17
-
18
- it "handles multi-values fields correctly and only take the first" do
19
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
20
- sms_text = doc.to_sms_text
21
- expect(sms_text).to match(/My Title/)
22
- expect(sms_text).not_to match(/My Alt\. Title/)
23
- end
24
-
25
- it "returns nil if there are no valid field semantics to build the email body from" do
26
- doc = SolrDocument.new(id: "1234")
27
- expect(doc.to_sms_text).to be_nil
28
- end
29
-
30
- context "we pass in configuration with sms fields set" do
31
- it "uses the sms fields for to_sms_text" do
32
- config.add_sms_field("foo", label: "Foo:")
33
- config.add_sms_field("bar", label: " by")
34
- doc = SolrDocument.new(id: "1234", foo: ["Fuzz Fuzz", "Fizz Fizz"], bar: ["Buzz Buzz", "Bizz Bizz"])
35
-
36
- expect(doc.to_sms_text(config)).to eq("Foo: Fuzz Fuzz by Buzz Buzz")
37
- end
38
- end
39
-
40
- context "we pass in configuration with sms fields no set" do
41
- it "falls back on default semantics setup" do
42
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
43
- sms_text = doc.to_sms_text(config)
44
- expect(sms_text).to match(/My Title/)
45
- expect(sms_text).not_to match(/My Alt\. Title/)
46
- end
47
- end
48
-
49
- context "document field is single valued" do
50
- it "handles the single value field correctly" do
51
- config.add_sms_field("foo", label: "Foo:")
52
- config.add_sms_field("bar", label: " by")
53
- doc = SolrDocument.new(id: "1234", foo: "Fuzz Fuzz", bar: ["Buzz Buzz", "Bizz Bizz"])
54
-
55
- expect(doc.to_sms_text(config)).to eq("Foo: Fuzz Fuzz by Buzz Buzz")
56
- end
57
- end
58
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ViewComponentCapybaraTestHelpers
4
- # Work around for https://github.com/teamcapybara/capybara/issues/2466
5
- def render_inline_to_capybara_node(component)
6
- Capybara::Node::Simple.new(render_inline(component).to_s)
7
- end
8
- end