blacklight 7.14.1 → 7.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/VERSION +1 -1
  4. data/app/assets/stylesheets/blacklight/_icons.scss +5 -1
  5. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +5 -0
  6. data/app/components/blacklight/advanced_search_form_component.html.erb +52 -0
  7. data/app/components/blacklight/advanced_search_form_component.rb +88 -0
  8. data/app/components/blacklight/constraint_component.html.erb +1 -1
  9. data/app/components/blacklight/constraint_layout_component.html.erb +1 -1
  10. data/app/components/blacklight/constraints_component.html.erb +19 -3
  11. data/app/components/blacklight/constraints_component.rb +41 -18
  12. data/app/components/blacklight/content_areas_shim.rb +12 -0
  13. data/app/components/blacklight/document/action_component.html.erb +1 -1
  14. data/app/components/blacklight/document/action_component.rb +6 -1
  15. data/app/components/blacklight/document/actions_component.html.erb +3 -5
  16. data/app/components/blacklight/document/actions_component.rb +16 -2
  17. data/app/components/blacklight/document/thumbnail_component.html.erb +1 -1
  18. data/app/components/blacklight/document/thumbnail_component.rb +4 -1
  19. data/app/components/blacklight/document_component.html.erb +4 -7
  20. data/app/components/blacklight/document_component.rb +73 -68
  21. data/app/components/blacklight/document_metadata_component.html.erb +2 -2
  22. data/app/components/blacklight/document_metadata_component.rb +13 -2
  23. data/app/components/blacklight/document_title_component.html.erb +17 -0
  24. data/app/components/blacklight/document_title_component.rb +59 -0
  25. data/app/components/blacklight/facet_field_checkboxes_component.html.erb +23 -0
  26. data/app/components/blacklight/facet_field_checkboxes_component.rb +24 -0
  27. data/app/components/blacklight/facet_field_component.rb +4 -1
  28. data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +6 -0
  29. data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +29 -0
  30. data/app/components/blacklight/facet_field_list_component.html.erb +3 -2
  31. data/app/components/blacklight/facet_field_no_layout_component.rb +4 -1
  32. data/app/components/blacklight/facet_field_pagination_component.rb +1 -1
  33. data/app/components/blacklight/facet_item_component.rb +4 -2
  34. data/app/components/blacklight/metadata_field_component.html.erb +2 -2
  35. data/app/components/blacklight/metadata_field_layout_component.html.erb +3 -1
  36. data/app/components/blacklight/metadata_field_layout_component.rb +26 -1
  37. data/app/components/blacklight/response/view_type_button_component.html.erb +4 -0
  38. data/app/components/blacklight/response/view_type_button_component.rb +36 -0
  39. data/app/components/blacklight/response/view_type_component.html.erb +2 -5
  40. data/app/components/blacklight/response/view_type_component.rb +9 -13
  41. data/app/components/blacklight/search_bar_component.html.erb +4 -0
  42. data/app/components/blacklight/search_bar_component.rb +13 -4
  43. data/app/components/blacklight/system/dropdown_component.html.erb +4 -7
  44. data/app/components/blacklight/system/dropdown_component.rb +24 -0
  45. data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
  46. data/app/components/blacklight/system/flash_message_component.rb +7 -1
  47. data/app/components/blacklight/system/modal_component.rb +7 -1
  48. data/app/controllers/concerns/blacklight/catalog.rb +7 -1
  49. data/app/helpers/blacklight/blacklight_helper_behavior.rb +3 -4
  50. data/app/helpers/blacklight/component_helper_behavior.rb +2 -2
  51. data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -2
  52. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
  53. data/app/presenters/blacklight/clause_presenter.rb +37 -0
  54. data/app/presenters/blacklight/document_presenter.rb +13 -5
  55. data/app/presenters/blacklight/facet_field_presenter.rb +4 -0
  56. data/app/presenters/blacklight/facet_grouped_item_presenter.rb +45 -0
  57. data/app/presenters/blacklight/facet_item_presenter.rb +32 -20
  58. data/app/presenters/blacklight/inclusive_facet_item_presenter.rb +16 -0
  59. data/app/presenters/blacklight/rendering/helper_method.rb +4 -4
  60. data/app/presenters/blacklight/search_bar_presenter.rb +4 -0
  61. data/app/services/blacklight/search_service.rb +1 -1
  62. data/app/views/bookmarks/_tools.html.erb +1 -1
  63. data/app/views/catalog/_advanced_search_form.html.erb +7 -0
  64. data/app/views/catalog/_advanced_search_help.html.erb +24 -0
  65. data/app/views/catalog/_citation.html.erb +1 -1
  66. data/app/views/catalog/_document.html.erb +2 -2
  67. data/app/views/catalog/_facet_layout.html.erb +2 -2
  68. data/app/views/catalog/_search_form.html.erb +1 -0
  69. data/app/views/catalog/_show_main_content.html.erb +3 -3
  70. data/app/views/catalog/advanced_search.html.erb +17 -0
  71. data/app/views/catalog/email.html.erb +2 -2
  72. data/app/views/catalog/email_success.html.erb +1 -1
  73. data/app/views/catalog/facet.html.erb +3 -3
  74. data/app/views/catalog/sms.html.erb +2 -2
  75. data/app/views/catalog/sms_success.html.erb +1 -1
  76. data/blacklight.gemspec +2 -2
  77. data/config/i18n-tasks.yml +1 -0
  78. data/config/locales/blacklight.de.yml +2 -2
  79. data/config/locales/blacklight.en.yml +17 -0
  80. data/lib/blacklight/configuration.rb +52 -6
  81. data/lib/blacklight/configuration/view_config.rb +16 -5
  82. data/lib/blacklight/engine.rb +3 -1
  83. data/lib/blacklight/open_struct_with_hash_access.rb +22 -1
  84. data/lib/blacklight/routes/searchable.rb +1 -0
  85. data/lib/blacklight/search_builder.rb +2 -0
  86. data/lib/blacklight/search_state.rb +7 -3
  87. data/lib/blacklight/search_state/filter_field.rb +17 -7
  88. data/lib/blacklight/solr/facet_paginator.rb +2 -0
  89. data/lib/blacklight/solr/repository.rb +11 -2
  90. data/lib/blacklight/solr/request.rb +31 -0
  91. data/lib/blacklight/solr/response.rb +2 -16
  92. data/lib/blacklight/solr/response/facets.rb +76 -22
  93. data/lib/blacklight/solr/response/params.rb +104 -0
  94. data/lib/blacklight/solr/search_builder_behavior.rb +126 -32
  95. data/lib/generators/blacklight/assets_generator.rb +6 -2
  96. data/lib/generators/blacklight/user_generator.rb +1 -1
  97. data/spec/components/blacklight/advanced_search_form_component_spec.rb +51 -0
  98. data/spec/components/blacklight/document_component_spec.rb +18 -3
  99. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +55 -0
  100. data/spec/components/blacklight/facet_field_list_component_spec.rb +39 -4
  101. data/spec/controllers/catalog_controller_spec.rb +9 -0
  102. data/spec/features/advanced_search_spec.rb +67 -0
  103. data/spec/lib/blacklight/configuration/view_config_spec.rb +1 -1
  104. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +20 -0
  105. data/spec/lib/blacklight/search_state/filter_field_spec.rb +65 -0
  106. data/spec/models/blacklight/configuration_spec.rb +64 -0
  107. data/spec/models/blacklight/solr/facet_paginator_spec.rb +4 -0
  108. data/spec/models/blacklight/solr/repository_spec.rb +12 -0
  109. data/spec/models/blacklight/solr/request_spec.rb +62 -29
  110. data/spec/models/blacklight/solr/response/facets_spec.rb +109 -0
  111. data/spec/models/blacklight/solr/response_spec.rb +10 -0
  112. data/spec/models/blacklight/solr/search_builder_spec.rb +77 -0
  113. data/spec/presenters/blacklight/clause_presenter_spec.rb +34 -0
  114. data/spec/presenters/blacklight/document_presenter_spec.rb +13 -0
  115. data/spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb +41 -0
  116. data/spec/views/catalog/index.atom.builder_spec.rb +1 -1
  117. metadata +37 -9
