blacklight 6.2.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.solr_wrapper +5 -0
  4. data/.travis.yml +3 -5
  5. data/Gemfile +3 -3
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/blacklight/core.js +19 -5
  8. data/app/helpers/blacklight/blacklight_helper_behavior.rb +48 -20
  9. data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -1
  10. data/app/helpers/blacklight/url_helper_behavior.rb +2 -1
  11. data/app/presenters/blacklight/document_presenter.rb +58 -150
  12. data/app/presenters/blacklight/field_presenter.rb +31 -0
  13. data/app/presenters/blacklight/index_presenter.rb +69 -0
  14. data/app/presenters/blacklight/link_alternate_presenter.rb +29 -0
  15. data/app/presenters/blacklight/rendering/abstract_step.rb +24 -0
  16. data/app/presenters/blacklight/rendering/helper_method.rb +23 -0
  17. data/app/presenters/blacklight/rendering/join.rb +16 -0
  18. data/app/presenters/blacklight/rendering/link_to_facet.rb +35 -0
  19. data/app/presenters/blacklight/rendering/microdata.rb +17 -0
  20. data/app/presenters/blacklight/rendering/pipeline.rb +32 -0
  21. data/app/presenters/blacklight/rendering/terminator.rb +9 -0
  22. data/app/presenters/blacklight/show_presenter.rb +93 -0
  23. data/app/services/blacklight/field_retriever.rb +58 -0
  24. data/app/views/catalog/_document_default.atom.builder +2 -3
  25. data/app/views/catalog/_document_default.rss.builder +2 -2
  26. data/app/views/kaminari/blacklight/_next_page.html.erb +9 -3
  27. data/app/views/kaminari/blacklight/_prev_page.html.erb +10 -3
  28. data/lib/blacklight/configuration.rb +15 -3
  29. data/lib/blacklight/configuration/null_field.rb +13 -0
  30. data/lib/blacklight/configuration/view_config.rb +6 -0
  31. data/lib/generators/blacklight/templates/catalog_controller.rb +1 -1
  32. data/lib/generators/blacklight/templates/config/blacklight.yml +1 -1
  33. data/lib/generators/blacklight/templates/config/jetty.yml +1 -1
  34. data/spec/controllers/alternate_controller_spec.rb +2 -2
  35. data/spec/controllers/application_controller_spec.rb +1 -1
  36. data/spec/controllers/blacklight/facet_spec.rb +3 -3
  37. data/spec/controllers/blacklight/search_fields_spec.rb +7 -7
  38. data/spec/controllers/blacklight/search_helper_spec.rb +44 -44
  39. data/spec/controllers/blacklight/suggest_search_spec.rb +1 -1
  40. data/spec/controllers/bookmarks_controller_spec.rb +6 -6
  41. data/spec/controllers/catalog_controller_spec.rb +125 -125
  42. data/spec/controllers/saved_searches_controller_spec.rb +4 -9
  43. data/spec/controllers/search_history_controller_spec.rb +3 -6
  44. data/spec/controllers/suggest_controller_spec.rb +2 -2
  45. data/spec/features/alternate_controller_spec.rb +3 -3
  46. data/spec/features/bookmarks_spec.rb +6 -6
  47. data/spec/features/did_you_mean_spec.rb +10 -10
  48. data/spec/features/facets_spec.rb +4 -4
  49. data/spec/features/record_view_spec.rb +4 -4
  50. data/spec/features/saved_searches_spec.rb +4 -4
  51. data/spec/features/search_context_spec.rb +4 -4
  52. data/spec/features/search_filters_spec.rb +10 -10
  53. data/spec/features/search_formats_spec.rb +2 -2
  54. data/spec/features/search_history_spec.rb +5 -5
  55. data/spec/features/search_pagination_spec.rb +4 -4
  56. data/spec/features/search_results_spec.rb +7 -7
  57. data/spec/features/search_sort_spec.rb +2 -2
  58. data/spec/features/search_spec.rb +6 -6
  59. data/spec/helpers/blacklight_helper_spec.rb +105 -65
  60. data/spec/helpers/catalog_helper_spec.rb +36 -36
  61. data/spec/helpers/configuration_helper_spec.rb +28 -28
  62. data/spec/helpers/facets_helper_spec.rb +39 -39
  63. data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -1
  64. data/spec/helpers/render_constraints_helper_spec.rb +1 -1
  65. data/spec/helpers/search_history_constraints_helper_spec.rb +7 -7
  66. data/spec/helpers/url_helper_spec.rb +20 -17
  67. data/spec/lib/blacklight/search_state_spec.rb +2 -2
  68. data/spec/lib/blacklight/utils_spec.rb +15 -15
  69. data/spec/lib/blacklight_spec.rb +1 -1
  70. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  71. data/spec/models/blacklight/configurable_spec.rb +3 -3
  72. data/spec/models/blacklight/configuration_spec.rb +52 -52
  73. data/spec/models/blacklight/document_spec.rb +10 -10
  74. data/spec/models/blacklight/facet_paginator_spec.rb +5 -5
  75. data/spec/models/blacklight/search_builder_spec.rb +34 -34
  76. data/spec/models/blacklight/user_spec.rb +4 -4
  77. data/spec/models/bookmark_spec.rb +5 -5
  78. data/spec/models/record_mailer_spec.rb +11 -11
  79. data/spec/models/search_spec.rb +1 -1
  80. data/spec/models/solr_document_spec.rb +4 -4
  81. data/spec/presenters/document_presenter_spec.rb +94 -50
  82. data/spec/presenters/index_presenter_spec.rb +147 -0
  83. data/spec/presenters/pipeline_spec.rb +28 -0
  84. data/spec/presenters/show_presenter_spec.rb +287 -0
  85. data/spec/routing/catalog_routing_spec.rb +11 -11
  86. data/spec/spec_helper.rb +10 -1
  87. data/spec/support/backport_test.rb +38 -0
  88. data/spec/test_app_templates/Gemfile.extra +2 -10
  89. data/spec/views/_user_util_links.html.erb_spec.rb +1 -1
  90. data/spec/views/catalog/_constraints.html.erb_spec.rb +3 -3
  91. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +5 -5
  92. data/spec/views/catalog/_document.html.erb_spec.rb +2 -2
  93. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
  94. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +4 -4
  95. data/spec/views/catalog/_facets.html.erb_spec.rb +4 -4
  96. data/spec/views/catalog/_index_default.erb_spec.rb +5 -4
  97. data/spec/views/catalog/_index_header_default.html.erb_spec.rb +4 -3
  98. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -3
  99. data/spec/views/catalog/_search_header.erb_spec.rb +1 -1
  100. data/spec/views/catalog/_show_default.erb_spec.rb +6 -5
  101. data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -1
  102. data/spec/views/catalog/_show_tools.html.erb_spec.rb +8 -8
  103. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +2 -2
  104. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -2
  105. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -3
  106. data/spec/views/catalog/facet.html.erb_spec.rb +3 -3
  107. data/spec/views/catalog/index.atom.builder_spec.rb +15 -14
  108. data/spec/views/catalog/index.html.erb_spec.rb +3 -3
  109. data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -1
  110. data/spec/views/catalog/show.html.erb_spec.rb +5 -4
  111. data/tasks/blacklight.rake +1 -1
  112. metadata +25 -4
  113. data/config/jetty.yml +0 -13
