blacklight 3.4.1 → 3.4.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.1
1
+ 3.4.2
@@ -118,7 +118,7 @@ module Blacklight::BlacklightHelperBehavior
118
118
 
119
119
  def render_index_field_value args
120
120
  value = args[:value]
121
- value ||= send(blacklight_config.index_fields[args[:field]][:helper_method], args) if args[:field] and blacklight_config.index_fields[args[:field]][:helper_method]
121
+ value ||= send(blacklight_config.index_fields[args[:field]][:helper_method], args) if args[:field] and blacklight_config.index_fields[args[:field]] and blacklight_config.index_fields[args[:field]][:helper_method]
122
122
  value ||= args[:document].get(args[:field], :sep => nil) if args[:document] and args[:field]
123
123
  render_field_value value
124
124
  end
@@ -174,7 +174,7 @@ module Blacklight::BlacklightHelperBehavior
174
174
 
175
175
  def render_document_show_field_value args
176
176
  value = args[:value]
177
- value ||= send(blacklight_config.show_fields[args[:field]][:helper_method], args) if args[:field] and blacklight_config.show_fields[args[:field]][:helper_method]
177
+ value ||= send(blacklight_config.show_fields[args[:field]][:helper_method], args) if args[:field] and blacklight_config.show_fields[args[:field]] and blacklight_config.show_fields[args[:field]][:helper_method]
178
178
  value ||= args[:document].get(args[:field], :sep => nil) if args[:document] and args[:field]
179
179
  render_field_value value
180
180
  end
@@ -100,7 +100,7 @@ module Blacklight::Solr::Document
100
100
  end
101
101
 
102
102
  def to_param
103
- URI.escape(CGI.escape(id), '.')
103
+ id
104
104
  end
105
105
  end
106
106
 
@@ -142,8 +142,11 @@ EOF
142
142
  end
143
143
 
144
144
  def inject_blacklight_routes
145
- route('root :to => "catalog#index"')
145
+ # These will end up in routes.rb file in reverse order
146
+ # we add em, since each is added at the top of file.
147
+ # we want "root" to be FIRST for optimal url generation.
146
148
  route('Blacklight.add_routes(self)')
149
+ route('root :to => "catalog#index"')
147
150
  end
148
151
 
149
152
  def add_sass_configuration
@@ -52,9 +52,29 @@ describe CatalogController do
52
52
  { :get => catalog_url(SolrDocument.new(:id => 'asdf')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'asdf')
53
53
  end
54
54
 
55
- it "should escape solr document ids" do
56
- catalog_path(SolrDocument.new(:id => 'http://example.com')).should == "/catalog/http%3A%2F%2Fexample%2Ecom"
57
- { :get => catalog_url(SolrDocument.new(:id => 'http://example.com'))}.should route_to(:controller => 'catalog', :action => 'show', :id => 'http://example.com')
55
+ context "should escape solr document ids" do
56
+
57
+ it "should pass-through url-valid ids" do
58
+ { :get => catalog_url(SolrDocument.new(:id => 'qwerty'))}.should route_to(:controller => 'catalog', :action => 'show', :id => 'qwerty')
59
+ end
60
+
61
+ it "should route url-like ids" do
62
+ pending "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
63
+ { :get => catalog_url(SolrDocument.new(:id => 'http://example.com'))}.should route_to(:controller => 'catalog', :action => 'show', :id => 'http://example.com')
64
+ end
65
+
66
+ it "should route ids with whitespace" do
67
+ { :get => catalog_url(SolrDocument.new(:id => 'mm 123')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'mm 123')
68
+ end
69
+
70
+ it "should route ids with a literal '+'" do
71
+ { :get => catalog_url(SolrDocument.new(:id => 'this+that')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'this+that')
72
+ end
73
+
74
+ it "should route ids with a literal '/" do
75
+ pending "This works if you configure your routing to have very liberal constraints on :id.. not sure how to go about testing it though"
76
+ { :get => catalog_url(SolrDocument.new(:id => 'and/or')) }.should route_to(:controller => 'catalog', :action => 'show', :id => 'and/or')
77
+ end
58
78
  end
59
79
 
60
80
  end
@@ -392,6 +392,13 @@ describe BlacklightHelper do
392
392
  value = helper.render_index_field_value :document => doc, :field => 'qwer'
393
393
  value.should == 'document qwer value'
394
394
  end
395
+
396
+ it "should work with index fields that aren't explicitly defined" do
397
+ doc = mock()
398
+ doc.should_receive(:get).with('mnbv', :sep => nil).and_return('document mnbv value')
399
+ value = helper.render_index_field_value :document => doc, :field => 'mnbv'
400
+ value.should == 'document mnbv value'
401
+ end
395
402
  end
396
403
 
397
404
 
@@ -426,6 +433,13 @@ describe BlacklightHelper do
426
433
  value = helper.render_document_show_field_value :document => doc, :field => 'qwer'
427
434
  value.should == 'document qwer value'
428
435
  end
436
+
437
+ it "should work with show fields that aren't explicitly defined" do
438
+ doc = mock()
439
+ doc.should_receive(:get).with('mnbv', :sep => nil).and_return('document mnbv value')
440
+ value = helper.render_document_show_field_value :document => doc, :field => 'mnbv'
441
+ value.should == 'document mnbv value'
442
+ end
429
443
  end
430
444
 
431
445
  end
@@ -9,7 +9,7 @@ describe RenderConstraintsHelper do
9
9
 
10
10
  describe '#render_constraints_query' do
11
11
  it "should have a link relative to the current url" do
12
- helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should have_selector "a[href='/catalog?f%5Btype%5D=journal']"
12
+ helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should have_selector "a[href='/?f%5Btype%5D=journal']"
13
13
  end
14
14
  end
15
15
 
@@ -24,7 +24,7 @@ describe RenderConstraintsHelper do
24
24
  result = helper.render_filter_element('type', ['journal'], {:q=>'biz'})
25
25
  result.size.should == 1
26
26
  # I'm not certain how the ampersand gets in there. It's not important.
27
- result.first.should have_selector "a[href='/catalog?&q=biz']"
27
+ result.first.should have_selector "a[href='/?&q=biz']"
28
28
  end
29
29
  end
30
30
 
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: 3.4.1
4
+ version: 3.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2012-05-02 00:00:00.000000000 Z
20
+ date: 2012-05-17 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -505,7 +505,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
505
505
  version: '0'
506
506
  segments:
507
507
  - 0
508
- hash: -750863571297793864
508
+ hash: -528944564261981247
509
509
  required_rubygems_version: !ruby/object:Gem::Requirement
510
510
  none: false
511
511
  requirements:
@@ -514,10 +514,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
514
514
  version: '0'
515
515
  segments:
516
516
  - 0
517
- hash: -750863571297793864
517
+ hash: -528944564261981247
518
518
  requirements: []
519
519
  rubyforge_project: blacklight
520
- rubygems_version: 1.8.24
520
+ rubygems_version: 1.8.21
521
521
  signing_key:
522
522
  specification_version: 3
523
523
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)