@@ -47,4 +47,17 @@ RSpec.describe Blacklight::DocumentPresenter do
47
47
  expect(presenter.field_value(field_config, options)).to eq 'abc'
48
48
  end
49
49
  end
50
+
51
+ describe '#thumbnail' do
52
+ it 'returns a thumbnail presenter' do
53
+ expect(presenter.thumbnail).to be_a_kind_of(Blacklight::ThumbnailPresenter)
54
+ end
55
+
56
+ it 'use the configured thumbnail presenter' do
57
+ custom_presenter_class = Class.new(Blacklight::ThumbnailPresenter)
58
+ blacklight_config.index.thumbnail_presenter = custom_presenter_class
59
+
60
+ expect(presenter.thumbnail).to be_a_kind_of custom_presenter_class
61
+ end
62
+ end
50
63
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Blacklight::FacetGroupedItemPresenter, type: :presenter do
5
+ subject(:presenter) do
6
+ described_class.new(group, facet_item, facet_config, view_context, facet_field, search_state)
7
+ end
8
+
9
+ let(:facet_config) { Blacklight::Configuration::FacetField.new(key: 'key') }
10
+ let(:facet_field) { instance_double(Blacklight::Solr::Response::Facets::FacetField) }
11
+ let(:view_context) { controller.view_context }
12
+
13
+ let(:facet_item) { 'a' }
14
+ let(:group) { %w[a b c] }
15
+ let(:search_state) { Blacklight::SearchState.new(params, Blacklight::Configuration.new) }
16
+ let(:params) { { f_inclusive: { key: group } } }
17
+
18
+ describe '#selected' do
19
+ it { is_expected.to be_selected }
20
+
21
+ context 'when the item is not in the group' do
22
+ let(:facet_item) { 'd' }
23
+
24
+ it { is_expected.not_to be_selected }
25
+ end
26
+
27
+ describe '#href' do
28
+ it 'removes the item from the "group" of filters' do
29
+ expect(Rack::Utils.parse_query(URI(presenter.href).query)).to include 'f_inclusive[key][]' => %w[b c]
30
+ end
31
+
32
+ context 'when the item is not in the group' do
33
+ let(:facet_item) { 'd' }
34
+
35
+ it 'adds the item to the "group" of filters' do
36
+ expect(Rack::Utils.parse_query(URI(presenter.href).query)).to include 'f_inclusive[key][]' => %w[a b c d]
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -12,7 +12,7 @@ RSpec.describe "catalog/index" do
12
12
  end