@@ -12,19 +12,19 @@ describe 'catalog/facet.html.erb' do
12
12
  assign :display_facet, display_facet
13
13
  end
14
14
 
15
- it "should have the facet title" do
15
+ it "has the facet title" do
16
16
  allow(view).to receive(:render_facet_limit)
17
17
  render
18
18
  expect(rendered).to have_selector 'h3', text: "Facet title"
19
19
  end
20
20
 
21
- it "should render facet pagination" do
21
+ it "renders facet pagination" do
22
22
  allow(view).to receive(:render_facet_limit)
23
23
  render
24
24
  expect(rendered).to have_content 'pagination'
25
25
  end
26
26
 
27
- it "should render the facet limit" do
27
+ it "renders the facet limit" do
28
28
  allow(view).to receive(:render_facet_limit).with(display_facet, layout: false)
29
29
  render
30
30
  end
@@ -14,6 +14,7 @@ describe "catalog/index" do
14
14
  end
15
15
 
16
16
  before do
17
+ allow(view).to receive(:action_name).and_return('index')
17
18
  params['content_format'] = 'some_format'
18
19
  @document_list = document_list
19
20
  allow_any_instance_of(SolrDocument).to receive(:export_as_some_format).and_return("")
@@ -31,7 +32,7 @@ describe "catalog/index" do
31
32
  REXML::Document.new(rendered)
32
33
  end
33
34
 
