blacklight 5.8.2 → 5.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3d10313f3002a4317d920835752d25639bf963a
4
- data.tar.gz: 13ab0a0e6cdf3deaab7add1b8f0b4247b340b3c1
3
+ metadata.gz: fedd8110404760fccc7f451d8c48086a291ee6b5
4
+ data.tar.gz: 7576a604fa84a87d1c09b4cbede4715eaf28adf8
5
5
  SHA512:
6
- metadata.gz: 32b593b6bfd432d4fe5fafdbd93d9269f9f63371c963869a086e8914aeb07771996f9660a80208379e6269195a015d8d3d1b0e78d18edcd168ad74d1fa7ab585
7
- data.tar.gz: 9632e817084e378269456a84e930ecf0f1fbc95e12b62eb89d277b03fafd8c5b390af304d5409abf85b259284dc096485a25b085dd897a36badfc52076172231
6
+ metadata.gz: b3fba026879c4a1f690d2998581eec9e89f4cdf9e93d5785b1d23270a2fd67a5e6792122df90c49fb7be802c50ee6a5449f2377a6523c26643ed2c4021d1f963
7
+ data.tar.gz: 1206489a87d12d763df09ca14b0490860530983b754d3c7c6523f90e7abd5bcf015d3d5fc0384ff638df63e944b15b172d235dc14f2279a058f6b08287b51e09
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.8.2
1
+ 5.9.0
@@ -164,13 +164,13 @@ label.toggle_bookmark
164
164
  padding-bottom: $padding-base-vertical;
165
165
  }
166
166
 
167
- #sortAndPerPage, #previousNextDocument {
167
+ #sortAndPerPage, .pagination-search-widgets {
168
168
  border-bottom: 1px solid $pagination-border;
169
169
  margin-bottom: 1em;
170
170
  padding-bottom: 1em;
171
171
  }
172
172
 