13
13
  end
14
14
 
15
- let(:blacklight_config) { CatalogController.blacklight_config }
15
+ let(:blacklight_config) { CatalogController.blacklight_config.deep_copy }
16
16
 
17
17
  before do
18
18
  @response = Blacklight::Solr::Response.new({ response: { numFound: 30 } }, start: 10, rows: 10)
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: 7.14.1
4
+ version: 7.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -14,10 +14,10 @@ authors:
14
14
  - Dan Funk
15
15
  - Naomi Dushay
16
16
  - Justin Coyne
17
- autorequire:
17
+ autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2021-01-14 00:00:00.000000000 Z
20
+ date: 2021-04-21 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 2.23.0
132
+ version: 2.28.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 2.23.0
139
+ version: 2.28.0
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: rsolr
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -394,12 +394,15 @@ files:
394
394
  - app/assets/stylesheets/blacklight/blacklight.scss
395
395
  - app/assets/stylesheets/blacklight/blacklight_defaults.scss
396
396
  - app/builders/blacklight/action_builder.rb
397
+ - app/components/blacklight/advanced_search_form_component.html.erb
398
+ - app/components/blacklight/advanced_search_form_component.rb
397
399
  - app/components/blacklight/constraint_component.html.erb
398
400
  - app/components/blacklight/constraint_component.rb
399
401
  - app/components/blacklight/constraint_layout_component.html.erb
400
402
  - app/components/blacklight/constraint_layout_component.rb
401
403
  - app/components/blacklight/constraints_component.html.erb
402
404
  - app/components/blacklight/constraints_component.rb
405
+ - app/components/blacklight/content_areas_shim.rb
403
406
  - app/components/blacklight/document/action_component.html.erb
404
407
  - app/components/blacklight/document/action_component.rb
405
408
  - app/components/blacklight/document/actions_component.html.erb
@@ -418,10 +421,16 @@ files:
418
421
  - app/components/blacklight/document_component.rb
419
422
  - app/components/blacklight/document_metadata_component.html.erb
420
423
  - app/components/blacklight/document_metadata_component.rb
424
+ - app/components/blacklight/document_title_component.html.erb
425
+ - app/components/blacklight/document_title_component.rb
426
+ - app/components/blacklight/facet_field_checkboxes_component.html.erb
427
+ - app/components/blacklight/facet_field_checkboxes_component.rb
421
428
  - app/components/blacklight/facet_field_component.html.erb