34
- it "should have contextual information" do
35
+ it "has contextual information" do
35
36
  expect(rendered).to have_selector("link[rel=self]")
36
37
  expect(rendered).to have_selector("link[rel=next]")
37
38
  expect(rendered).to have_selector("link[rel=previous]")
@@ -41,14 +42,14 @@ describe "catalog/index" do
41
42
  expect(rendered).to have_selector("link[rel=search][type='application/opensearchdescription+xml']")
42
43
  end
43
44
 
44
- it "should get paging data correctly from response" do
45
+ it "gets paging data correctly from response" do
45
46
  # Can't use have_tag for namespaced elements, sorry.
46
47
  expect(response_xml.elements["/feed/opensearch:totalResults"].text).to eq "30"
47
48
  expect(response_xml.elements["/feed/opensearch:startIndex"].text).to eq "10"
48
49
  expect(response_xml.elements["/feed/opensearch:itemsPerPage"].text).to eq "10"
49
50
  end
50
51
 
51
- it "should include an opensearch Query role=request" do
52
+ it "includes an opensearch Query role=request" do
52
53
  expect(response_xml.elements.to_a("/feed/opensearch:itemsPerPage")).to have(1).item
53
54
  query_el = response_xml.elements["/feed/opensearch:Query"]
54
55
  expect(query_el).to_not be_nil
@@ -57,24 +58,24 @@ describe "catalog/index" do
57
58
  expect(query_el.attributes["startPage"]).to eq "2"
58
59
  end
59
60
 
60
- it "should have ten entries" do
61
+ it "has ten entries" do
61
62
  expect(rendered).to have_selector("entry", :count => 10)
62
63
  end
63
64
 
64
65
  describe "entries" do
65
- it "should have a title" do
66
+ it "has a title" do
66
67
  expect(rendered).to have_selector("entry > title")
67
68
  end
68
- it "should have an updated" do
69
+ it "has an updated" do
69
70
  expect(rendered).to have_selector("entry > updated")
70
71
  end
71
- it "should have html link" do
72
+ it "has html link" do
72
73
  expect(rendered).to have_selector("entry > link[rel=alternate][type='text/html']")
73
74
  end
74
- it "should have an id" do
75
+ it "has an id" do
75
76
  expect(rendered).to have_selector("entry > id")
76
77
  end
77
- it "should have a summary" do
78
+ it "has a summary" do
78
79
  expect(rendered).to have_selector("entry > summary")
79
80
  end
80
81
 
@@ -82,7 +83,7 @@ describe "catalog/index" do
82
83
  before do
83
84
  @entry = response_xml.elements.to_a("/feed/entry")[0]
84
85
  end
85
- it "should have author tag" do
86
+ it "has author tag" do
86
87
  expect(@entry.elements["author/name"].text).to eq 'xyz'
87
88
  end
88
89
  end
@@ -91,7 +92,7 @@ describe "catalog/index" do
91
92
  before do
92
93
  @entry = response_xml.elements.to_a("/feed/entry")[1]
93
94
  end
94
- it "should not have an author tag" do
95
+ it "does not have an author tag" do
95
96
  expect(@entry.elements["author/name"]).to be_nil
96
97
  end
97
98
  end
@@ -102,10 +103,10 @@ describe "catalog/index" do
102
103
  let(:entry) do
103
104
  response_xml.elements.to_a("/feed/entry")[1].to_s
104
105
  end
105
- it "should include a link rel tag" do
106
+ it "includes a link rel tag" do
106
107
  expect(entry).to have_selector("link[rel=alternate][type='application/some-format']")
107
108
  end
108
- it "should have content embedded" do
109
+ it "has content embedded" do
109
110
  expect(entry).to have_selector("content")
110
111
  end
111
112
  end
@@ -113,7 +114,7 @@ describe "catalog/index" do
113
114
  before do
114
115
  @entry = response_xml.elements.to_a("/feed/entry")[5]
115
116
  end
116
- it "should include content" do
117
+ it "includes content" do
117
118
  expect(@entry.to_s).to_not have_selector("content[type='application/some-format']")
118
119
  end
119
120
  end
@@ -8,13 +8,13 @@ describe "catalog/index.html.erb" do
8
8
  allow(view).to receive(:has_search_parameters?).and_return(false)
9
9
  allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
10
10
  end
11
- it "should render the sidebar and content panes" do
11
+ it "renders the sidebar and content panes" do
12
12
  render
13
13
  expect(rendered).to match /id="sidebar"/