173
- #previousNextDocument {
173
+ .pagination-search-widgets {
174
174
  @extend .clearfix;
175
175
  padding-top: 1px;
176
176
  padding-bottom: $padding-base-vertical;
@@ -272,7 +272,7 @@ module Blacklight::BlacklightHelperBehavior
272
272
  # @options options [Symbol] :tag
273
273
  def render_document_heading(*args)
274
274
  options = args.extract_options!
275
- if args.first.is_a? SolrDocument
275
+ if args.first.is_a? blacklight_config.solr_document_model
276
276
  document = args.shift
277
277
  tag = options[:tag]
278
278
  else
@@ -78,7 +78,7 @@ module Blacklight::CatalogHelperBehavior
78
78
  #
79
79
  # @return [Blacklight::Configuration::SortField]
80
80
  def current_sort_field
81
- blacklight_config.sort_fields[params[:sort]] || default_sort_field
81
+ (blacklight_config.sort_fields.values.find {|f| f.sort == @response.sort} if @response and @response.sort.present?) || blacklight_config.sort_fields[params[:sort]] || default_sort_field
82
82
  end
83
83
 
84
84
  ##
@@ -138,7 +138,14 @@ module Blacklight::ConfigurationHelperBehavior
138
138
 
139
139
  # Used in the document list partial (search view) for creating a link to the document show action
140
140
  def document_show_link_field document=nil
141
- blacklight_config.view_config(document_index_view_type).title_field.try(:to_sym) || document.id
141
+ fields = Array(blacklight_config.view_config(document_index_view_type).title_field)
142
+
143
+ field = fields.first if document.nil?
144
+ field ||= fields.find { |f| document.has? f }
145
+ field &&= field.try(:to_sym)
146
+ field ||= document.id
147
+
148
+ field
142
149
  end
143
150
 
144
151
  ##
@@ -0,0 +1,56 @@
1
+ xml.entry do
2
+
3
+
4
+ xml.title document.to_semantic_values[:title][0] || presenter(document).render_document_index_label(document_show_link_field(document))
5
+
6
+ # updated is required, for now we'll just set it to now, sorry
7
+ xml.updated Time.now.strftime("%Y-%m-%dT%H:%M:%SZ")
8
+
9
+ xml.link "rel" => "alternate", "type" => "text/html", "href" => polymorphic_url(url_for_document(document))
10
+ # add other doc-specific formats, atom only lets us have one per
11
+ # content type, so the first one in the list wins.
12
+ xml << render_link_rel_alternates(document, :unique => true)
13
+
14
+ xml.id polymorphic_url(url_for_document(document))
15
+
16
+
17
+ if document.to_semantic_values[:author][0]
18
+ xml.author { xml.name(document.to_semantic_values[:author][0]) }
19
+ end
20
+
21
+ with_format("html") do
22
+ xml.summary "type" => "html" do
23
+ xml.text! render_document_partial(document,
24
+ :index,
25
+ :document_counter => document_counter)
26
+ end
27
+ end
28
+
29
+ #If they asked for a format, give it to them.
30
+ if (params["content_format"] &&
31
+ document.export_formats[params["content_format"].to_sym])
32
+
33
+ type = document.export_formats[params["content_format"].to_sym][:content_type]
34
+
35
+ xml.content :type => type do |content_element|
36
+ data = document.export_as(params["content_format"])
37
+
38
+ # encode properly. See:
39
+ # http://tools.ietf.org/html/rfc4287#section-4.1.3.3
40
+ type = type.downcase
41
+ if (type.downcase =~ /\+|\/xml$/)
42
+ # xml, just put it right in
43
+ content_element << data
44
+ elsif (type.downcase =~ /text\//)
45
+ # text, escape
46
+ content_element.text! data
47
+ else
48
+ #something else, base64 encode it
49
+ content_element << Base64.encode64(data)
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+
56
+ end
@@ -0,0 +1,5 @@
1
+ xml.item do
2
+ xml.title( document.to_semantic_values[:title][0] || presenter(document).render_document_index_label(document_show_link_field(document)) )
3
+ xml.link(polymorphic_url(url_for_document(document)))
4
+ xml.author( document.to_semantic_values[:author][0] ) if document.to_semantic_values[:author][0]
5
+ end
@@ -1,18 +1,20 @@
1
1
  <% #Using the Bootstrap Pagination class -%>
2
- <% if @previous_document || @next_document %>
3
- <div id="previousNextDocument">
2
+ <% #DEPRECATED - using id="previousNextDocument" as a selector is deprecated and will be removed in Blacklight 6.0 %>
3
+ <div id='previousNextDocument' class='pagination-search-widgets'>
4
+ <% if @previous_document || @next_document %>
4
5
  <div class="page_links">
5
6
  <%= link_to_previous_document @previous_document %> |
6
7
 
7
8
  <%= item_page_entry_info %> |
8
9
 
9
10
  <%= link_to_next_document @next_document %>
10
- </div>
11
-
11
+ </div>
12
+ <% end %>
13
+ <% if current_search_session %>
12
14
  <div class="pull-right search-widgets">
13
- <%= link_back_to_catalog :class => 'btn' %>
14
-
15
- <%=link_to "#{t('blacklight.search.start_over')}", start_over_path(current_search_session.try(:query_params) || {}), :id=>"startOverLink", :class => 'btn' %>
16
- </div>
17
- </div>
18
- <% end %>
15
+ <%= link_back_to_catalog class: 'btn' %>
16
+
17
+ <%=link_to t('blacklight.search.start_over'), start_over_path(current_search_session.try(:query_params) || {}), id: 'startOverLink', class: 'btn' %>
18
+ </div>
19
+ <% end %>
20
+ </div>
@@ -1,4 +1,4 @@
1
- <%= form_tag search_action_url, :method => :get, :class => 'search-query-form form-inline clearfix navbar-form' do %>
1
+ <%= form_tag search_action_url, :method => :get, :class => 'search-query-form clearfix navbar-form' do %>
2
2
  <%= render_hash_as_hidden_fields(params_for_search().except(:q, :search_field, :qt, :page, :utf8)) %>
3
3
 
4
4
  <% unless search_fields.empty? %>
@@ -7,8 +7,8 @@
7
7
  <span class="sr-only"><%= t('blacklight.search.form.search_field.post_label') %></span>
8
8
  <% end %>
9
9
  <div class="input-group search-input-group">
10
- <label for="q" class="sr-only"><%= t('blacklight.search.form.q') %></label>
11
- <%= text_field_tag :q, params[:q], :placeholder => t('blacklight.search.form.q'), :class => "search_q q form-control", :id => "q", :autofocus => should_autofocus_on_search_box? %>
10
+ <label for="q" class="sr-only"><%= t('blacklight.search.form.search.label') %></label>
11
+ <%= text_field_tag :q, params[:q], :placeholder => t('blacklight.search.form.search.placeholder'), :class => "search_q q form-control", :id => "q", :autofocus => should_autofocus_on_search_box? %>
12
12
 
13
13
  <span class="input-group-btn">
14
14
  <button type="submit" class="btn btn-primary search-btn" id="search">
@@ -45,63 +45,9 @@ xml.feed("xmlns" => "http://www.w3.org/2005/Atom",
45
45
  # updated is required, for now we'll just set it to now, sorry
46
46
  xml.updated Time.now.strftime("%Y-%m-%dT%H:%M:%SZ")
47
47
 
48
- @document_list.each_with_index do |doc, document_counter|
49
- xml.entry do
50
- xml.title doc.to_semantic_values[:title][0] || doc.id
51
-
52
- # updated is required, for now we'll just set it to now, sorry
53
- xml.updated Time.now.strftime("%Y-%m-%dT%H:%M:%SZ")
54
-
55
- xml.link "rel" => "alternate", "type" => "text/html", "href" => polymorphic_url(doc)
56
- # add other doc-specific formats, atom only lets us have one per
57
- # content type, so the first one in the list wins.
58
- xml << render_link_rel_alternates(doc, :unique => true)
59
-
60
- xml.id polymorphic_url(doc)
61
-
62
-
63
- if doc.to_semantic_values[:author][0]
64
- xml.author { xml.name(doc.to_semantic_values[:author][0]) }
65
- end
66
-
67
- with_format("html") do
68
- xml.summary "type" => "html" do
69
- xml.text! render_document_partial(doc,
70
- :index,
71
- :document_counter => document_counter)
72
- end
73
- end
74
-
75
- #If they asked for a format, give it to them.
76
- if (params["content_format"] &&
77
- doc.export_formats[params["content_format"].to_sym])
78
-
79
- type = doc.export_formats[params["content_format"].to_sym][:content_type]
80
-
81
- xml.content :type => type do |content_element|
82
- data = doc.export_as(params["content_format"])
83
-
84
- # encode properly. See:
85
- # http://tools.ietf.org/html/rfc4287#section-4.1.3.3
86
- type = type.downcase
87
- if (type.downcase =~ /\+|\/xml$/)
88
- # xml, just put it right in
89
- content_element << data
90
- elsif (type.downcase =~ /text\//)
91
- # text, escape
92
- content_element.text! data
93
- else
94
- #something else, base64 encode it
95
- content_element << Base64.encode64(data)
96
- end
97
- end
98
-
99
- end
100
-
101
-
102
- end
48
+ @document_list.each_with_index do |document, document_counter|
49
+ xml << Nokogiri::XML.fragment(render_document_partials(document, blacklight_config.view_config(:atom).partials, document_counter: document_counter))
103
50
  end
104
-
105
51
  end
106
52
 
107
53
 
@@ -7,12 +7,8 @@ xml.rss(:version=>"2.0") {
7
7
  xml.link(search_action_url(params))
8
8
  xml.description(t('blacklight.search.title', :application_name => application_name))
9
9
  xml.language('en-us')
10
- @document_list.each do |doc|
11
- xml.item do
12
- xml.title( doc.to_semantic_values[:title][0] || doc.id )
13
- xml.link(polymorphic_url(doc))
14
- xml.author( doc.to_semantic_values[:author][0] ) if doc.to_semantic_values[:author][0]
15
- end
10
+ @document_list.each_with_index do |document, document_counter|
11
+ xml << Nokogiri::XML.fragment(render_document_partials(document, blacklight_config.view_config(:rss).partials, document_counter: document_counter))
16
12
  end
17
13
 
18
14
  }
@@ -7,6 +7,9 @@
7
7
  <!-- Mobile viewport optimization h5bp.com/ad -->
8
8
  <meta name="HandheldFriendly" content="True">
9
9
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
10
+
11
+ <!-- Internet Explorer use the highest version available -->
12
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
10
13
 
11
14
  <!-- Mobile IE allows us to activate ClearType technology for smoothing fonts for easy reading -->
12
15
  <!--[if IEMobile]>
@@ -158,7 +158,11 @@ de:
158
158
  label: 'Suchen in'
159
159
  title: 'gezeilte Suchoptionen'
160
160
  post_label: 'für'
161
+ # i18n key 'q' is deprecated and will be removed in Blacklight 6.0, use 'search.label' and 'search.placeholder'
161
162
  q: 'Suchen...'
163
+ search:
164
+ label: 'suchen nach'
165
+ placeholder: 'Suchen...'
162
166
  submit: 'Suchen'
163
167
  pagination:
164
168
  title: 'Ergebnisse Navigation'
@@ -158,7 +158,11 @@ en:
158
158
  label: 'Search in'
159
159
  title: 'Targeted search options'
160
160
  post_label: 'for'
161
+ # i18n key 'q' is deprecated and will be removed in Blacklight 6.0, use 'search.label' and 'search.placeholder'
161
162
  q: 'Search...'
163
+ search:
164
+ label: 'search for'
165
+ placeholder: 'Search...'
162
166
  submit: 'Search'
163
167
  pagination:
164
168
  title: 'Results navigation'
@@ -158,7 +158,11 @@ es:
158
158
  label: 'Buscar en'
159
159
  title: 'Opciones de Búsqueda temática'
160
160
  post_label: 'para'
161
+ # i18n key 'q' is deprecated and will be removed in Blacklight 6.0, use 'search.label' and 'search.placeholder'
161
162
  q: 'Buscar...'
163
+ search:
164
+ label: 'buscar'
165
+ placeholder: 'Buscar...'
162
166
  submit: 'Buscar'
163
167
  pagination:
164
168
  title: 'Resultados de navegación'
@@ -171,7 +171,11 @@ fr:
171
171
  label: 'dans'
172
172
  title: 'Options de recherche'
173
173
  post_label: 'pour'
174
+ # i18n key 'q' is deprecated and will be removed in Blacklight 6.0, use 'search.label' and 'search.placeholder'
174
175
  q: 'Rechercher '
176
+ search:
177
+ label: 'Rechercher'
178
+ placeholder: 'Rechercher'
175
179
  submit: 'Chercher'
176
180
  pagination:
177
181
  title: 'Navigation dans les résultats'
@@ -178,7 +178,11 @@ pt-BR:
178
178
  label: 'Procurar em'
179
179
  title: 'Opções da Busca'
180
180
  post_label: 'por'
181
+ # i18n key 'q' is deprecated and will be removed in Blacklight 6.0, use 'search.label' and 'search.placeholder'
181
182
  q: 'Busca...'
183
+ search:
184
+ label: 'busca'
185
+ placeholder: 'Busca...'
182
186
  submit: 'Buscar'
183
187
  pagination:
184
188
  title: 'Navegação nos Resultados'
@@ -78,7 +78,16 @@ module Blacklight
78
78
  ),
79
79
  :navbar => OpenStructWithHashAccess.new(partials: { }),
80
80
  # Configurations for specific types of index views
81
- :view => NestedOpenStructWithHashAccess.new(ViewConfig, 'list'),
81
+ :view => NestedOpenStructWithHashAccess.new(ViewConfig,
82
+ 'list',
83
+ atom: {
84
+ if: false, # by default, atom should not show up as an alternative view
85
+ partials: [:document]
86
+ },
87
+ rss: {
88
+ if: false, # by default, rss should not show up as an alternative view
89
+ partials: [:document]
90
+ }),
82
91
  # Maxiumum number of spelling suggestions to offer
83
92
  :spell_max => 5,
84
93
  # Maximum number of results to show per page
@@ -20,7 +20,14 @@ module Blacklight
20
20
  # @param [SolrDocument] document
21
21
  # @return [String]
22
22
  def document_heading
23
- render_field_value(@document[@configuration.view_config(:show).title_field] || @document.id)
23
+ fields = Array(@configuration.view_config(:show).title_field)
24
+ f = fields.find { |field| @document.has? field }
25
+
26
+ if f.nil?
27
+ render_field_value(@document.id)
28
+ else
29
+ render_field_value(@document[f])
30
+ end
24
31
  end
25
32
 
26
33
  ##
@@ -31,7 +38,14 @@ module Blacklight
31
38
  # @return [String]
32
39
  def document_show_html_title
33
40
  if @configuration.view_config(:show).html_title_field
34
- render_field_value(@document[@configuration.view_config(:show).html_title_field])
41
+ fields = Array(@configuration.view_config(:show).html_title_field)
42
+ f = fields.find { |field| @document.has? field }
43
+
44
+ if f.nil?
45
+ render_field_value(@document.id)
46
+ else
47
+ render_field_value(@document[f])
48
+ end
35
49
  else
36
50
  document_heading
37
51
  end
@@ -41,6 +41,10 @@ class Blacklight::SolrResponse < HashWithIndifferentAccess
41
41
  params[:rows].to_i
42
42
  end
43
43
 
44
+ def sort
45
+ params[:sort]
46
+ end
47
+
44
48
  def docs
45
49
  @docs ||= begin
46
50
  response['docs'] || []
@@ -8,12 +8,12 @@ describe "Search Results context", js: true do
8
8
  search_id = Search.last.id.to_s
9
9
  click_on 'Pluvial nectar of blessings'
10
10
  expect(page).to have_content "« Previous | 10 of 30 | Next »"
11
- prev = page.find("#previousNextDocument .previous")
11
+ prev = page.find(".pagination-search-widgets .previous")
12
12
  expect(prev['data-context-href']).to eq "/catalog/2003546302/track?counter=9&search_id=#{search_id}"
13
13
 
14
14
  click_on "« Previous"
15
15
 
16
- prev = page.find("#previousNextDocument .previous")
16
+ prev = page.find(".pagination-search-widgets .previous")
17
17
  expect(prev['data-context-href']).to eq "/catalog/2004310986/track?counter=8&search_id=#{search_id}"
18
18
  end
19
19
 
@@ -23,6 +23,15 @@ describe "Search Results context", js: true do
23
23
  expect(page).to have_content "« Previous | 1 of 30 | Next »"
24
24
  expect(page.current_url).to_not have_content "/track"
25
25
  end
26
+
27
+ it 'should show "Back to Search" and "Start Over links"' do
28
+ search_for 'Bod kyi naṅ chos ṅo sprod sñiṅ bsdus'
29
+ first('.index_title a').click
30
+ within '.pagination-search-widgets' do
31
+ expect(page).to have_css 'a', text: 'Back to Search'
32
+ expect(page).to have_css 'a', text: 'Start Over'
33
+ end
34
+ end
26
35
 
27
36
  context "navigating between search results using context pagination" do
28
37
  it "should update the back to search link with the current search pagination context" do
@@ -88,6 +88,28 @@ describe BlacklightConfigurationHelper do
88
88
  end
89
89
  end
90
90
 
91
+ describe "#document_show_link_field" do
92
+ let(:document) { SolrDocument.new id: 123, a: 1, b: 2, c: 3 }
93
+
94
+ it "should allow single values" do
95
+ blacklight_config.index.title_field = :a
96
+ f = helper.document_show_link_field document
97
+ expect(f).to eq :a
98
+ end
99
+
100
+ it "should retrieve the first field with data" do
101
+ blacklight_config.index.title_field = [:zzz, :b]
102
+ f = helper.document_show_link_field document
103
+ expect(f).to eq :b
104
+ end
105
+
106
+ it "should fallback on the id" do
107
+ blacklight_config.index.title_field = [:zzz, :yyy]
108
+ f = helper.document_show_link_field document
109
+ expect(f).to eq 123
110
+ end
111
+ end
112
+
91
113
  describe "#index_field_label" do
92
114
  let(:document) { double }
93
115
  it "should look up the label to display for the given document and field" do
@@ -130,13 +130,15 @@ describe Blacklight::SolrResponse do
130
130
  raw_response = eval(mock_query_response)
131
131
  r = Blacklight::SolrResponse.new(raw_response, {})
132
132
  expect(r.params[:rows].to_s).to eq '11'
133
+ expect(r.params[:sort]).to eq 'title_sort asc, pub_date_sort desc'
133
134
  end
134
135
 
135
136
  it 'should provide the ruby request params if responseHeader["params"] does not exist' do
136
137
  raw_response = eval(mock_query_response)
137
138
  raw_response.delete 'responseHeader'
138
- r = Blacklight::SolrResponse.new(raw_response, :rows => 999)
139
+ r = Blacklight::SolrResponse.new(raw_response, :rows => 999, :sort => 'score desc, pub_date_sort desc, title_sort asc')
139
140
  expect(r.params[:rows].to_s).to eq '999'
141
+ expect(r.params[:sort]).to eq 'score desc, pub_date_sort desc, title_sort asc'
140
142
  end
141
143
 
142
144
  it 'should provide spelling suggestions for regular spellcheck results' do
@@ -193,7 +195,7 @@ describe Blacklight::SolrResponse do
193
195
  end
194
196
 
195
197
  def mock_query_response
196
- %({'responseHeader'=>{'status'=>0,'QTime'=>5,'params'=>{'facet.limit'=>'10','wt'=>'ruby','rows'=>'11','facet'=>'true','facet.field'=>['cat','manu'],'echoParams'=>'EXPLICIT','q'=>'*:*','facet.sort'=>'true'}},'response'=>{'numFound'=>26,'start'=>0,'docs'=>[{'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2009-03-20T14:42:49.795Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']},{'id'=>'6H500F0','inStock'=>true,'manu'=>'Maxtor Corp.','name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300','popularity'=>6,'price'=>350.0,'sku'=>'6H500F0','timestamp'=>'2009-03-20T14:42:49.877Z','cat'=>['electronics','hard drive'],'spell'=>['Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300'],'features'=>['SATA 3.0Gb/s, NCQ','8.5ms seek','16MB cache']},{'id'=>'F8V7067-APL-KIT','inStock'=>false,'manu'=>'Belkin','name'=>'Belkin Mobile Power Cord for iPod w/ Dock','popularity'=>1,'price'=>19.95,'sku'=>'F8V7067-APL-KIT','timestamp'=>'2009-03-20T14:42:49.937Z','weight'=>4.0,'cat'=>['electronics','connector'],'spell'=>['Belkin Mobile Power Cord for iPod w/ Dock'],'features'=>['car power adapter, white']},{'id'=>'IW-02','inStock'=>false,'manu'=>'Belkin','name'=>'iPod & iPod Mini USB 2.0 Cable','popularity'=>1,'price'=>11.5,'sku'=>'IW-02','timestamp'=>'2009-03-20T14:42:49.944Z','weight'=>2.0,'cat'=>['electronics','connector'],'spell'=>['iPod & iPod Mini USB 2.0 Cable'],'features'=>['car power adapter for iPod, white']},{'id'=>'MA147LL/A','inStock'=>true,'includes'=>'earbud headphones, USB cable','manu'=>'Apple Computer Inc.','name'=>'Apple 60 GB iPod with Video Playback Black','popularity'=>10,'price'=>399.0,'sku'=>'MA147LL/A','timestamp'=>'2009-03-20T14:42:49.962Z','weight'=>5.5,'cat'=>['electronics','music'],'spell'=>['Apple 60 GB iPod with Video Playback Black'],'features'=>['iTunes, Podcasts, Audiobooks','Stores up to 15,000 songs, 25,000 photos, or 150 hours of video','2.5-inch, 320x240 color TFT LCD display with LED backlight','Up to 20 hours of battery life','Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video','Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication']},{'id'=>'TWINX2048-3200PRO','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail','popularity'=>5,'price'=>185.0,'sku'=>'TWINX2048-3200PRO','timestamp'=>'2009-03-20T14:42:49.99Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail'],'features'=>['CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader']},{'id'=>'VS1GB400C3','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail','popularity'=>7,'price'=>74.99,'sku'=>'VS1GB400C3','timestamp'=>'2009-03-20T14:42:50Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail']},{'id'=>'VDBDB1A16','inStock'=>true,'manu'=>'A-DATA Technology Inc.','name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM','popularity'=>5,'sku'=>'VDBDB1A16','timestamp'=>'2009-03-20T14:42:50.004Z','cat'=>['electronics','memory'],'spell'=>['A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM'],'features'=>['CAS latency 3, 2.7v']},{'id'=>'3007WFP','inStock'=>true,'includes'=>'USB cable','manu'=>'Dell, Inc.','name'=>'Dell Widescreen UltraSharp 3007WFP','popularity'=>6,'price'=>2199.0,'sku'=>'3007WFP','timestamp'=>'2009-03-20T14:42:50.017Z','weight'=>401.6,'cat'=>['electronics','monitor'],'spell'=>['Dell Widescreen UltraSharp 3007WFP'],'features'=>['30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast']},{'id'=>'VA902B','inStock'=>true,'manu'=>'ViewSonic Corp.','name'=>'ViewSonic VA902B - flat panel display - TFT - 19"','popularity'=>6,'price'=>279.95,'sku'=>'VA902B','timestamp'=>'2009-03-20T14:42:50.034Z','weight'=>190.4,'cat'=>['electronics','monitor'],'spell'=>['ViewSonic VA902B - flat panel display - TFT - 19"'],'features'=>['19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution']},{'id'=>'0579B002','inStock'=>true,'manu'=>'Canon Inc.','name'=>'Canon PIXMA MP500 All-In-One Photo Printer','popularity'=>6,'price'=>179.99,'sku'=>'0579B002','timestamp'=>'2009-03-20T14:42:50.062Z','weight'=>352.0,'cat'=>['electronics','multifunction printer','printer','scanner','copier'],'spell'=>['Canon PIXMA MP500 All-In-One Photo Printer'],'features'=>['Multifunction ink-jet color photo printer','Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi','2.5" color LCD preview screen','Duplex Copying','Printing speed up to 29ppm black, 19ppm color','Hi-Speed USB','memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard']}]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'cat'=>['electronics',14,'memory',3,'card',2,'connector',2,'drive',2,'graphics',2,'hard',2,'monitor',2,'search',2,'software',2],'manu'=>['inc',8,'apach',2,'belkin',2,'canon',2,'comput',2,'corp',2,'corsair',2,'foundat',2,'microsystem',2,'softwar',2]},'facet_dates'=>{}}})
198
+ %({'responseHeader'=>{'status'=>0,'QTime'=>5,'params'=>{'facet.limit'=>'10','wt'=>'ruby','rows'=>'11','facet'=>'true','facet.field'=>['cat','manu'],'echoParams'=>'EXPLICIT','q'=>'*:*','facet.sort'=>'true', 'sort'=>'title_sort asc, pub_date_sort desc'}},'response'=>{'numFound'=>26,'start'=>0,'docs'=>[{'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2009-03-20T14:42:49.795Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']},{'id'=>'6H500F0','inStock'=>true,'manu'=>'Maxtor Corp.','name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300','popularity'=>6,'price'=>350.0,'sku'=>'6H500F0','timestamp'=>'2009-03-20T14:42:49.877Z','cat'=>['electronics','hard drive'],'spell'=>['Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300'],'features'=>['SATA 3.0Gb/s, NCQ','8.5ms seek','16MB cache']},{'id'=>'F8V7067-APL-KIT','inStock'=>false,'manu'=>'Belkin','name'=>'Belkin Mobile Power Cord for iPod w/ Dock','popularity'=>1,'price'=>19.95,'sku'=>'F8V7067-APL-KIT','timestamp'=>'2009-03-20T14:42:49.937Z','weight'=>4.0,'cat'=>['electronics','connector'],'spell'=>['Belkin Mobile Power Cord for iPod w/ Dock'],'features'=>['car power adapter, white']},{'id'=>'IW-02','inStock'=>false,'manu'=>'Belkin','name'=>'iPod & iPod Mini USB 2.0 Cable','popularity'=>1,'price'=>11.5,'sku'=>'IW-02','timestamp'=>'2009-03-20T14:42:49.944Z','weight'=>2.0,'cat'=>['electronics','connector'],'spell'=>['iPod & iPod Mini USB 2.0 Cable'],'features'=>['car power adapter for iPod, white']},{'id'=>'MA147LL/A','inStock'=>true,'includes'=>'earbud headphones, USB cable','manu'=>'Apple Computer Inc.','name'=>'Apple 60 GB iPod with Video Playback Black','popularity'=>10,'price'=>399.0,'sku'=>'MA147LL/A','timestamp'=>'2009-03-20T14:42:49.962Z','weight'=>5.5,'cat'=>['electronics','music'],'spell'=>['Apple 60 GB iPod with Video Playback Black'],'features'=>['iTunes, Podcasts, Audiobooks','Stores up to 15,000 songs, 25,000 photos, or 150 hours of video','2.5-inch, 320x240 color TFT LCD display with LED backlight','Up to 20 hours of battery life','Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video','Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication']},{'id'=>'TWINX2048-3200PRO','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail','popularity'=>5,'price'=>185.0,'sku'=>'TWINX2048-3200PRO','timestamp'=>'2009-03-20T14:42:49.99Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail'],'features'=>['CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader']},{'id'=>'VS1GB400C3','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail','popularity'=>7,'price'=>74.99,'sku'=>'VS1GB400C3','timestamp'=>'2009-03-20T14:42:50Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail']},{'id'=>'VDBDB1A16','inStock'=>true,'manu'=>'A-DATA Technology Inc.','name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM','popularity'=>5,'sku'=>'VDBDB1A16','timestamp'=>'2009-03-20T14:42:50.004Z','cat'=>['electronics','memory'],'spell'=>['A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM'],'features'=>['CAS latency 3, 2.7v']},{'id'=>'3007WFP','inStock'=>true,'includes'=>'USB cable','manu'=>'Dell, Inc.','name'=>'Dell Widescreen UltraSharp 3007WFP','popularity'=>6,'price'=>2199.0,'sku'=>'3007WFP','timestamp'=>'2009-03-20T14:42:50.017Z','weight'=>401.6,'cat'=>['electronics','monitor'],'spell'=>['Dell Widescreen UltraSharp 3007WFP'],'features'=>['30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast']},{'id'=>'VA902B','inStock'=>true,'manu'=>'ViewSonic Corp.','name'=>'ViewSonic VA902B - flat panel display - TFT - 19"','popularity'=>6,'price'=>279.95,'sku'=>'VA902B','timestamp'=>'2009-03-20T14:42:50.034Z','weight'=>190.4,'cat'=>['electronics','monitor'],'spell'=>['ViewSonic VA902B - flat panel display - TFT - 19"'],'features'=>['19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution']},{'id'=>'0579B002','inStock'=>true,'manu'=>'Canon Inc.','name'=>'Canon PIXMA MP500 All-In-One Photo Printer','popularity'=>6,'price'=>179.99,'sku'=>'0579B002','timestamp'=>'2009-03-20T14:42:50.062Z','weight'=>352.0,'cat'=>['electronics','multifunction printer','printer','scanner','copier'],'spell'=>['Canon PIXMA MP500 All-In-One Photo Printer'],'features'=>['Multifunction ink-jet color photo printer','Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi','2.5" color LCD preview screen','Duplex Copying','Printing speed up to 29ppm black, 19ppm color','Hi-Speed USB','memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard']}]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'cat'=>['electronics',14,'memory',3,'card',2,'connector',2,'drive',2,'graphics',2,'hard',2,'monitor',2,'search',2,'software',2],'manu'=>['inc',8,'apach',2,'belkin',2,'canon',2,'comput',2,'corp',2,'corsair',2,'foundat',2,'microsystem',2,'softwar',2]},'facet_dates'=>{}}})
197
199
  end