422
429
  - app/components/blacklight/facet_field_component.rb
423
430
  - app/components/blacklight/facet_field_filter_component.html.erb
424
431
  - app/components/blacklight/facet_field_filter_component.rb
432
+ - app/components/blacklight/facet_field_inclusive_constraint_component.html.erb
433
+ - app/components/blacklight/facet_field_inclusive_constraint_component.rb
425
434
  - app/components/blacklight/facet_field_list_component.html.erb
426
435
  - app/components/blacklight/facet_field_list_component.rb
427
436
  - app/components/blacklight/facet_field_no_layout_component.rb
@@ -442,6 +451,8 @@ files:
442
451
  - app/components/blacklight/response/sort_component.rb
443
452
  - app/components/blacklight/response/spellcheck_component.html.erb
444
453
  - app/components/blacklight/response/spellcheck_component.rb
454
+ - app/components/blacklight/response/view_type_button_component.html.erb
455
+ - app/components/blacklight/response/view_type_button_component.rb
445
456
  - app/components/blacklight/response/view_type_component.html.erb
446
457
  - app/components/blacklight/response/view_type_component.rb
447
458
  - app/components/blacklight/search_bar_component.html.erb
@@ -511,10 +522,13 @@ files:
511
522
  - app/models/record_mailer.rb
512
523
  - app/models/search.rb
513
524
  - app/models/solr_document.rb
525
+ - app/presenters/blacklight/clause_presenter.rb
514
526
  - app/presenters/blacklight/document_presenter.rb
515
527
  - app/presenters/blacklight/facet_field_presenter.rb
528
+ - app/presenters/blacklight/facet_grouped_item_presenter.rb
516
529
  - app/presenters/blacklight/facet_item_presenter.rb
517
530
  - app/presenters/blacklight/field_presenter.rb
531
+ - app/presenters/blacklight/inclusive_facet_item_presenter.rb
518
532
  - app/presenters/blacklight/index_presenter.rb
519
533
  - app/presenters/blacklight/json_presenter.rb
520
534
  - app/presenters/blacklight/link_alternate_presenter.rb
@@ -537,6 +551,8 @@ files:
537
551
  - app/views/bookmarks/_clear_bookmarks_widget.html.erb
538
552
  - app/views/bookmarks/_tools.html.erb
539
553
  - app/views/bookmarks/index.html.erb
554
+ - app/views/catalog/_advanced_search_form.html.erb
555
+ - app/views/catalog/_advanced_search_help.html.erb
540
556
  - app/views/catalog/_bookmark_control.html.erb
541
557
  - app/views/catalog/_citation.html.erb
542
558
  - app/views/catalog/_constraints.html.erb
@@ -583,6 +599,7 @@ files:
583
599
  - app/views/catalog/_thumbnail.html.erb
584
600
  - app/views/catalog/_view_type_group.html.erb
585
601
  - app/views/catalog/_zero_results.html.erb
602
+ - app/views/catalog/advanced_search.html.erb
586
603
  - app/views/catalog/citation.html.erb
587
604
  - app/views/catalog/citation.js.erb
588
605
  - app/views/catalog/email.html.erb
@@ -679,6 +696,7 @@ files:
679
696
  - lib/blacklight/solr/response/group_response.rb
680
697
  - lib/blacklight/solr/response/more_like_this.rb
681
698
  - lib/blacklight/solr/response/pagination_methods.rb
699
+ - lib/blacklight/solr/response/params.rb
682
700
  - lib/blacklight/solr/response/response.rb
683
701
  - lib/blacklight/solr/response/spelling.rb
684
702
  - lib/blacklight/solr/search_builder_behavior.rb
@@ -719,11 +737,13 @@ files:
719
737
  - lib/generators/blacklight/user_generator.rb
720
738
  - lib/railties/blacklight.rake
721
739
  - package.json
740
+ - spec/components/blacklight/advanced_search_form_component_spec.rb
722
741
  - spec/components/blacklight/constraint_layout_component_spec.rb
723
742
  - spec/components/blacklight/document/action_component_spec.rb
724
743
  - spec/components/blacklight/document/group_component_spec.rb
725
744
  - spec/components/blacklight/document_component_spec.rb
726
745
  - spec/components/blacklight/document_metadata_component_spec.rb