14
14
  expect(rendered).to match /id="content"/
15
15
  end
16
16
 
17
- it "should render the search_sidebar partial " do
17
+ it "renders the search_sidebar partial" do
18
18
  stub_template "catalog/_search_sidebar.html.erb" => "sidebar_content"
19
19
  render
20
20
  expect(rendered).to match /sidebar_content/
@@ -31,7 +31,7 @@ describe "catalog/index.html.erb" do
31
31
  allow(view).to receive(:render_opensearch_response_metadata).and_return("")
32
32
  assign(:response, double(:empty? => true))
33
33
  end
34
- it "should render the search_header partial " do
34
+ it "renders the search_header partial" do
35
35
  render
36
36
  expect(rendered).to match /header_content/
37
37
  end
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe 'catalog/opensearch.xml.builder' do
5
- it "should render an OpenSearch description document" do
5
+ it "renders an OpenSearch description document" do
6
6
  render
7
7
  doc = Nokogiri::XML.parse(rendered)
8
8
  doc.remove_namespaces!
@@ -12,6 +12,7 @@ describe "catalog/show.html.erb" do
12
12
  end
13
13
 
14
14
  before :each do
15
+ allow(view).to receive(:action_name).and_return('show')
15
16
  allow(view).to receive_messages(:has_user_authentication_provider? => false)
16
17
  allow(view).to receive_messages(:render_document_sidebar_partial => "Sidebar")
17
18
  allow(view).to receive_messages(current_search_session: nil)
@@ -19,7 +20,7 @@ describe "catalog/show.html.erb" do
19
20
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
20
21
  end
21
22
 
22
- it "should set the @page_title" do
23
+ it "sets the @page_title" do
23
24
  allow(view).to receive(:document_show_html_title).and_return("Heading")
24
25
  render
25
26
  page_title = view.instance_variable_get(:@page_title)
@@ -27,7 +28,7 @@ describe "catalog/show.html.erb" do
27
28
  expect(page_title).to be_html_safe
28
29
  end
29
30
 
30
- it "should include schema.org itemscope/type properties" do
31
+ it "includes schema.org itemscope/type properties" do
31
32
  allow(view).to receive(:document_show_html_title).and_return("Heading")
32
33
  allow(document).to receive_messages(:itemtype => 'some-item-type-uri')
33
34
  render
@@ -36,7 +37,7 @@ describe "catalog/show.html.erb" do
36
37
  expect(rendered).to have_selector('div#document[@itemtype="some-item-type-uri"]')
37
38
  end
38
39
 
39
- it "should render the show_header and show partials by default" do
40
+ it "renders the show_header and show partials by default" do
40
41
  allow(view).to receive(:render_grouped_response?).and_return(false)
41
42
  stub_template "catalog/_show_header_default.html.erb" => "document_header"
42
43
  stub_template "catalog/_show_default.html.erb" => "show_default"
@@ -48,7 +49,7 @@ describe "catalog/show.html.erb" do
48
49
  end
49
50
 
50
51
 
51
- it "should use the show.partials parameter to determine the partials to render" do
52
+ it "uses the show.partials parameter to determine the partials to render" do
52
53
  allow(view).to receive(:render_grouped_response?).and_return(false)
53
54
  blacklight_config.show.partials = ['a', 'b', 'c']
54
55
  stub_template "catalog/_a_default.html.erb" => "a_partial"
@@ -10,7 +10,7 @@ EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
10
10
 
11
11
  desc "Run test suite"
12
12
  task :ci => ['blacklight:generate'] do
13
- SolrWrapper.wrap(port: '8888') do |solr|
13
+ SolrWrapper.wrap do |solr|
14
14
  solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path("..", File.dirname(__FILE__)), "solr", "conf")) do
15
15
  within_test_app do
16
16
  system "RAILS_ENV=test rake blacklight:index:seed"
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: 6.2.0
4
+ version: 6.3.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: 2016-05-10 00:00:00.000000000 Z
20
+ date: 2016-07-01 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -278,6 +278,7 @@ files:
278
278
  - ".rspec"
279
279
  - ".rubocop.yml"
280
280
  - ".rubocop_todo.yml"
281
+ - ".solr_wrapper"
281
282
  - ".travis.yml"
282
283
  - ".yardopts"
283
284
  - Gemfile
@@ -380,7 +381,19 @@ files:
380
381
  - app/models/search.rb