198
200
 
199
201
  # These spellcheck responses are all Solr 1.4 responses
@@ -213,4 +213,48 @@ describe Blacklight::DocumentPresenter do
213
213
  expect(subject.render_field_value('a', double(:separator => nil, :itemprop => 'some-prop'))).to have_selector("span[@itemprop='some-prop']", :text => "a")
214
214
  end
215
215
  end
216
+
217
+ describe "#document_heading" do
218
+ it "should fallback to an id" do
219
+ allow(document).to receive(:id).and_return "xyz"
220
+ expect(subject.document_heading).to eq document.id
221
+ end
222
+
223
+ it "should return the value of the field" do
224
+ config.show.title_field = :x
225
+ allow(document).to receive(:has?).with(:x).and_return(true)
226
+ allow(document).to receive(:[]).with(:x).and_return("value")
227
+ expect(subject.document_heading).to eq "value"
228
+ end
229
+
230
+ it "should return the first present value" do
231
+ config.show.title_field = [:x, :y]
232
+ allow(document).to receive(:has?).with(:x).and_return(false)
233
+ allow(document).to receive(:has?).with(:y).and_return(true)
234
+ allow(document).to receive(:[]).with(:y).and_return("value")
235
+ expect(subject.document_heading).to eq "value"
236
+ end
237
+ end
238
+
239
+ describe "#document_show_html_title" do
240
+ it "should fallback to an id" do
241
+ allow(document).to receive(:id).and_return "xyz"
242
+ expect(subject.document_show_html_title).to eq document.id
243
+ end
244
+
245
+ it "should return the value of the field" do
246
+ config.show.html_title_field = :x
247
+ allow(document).to receive(:has?).with(:x).and_return(true)
248
+ allow(document).to receive(:[]).with(:x).and_return("value")
249
+ expect(subject.document_show_html_title).to eq "value"
250
+ end
251
+
252
+ it "should return the first present value" do
253
+ config.show.html_title_field = [:x, :y]
254
+ allow(document).to receive(:has?).with(:x).and_return(false)
255
+ allow(document).to receive(:has?).with(:y).and_return(true)
256
+ allow(document).to receive(:[]).with(:y).and_return("value")
257
+ expect(subject.document_show_html_title).to eq "value"
258
+ end
259
+ end
216
260
  end