746
+ - spec/components/blacklight/facet_field_checkboxes_component_spec.rb
727
747
  - spec/components/blacklight/facet_field_list_component_spec.rb
728
748
  - spec/components/blacklight/facet_item_component_spec.rb
729
749
  - spec/components/blacklight/facet_item_pivot_component_spec.rb
@@ -739,6 +759,7 @@ files:
739
759
  - spec/controllers/bookmarks_controller_spec.rb
740
760
  - spec/controllers/catalog_controller_spec.rb
741
761
  - spec/controllers/search_history_controller_spec.rb
762
+ - spec/features/advanced_search_spec.rb
742
763
  - spec/features/alternate_controller_spec.rb
743
764
  - spec/features/autocomplete_spec.rb
744
765
  - spec/features/bookmarks_spec.rb
@@ -808,8 +829,10 @@ files:
808
829
  - spec/models/record_mailer_spec.rb
809
830
  - spec/models/search_spec.rb
810
831
  - spec/models/solr_document_spec.rb
832
+ - spec/presenters/blacklight/clause_presenter_spec.rb
811
833
  - spec/presenters/blacklight/document_presenter_spec.rb
812
834
  - spec/presenters/blacklight/facet_field_presenter_spec.rb
835
+ - spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb
813
836
  - spec/presenters/blacklight/facet_item_presenter_spec.rb
814
837
  - spec/presenters/blacklight/field_presenter_spec.rb
815
838
  - spec/presenters/blacklight/index_presenter_spec.rb
@@ -864,7 +887,7 @@ homepage: http://projectblacklight.org/
864
887
  licenses:
865
888
  - Apache 2.0
866
889
  metadata: {}
867
- post_install_message:
890
+ post_install_message:
868
891
  rdoc_options: []
869
892
  require_paths:
870
893
  - lib
@@ -872,24 +895,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
872
895
  requirements:
873
896
  - - ">="
874
897
  - !ruby/object:Gem::Version
875
- version: '2.3'
898
+ version: '2.5'
876
899
  required_rubygems_version: !ruby/object:Gem::Requirement
877
900
  requirements:
878
901
  - - ">="
879
902
  - !ruby/object:Gem::Version
880
903
  version: '0'
881
904
  requirements: []
882
- rubygems_version: 3.1.2
883
- signing_key:
905
+ rubygems_version: 3.2.3
906
+ signing_key:
884
907
  specification_version: 4
885
908
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
886
909
  index.
887
910
  test_files:
911
+ - spec/components/blacklight/advanced_search_form_component_spec.rb
888
912
  - spec/components/blacklight/constraint_layout_component_spec.rb
889
913
  - spec/components/blacklight/document/action_component_spec.rb
890
914
  - spec/components/blacklight/document/group_component_spec.rb
891
915
  - spec/components/blacklight/document_component_spec.rb
892
916
  - spec/components/blacklight/document_metadata_component_spec.rb
917
+ - spec/components/blacklight/facet_field_checkboxes_component_spec.rb
893
918
  - spec/components/blacklight/facet_field_list_component_spec.rb
894
919
  - spec/components/blacklight/facet_item_component_spec.rb
895
920
  - spec/components/blacklight/facet_item_pivot_component_spec.rb
@@ -905,6 +930,7 @@ test_files:
905
930
  - spec/controllers/bookmarks_controller_spec.rb
906
931
  - spec/controllers/catalog_controller_spec.rb
907
932
  - spec/controllers/search_history_controller_spec.rb
933
+ - spec/features/advanced_search_spec.rb
908
934
  - spec/features/alternate_controller_spec.rb
909
935
  - spec/features/autocomplete_spec.rb
910
936
  - spec/features/bookmarks_spec.rb
@@ -974,8 +1000,10 @@ test_files:
974
1000
  - spec/models/record_mailer_spec.rb
975
1001
  - spec/models/search_spec.rb
976
1002
  - spec/models/solr_document_spec.rb
1003
+ - spec/presenters/blacklight/clause_presenter_spec.rb
977
1004
  - spec/presenters/blacklight/document_presenter_spec.rb
978
1005
  - spec/presenters/blacklight/facet_field_presenter_spec.rb
1006
+ - spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb
979
1007
  - spec/presenters/blacklight/facet_item_presenter_spec.rb
980
1008
  - spec/presenters/blacklight/field_presenter_spec.rb
981
1009
  - spec/presenters/blacklight/index_presenter_spec.rb