381
382
  - app/models/solr_document.rb
382
383
  - app/presenters/blacklight/document_presenter.rb
384
+ - app/presenters/blacklight/field_presenter.rb
385
+ - app/presenters/blacklight/index_presenter.rb
383
386
  - app/presenters/blacklight/json_presenter.rb
387
+ - app/presenters/blacklight/link_alternate_presenter.rb
388
+ - app/presenters/blacklight/rendering/abstract_step.rb
389
+ - app/presenters/blacklight/rendering/helper_method.rb
390
+ - app/presenters/blacklight/rendering/join.rb
391
+ - app/presenters/blacklight/rendering/link_to_facet.rb
392
+ - app/presenters/blacklight/rendering/microdata.rb
393
+ - app/presenters/blacklight/rendering/pipeline.rb
394
+ - app/presenters/blacklight/rendering/terminator.rb
395
+ - app/presenters/blacklight/show_presenter.rb
396
+ - app/services/blacklight/field_retriever.rb
384
397
  - app/views/_flash_msg.html.erb
385
398
  - app/views/_user_util_links.html.erb
386
399
  - app/views/blacklight/nav/_bookmark.html.erb
@@ -469,7 +482,6 @@ files:
469
482
  - app/views/shared/_header_navbar.html.erb
470
483
  - app/views/shared/_sitelinks_search_box.html.erb
471
484
  - blacklight.gemspec
472
- - config/jetty.yml
473
485
  - config/locales/blacklight.de.yml
474
486
  - config/locales/blacklight.en.yml
475
487
  - config/locales/blacklight.es.yml
@@ -487,6 +499,7 @@ files:
487
499
  - lib/blacklight/configuration/facet_field.rb
488
500
  - lib/blacklight/configuration/field.rb
489
501
  - lib/blacklight/configuration/fields.rb
502
+ - lib/blacklight/configuration/null_field.rb
490
503
  - lib/blacklight/configuration/search_field.rb
491
504
  - lib/blacklight/configuration/sort_field.rb
492
505
  - lib/blacklight/configuration/tool_config.rb
@@ -623,9 +636,13 @@ files:
623
636
  - spec/models/search_spec.rb
624
637
  - spec/models/solr_document_spec.rb
625
638
  - spec/presenters/document_presenter_spec.rb
639
+ - spec/presenters/index_presenter_spec.rb
640
+ - spec/presenters/pipeline_spec.rb
641
+ - spec/presenters/show_presenter_spec.rb
626
642
  - spec/routing/catalog_routing_spec.rb
627
643
  - spec/spec.opts
628
644
  - spec/spec_helper.rb
645
+ - spec/support/backport_test.rb
629
646
  - spec/support/controller_level_helpers.rb
630
647
  - spec/support/features.rb
631
648
  - spec/support/features/session_helpers.rb
@@ -678,7 +695,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
678
695
  version: '0'
679
696
  requirements: []
680
697
  rubyforge_project:
681
- rubygems_version: 2.4.5.1
698
+ rubygems_version: 2.6.4
682
699
  signing_key:
683
700
  specification_version: 4
684
701
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
@@ -756,9 +773,13 @@ test_files:
756
773
  - spec/models/search_spec.rb
757
774
  - spec/models/solr_document_spec.rb
758
775
  - spec/presenters/document_presenter_spec.rb
776
+ - spec/presenters/index_presenter_spec.rb
777
+ - spec/presenters/pipeline_spec.rb
778
+ - spec/presenters/show_presenter_spec.rb
759
779
  - spec/routing/catalog_routing_spec.rb
760
780
  - spec/spec.opts
761
781
  - spec/spec_helper.rb
782
+ - spec/support/backport_test.rb
762
783
  - spec/support/controller_level_helpers.rb
763
784
  - spec/support/features.rb
764
785
  - spec/support/features/session_helpers.rb
@@ -1,13 +0,0 @@
1
- development:
2
- startup_wait: 15
3
- jetty_port: 8983
4
- java_version: ">= 1.7"
5
- test:
6
- startup_wait: 60
7
- jetty_port: <%= ENV['TEST_JETTY_PORT'] || 8888 %>
8
- <%= ENV['TEST_JETTY_PATH'] ? "jetty_home: " + ENV['TEST_JETTY_PATH'] : '' %>
9
- java_version: ">= 1.7"
10
- production:
11
- startup_wait: 15
12
- jetty_port: 8983
13
- java_version: ">= 1.7"