@@ -13,6 +13,7 @@ describe "catalog/show.html.erb" do
13
13
  before :each do
14
14
  allow(view).to receive_messages(:has_user_authentication_provider? => false)
15
15
  allow(view).to receive_messages(:render_document_sidebar_partial => "Sidebar")
16
+ allow(view).to receive_messages(current_search_session: nil)
16
17
  assign :document, document
17
18
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
18
19
  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: 5.8.2
4
+ version: 5.9.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: 2014-12-29 00:00:00.000000000 Z
20
+ date: 2015-01-30 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -323,6 +323,8 @@ files:
323
323
  - app/views/catalog/_did_you_mean.html.erb
324
324
  - app/views/catalog/_document.html.erb
325
325
  - app/views/catalog/_document_action.html.erb
326
+ - app/views/catalog/_document_default.atom.builder
327
+ - app/views/catalog/_document_default.rss.builder
326
328
  - app/views/catalog/_document_list.html.erb
327
329
  - app/views/catalog/_email_form.html.erb
328
330
  - app/views/catalog/_facet_layout.html.erb
@@ -574,7 +576,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
574
576
  version: '0'
575
577
  requirements: []
576
578
  rubyforge_project:
577
- rubygems_version: 2.2.2
579
+ rubygems_version: 2.4.5
578
580
  signing_key:
579
581
  specification_version: 4
580
582
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)