blacklight 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +1 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +13 -3
- data/app/helpers/blacklight/catalog_helper_behavior.rb +47 -6
- data/app/helpers/blacklight/facets_helper_behavior.rb +5 -1
- data/app/helpers/blacklight/html_head_helper_behavior.rb +28 -13
- data/app/views/catalog/_paginate_compact.html.erb +1 -1
- data/app/views/catalog/_search_header.html.erb +5 -0
- data/app/views/catalog/facet.html.erb +2 -0
- data/app/views/catalog/index.html.erb +2 -6
- data/app/views/catalog/show.html.erb +1 -1
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +2 -2
- data/blacklight.gemspec +3 -1
- data/config/locales/blacklight.en.yml +1 -1
- data/gemfiles/rails3.gemfile +1 -2
- data/gemfiles/rails4.gemfile +0 -1
- data/lib/blacklight.rb +1 -0
- data/lib/blacklight/catalog.rb +8 -3
- data/lib/blacklight/catalog/search_context.rb +13 -5
- data/lib/blacklight/legacy_controller_methods.rb +18 -4
- data/lib/blacklight/solr/document.rb +7 -1
- data/lib/blacklight/solr/document/marc_export.rb +12 -24
- data/lib/blacklight/solr_helper.rb +4 -1
- data/lib/blacklight/solr_response/pagination_methods.rb +6 -0
- data/lib/generators/blacklight/blacklight_generator.rb +0 -4
- data/lib/generators/blacklight/marc_generator.rb +2 -2
- data/spec/controllers/application_controller_spec.rb +8 -6
- data/spec/controllers/catalog_controller_spec.rb +4 -4
- data/spec/features/did_you_mean_spec.rb +3 -3
- data/spec/features/search_filters_spec.rb +1 -1
- data/spec/features/search_spec.rb +1 -1
- data/spec/helpers/blacklight_helper_spec.rb +7 -1
- data/spec/helpers/catalog_helper_spec.rb +37 -21
- data/spec/helpers/facets_helper_spec.rb +8 -7
- data/spec/helpers/html_head_helper_spec.rb +25 -8
- data/spec/lib/blacklight_solr_response_spec.rb +9 -0
- data/spec/lib/marc_export_spec.rb +1 -8
- data/spec/views/catalog/_search_header.erb_spec.rb +17 -0
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -2
- data/spec/views/catalog/index.html.erb_spec.rb +13 -0
- metadata +34 -3
@@ -1,4 +1,8 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'equivalent-xml'
|
5
|
+
|
2
6
|
describe FacetsHelper do
|
3
7
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
4
8
|
|
@@ -190,12 +194,6 @@ describe FacetsHelper do
|
|
190
194
|
helper.render_facet_limit(@mock_facet)
|
191
195
|
end
|
192
196
|
|
193
|
-
it "should send a deprecation warning if the method is called using the old-style signature" do
|
194
|
-
helper.should_receive(:render_facet_partials).with(['asdf'])
|
195
|
-
$stderr.should_receive(:puts)
|
196
|
-
helper.render_facet_limit('asdf')
|
197
|
-
end
|
198
|
-
|
199
197
|
it "should render a facet _not_ declared in the configuration" do
|
200
198
|
@mock_facet = double(:name => 'asdf', :items => [1,2,3])
|
201
199
|
helper.should_receive(:render).with(hash_including(:partial => 'facet_limit'))
|
@@ -378,7 +376,10 @@ describe FacetsHelper do
|
|
378
376
|
|
379
377
|
helper.should_receive(:facet_display_value).and_return('Z')
|
380
378
|
helper.should_receive(:add_facet_params_and_redirect).and_return('link')
|
381
|
-
|
379
|
+
expected = Nokogiri::HTML "<a class=\"facet_select\" href=\"link\">Z</a> <span class=\"count\">10</span>"
|
380
|
+
rendered = Nokogiri::HTML helper.render_facet_value('simple_field', double(:value => 'A', :hits => 10))
|
381
|
+
|
382
|
+
rendered.should be_equivalent_to(expected).respecting_element_order
|
382
383
|
end
|
383
384
|
|
384
385
|
|
@@ -11,7 +11,10 @@ describe HtmlHeadHelper do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
it "should include script tags specified in controller#javascript_includes" do
|
14
|
-
|
14
|
+
|
15
|
+
html = Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
|
16
|
+
helper.render_js_includes
|
17
|
+
end
|
15
18
|
|
16
19
|
if Rails::VERSION::MAJOR == 4
|
17
20
|
html.should have_selector("script[src='/javascripts/some_js.js']")
|
@@ -40,7 +43,10 @@ describe HtmlHeadHelper do
|
|
40
43
|
end
|
41
44
|
end
|
42
45
|
it "should render stylesheets specified in controller #stylesheet_links" do
|
43
|
-
|
46
|
+
|
47
|
+
html = Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
|
48
|
+
helper.render_stylesheet_includes
|
49
|
+
end
|
44
50
|
|
45
51
|
if Rails::VERSION::MAJOR == 4
|
46
52
|
html.should have_selector("link[href='/stylesheets/my_stylesheet.css'][rel='stylesheet']")
|
@@ -65,7 +71,10 @@ describe HtmlHeadHelper do
|
|
65
71
|
end
|
66
72
|
|
67
73
|
it "should include content specified in controller#extra_head_content" do
|
68
|
-
|
74
|
+
|
75
|
+
html = Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
|
76
|
+
helper.render_extra_head_content
|
77
|
+
end
|
69
78
|
|
70
79
|
html.should have_selector("link[rel=a]")
|
71
80
|
html.should have_selector("link[rel=b]")
|
@@ -77,9 +86,11 @@ describe HtmlHeadHelper do
|
|
77
86
|
describe "render_head_content" do
|
78
87
|
describe "with no methods defined" do
|
79
88
|
it "should return empty string without complaint" do
|
80
|
-
|
81
|
-
|
82
|
-
|
89
|
+
Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
|
90
|
+
lambda {helper.render_head_content}.should_not raise_error
|
91
|
+
helper.render_head_content.should be_blank
|
92
|
+
helper.render_head_content.html_safe?.should == true
|
93
|
+
end
|
83
94
|
end
|
84
95
|
end
|
85
96
|
describe "with methods defined" do
|
@@ -99,7 +110,10 @@ describe HtmlHeadHelper do
|
|
99
110
|
end
|
100
111
|
before(:each) do
|
101
112
|
helper.should_receive(:content_for).with(:head).and_return("<meta keywords=\"foo bar\"/>".html_safe)
|
102
|
-
|
113
|
+
|
114
|
+
@output = Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
|
115
|
+
helper.render_head_content
|
116
|
+
end
|
103
117
|
end
|
104
118
|
it "should include extra_head_content" do
|
105
119
|
@output.should have_selector("madeup_tag")
|
@@ -128,7 +142,10 @@ describe HtmlHeadHelper do
|
|
128
142
|
helper.should_receive(:render_js_includes).and_return("".html_safe)
|
129
143
|
helper.should_receive(:render_stylesheet_includes).and_return("".html_safe)
|
130
144
|
helper.should_receive(:content_for).with(:head).and_return("".html_safe)
|
131
|
-
|
145
|
+
|
146
|
+
Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
|
147
|
+
helper.render_head_content.should be_html_safe
|
148
|
+
end
|
132
149
|
end
|
133
150
|
end
|
134
151
|
end
|
@@ -69,6 +69,15 @@ describe Blacklight::SolrResponse do
|
|
69
69
|
expect(r).to be_a_kind_of Kaminari::PageScopeMethods
|
70
70
|
end
|
71
71
|
|
72
|
+
it "should provide a model name helper" do
|
73
|
+
first_doc_model_name = 'xyz'
|
74
|
+
|
75
|
+
r.docs.first.stub(:model_name).and_return first_doc_model_name
|
76
|
+
|
77
|
+
expect(r.model_name).to eq first_doc_model_name
|
78
|
+
|
79
|
+
end
|
80
|
+
|
72
81
|
describe "FacetItem" do
|
73
82
|
it "should work with a field,value tuple" do
|
74
83
|
item = Blacklight::SolrResponse::Facets::FacetItem.new('value', 15)
|
@@ -676,14 +676,7 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
676
676
|
@music_record.export_as_refworks_marc_txt.should == "LEADER 01828cjm a2200409 a 4500001 a4768316\n003 SIRSI\n007 sd fungnnmmned\n008 020117p20011990xxuzz h d\n245 00 Music for horn |h[sound recording] / |cBrahms, Beethoven, von Krufft.\n260 [United States] : |bHarmonia Mundi USA, |cp2001.\n700 1 Greer, Lowell.\n700 1 Lubin, Steven.\n700 1 Chase, Stephanie, |d1957-\n700 12 Brahms, Johannes, |d1833-1897. |tTrios, |mpiano, violin, horn, |nop. 40, |rE? major.\n700 12 Beethoven, Ludwig van, |d1770-1827. |tSonatas, |mhorn, piano, |nop. 17, |rF major.\n700 12 Krufft, Nikolaus von, |d1779-1818. |tSonata, |mhorn, piano, |rF major.\n"
|
677
677
|
end
|
678
678
|
describe "for UTF-8 record" do
|
679
|
-
it "should export in Unicode normalized C form" do
|
680
|
-
|
681
|
-
begin
|
682
|
-
require 'unicode'
|
683
|
-
rescue LoadError
|
684
|
-
Blacklight.logger.should_receive(:warn) unless defined? :JRUBY_VERSION
|
685
|
-
end
|
686
|
-
|
679
|
+
it "should export in Unicode normalized C form" do
|
687
680
|
@utf8_exported = @record_utf8_decomposed.export_as_refworks_marc_txt
|
688
681
|
|
689
682
|
if defined? Unicode
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
3
|
+
|
4
|
+
# spec for sidebar partial in catalog show view
|
5
|
+
|
6
|
+
describe "/catalog/_search_header.html.erb" do
|
7
|
+
|
8
|
+
it "should render the default search header partials" do
|
9
|
+
stub_template "_did_you_mean.html.erb" => "did_you_mean"
|
10
|
+
stub_template "_constraints.html.erb" => "constraints"
|
11
|
+
stub_template "_sort_and_per_page.html.erb" => "sort_and_per_page"
|
12
|
+
render
|
13
|
+
expect(rendered).to match /did_you_mean/
|
14
|
+
expect(rendered).to match /constraints/
|
15
|
+
expect(rendered).to match /sort_and_per_page/
|
16
|
+
end
|
17
|
+
end
|
@@ -18,9 +18,9 @@ describe "/catalog/_show_sidebar.html.erb" do
|
|
18
18
|
|
19
19
|
it "should show more-like-this titles in the sidebar" do
|
20
20
|
@document = SolrDocument.new :id => 1, :title_s => 'abc', :format => 'default'
|
21
|
-
@document.stub(:more_like_this).and_return([SolrDocument.new({ 'id' => 2, 'title_display' => 'Title of MLT Document' })])
|
21
|
+
@document.stub(:more_like_this).and_return([SolrDocument.new({ 'id' => '2', 'title_display' => 'Title of MLT Document' })])
|
22
22
|
render
|
23
23
|
rendered.should include_text("More Like This")
|
24
24
|
rendered.should include_text("Title of MLT Document")
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -15,4 +15,17 @@ describe "catalog/index.html.erb" do
|
|
15
15
|
render
|
16
16
|
expect(rendered).to match /sidebar_content/
|
17
17
|
end
|
18
|
+
|
19
|
+
it "should render the search_header partial " do
|
20
|
+
stub_template "catalog/_results_pagination.html.erb" => ""
|
21
|
+
stub_template "catalog/_search_header.html.erb" => "header_content"
|
22
|
+
|
23
|
+
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new)
|
24
|
+
view.stub(:has_search_parameters?).and_return(true)
|
25
|
+
view.stub(:extra_head_content).and_return([])
|
26
|
+
view.stub(:render_opensearch_response_metadata).and_return("")
|
27
|
+
view.stub(:response_has_no_search_results?).and_return(true)
|
28
|
+
render
|
29
|
+
expect(rendered).to match /header_content/
|
30
|
+
end
|
18
31
|
end
|
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: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date:
|
20
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -135,6 +135,20 @@ dependencies:
|
|
135
135
|
- - <
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '2.4'
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: deprecation
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
type: :runtime
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
138
152
|
- !ruby/object:Gem::Dependency
|
139
153
|
name: jettywrapper
|
140
154
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,6 +191,20 @@ dependencies:
|
|
177
191
|
- - '>='
|
178
192
|
- !ruby/object:Gem::Version
|
179
193
|
version: 0.1.0
|
194
|
+
- !ruby/object:Gem::Dependency
|
195
|
+
name: equivalent-xml
|
196
|
+
requirement: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - '>='
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
type: :development
|
202
|
+
prerelease: false
|
203
|
+
version_requirements: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - '>='
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
180
208
|
description: Blacklight is an open source Solr user interface discovery platform.
|
181
209
|
You can use Blacklight to enable searching and browsing of your collections. Blacklight
|
182
210
|
uses the Apache Solr search engine to search full text and/or metadata.
|
@@ -292,6 +320,7 @@ files:
|
|
292
320
|
- app/views/catalog/_refworks_form.html.erb
|
293
321
|
- app/views/catalog/_results_pagination.html.erb
|
294
322
|
- app/views/catalog/_search_form.html.erb
|
323
|
+
- app/views/catalog/_search_header.html.erb
|
295
324
|
- app/views/catalog/_search_sidebar.html.erb
|
296
325
|
- app/views/catalog/_show_default.html.erb
|
297
326
|
- app/views/catalog/_show_more_like_this.html.erb
|
@@ -487,6 +516,7 @@ files:
|
|
487
516
|
- spec/views/catalog/_document_list.html.erb_spec.rb
|
488
517
|
- spec/views/catalog/_facets.html.erb_spec.rb
|
489
518
|
- spec/views/catalog/_index_default.erb_spec.rb
|
519
|
+
- spec/views/catalog/_search_header.erb_spec.rb
|
490
520
|
- spec/views/catalog/_show_default.erb_spec.rb
|
491
521
|
- spec/views/catalog/_show_sidebar.erb_spec.rb
|
492
522
|
- spec/views/catalog/_thumbnail_default.erb_spec.rb
|
@@ -514,7 +544,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
514
544
|
version: '0'
|
515
545
|
requirements: []
|
516
546
|
rubyforge_project: blacklight
|
517
|
-
rubygems_version: 2.0.
|
547
|
+
rubygems_version: 2.0.14
|
518
548
|
signing_key:
|
519
549
|
specification_version: 4
|
520
550
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
@@ -587,6 +617,7 @@ test_files:
|
|
587
617
|
- spec/views/catalog/_document_list.html.erb_spec.rb
|
588
618
|
- spec/views/catalog/_facets.html.erb_spec.rb
|
589
619
|
- spec/views/catalog/_index_default.erb_spec.rb
|
620
|
+
- spec/views/catalog/_search_header.erb_spec.rb
|
590
621
|
- spec/views/catalog/_show_default.erb_spec.rb
|
591
622
|
- spec/views/catalog/_show_sidebar.erb_spec.rb
|
592
623
|
- spec/views/catalog/_thumbnail_default.erb_spec.rb
|