blacklight 5.16.3 → 5.16.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/controllers/concerns/blacklight/search_helper.rb +3 -3
- data/app/helpers/blacklight/catalog_helper_behavior.rb +3 -1
- data/app/helpers/blacklight/layout_helper_behavior.rb +8 -0
- data/app/presenters/blacklight/document_presenter.rb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -1
- data/app/views/shared/_header_navbar.html.erb +2 -2
- data/lib/blacklight.rb +16 -2
- data/spec/helpers/blacklight_helper_spec.rb +3 -3
- data/spec/helpers/catalog_helper_spec.rb +8 -0
- data/spec/helpers/layout_helper_spec.rb +7 -0
- data/spec/presenters/document_presenter_spec.rb +28 -0
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e56b20bdd2b2230a8c427bd8a71188499ecadefd
|
4
|
+
data.tar.gz: f7b4394bde76c526e48d7305f1b0f40c094d2ea4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cee2f321d52e3b5733cbfcecf0c2fcf74f584e6a86e482ae5a67b0aad858b07e9d926b8b8778ca9aa5ce2147b0f98c6c5766fb5c3a6ea8e48a1d142653de09e
|
7
|
+
data.tar.gz: 9d6aeb7047e02b917ab07c08847b646a5e952c46c74e56cef99524a94ed4d444b474fda2b57914b7c588a46cb8a313381a885d0a97ef19da8b5d2b955b45abf7
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec path: File.expand_path('..', __FILE__)
|
5
5
|
|
6
6
|
gem 'simplecov', '~> 0.10', require: false
|
7
|
-
gem 'coveralls', require: false
|
7
|
+
gem 'coveralls', '~> 0.8.6', require: false
|
8
8
|
|
9
9
|
group :test do
|
10
10
|
gem "blacklight-marc", "~> 5.0", github: "projectblacklight/blacklight_marc"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.16.
|
1
|
+
5.16.4
|
@@ -54,7 +54,7 @@ module Blacklight::SearchHelper
|
|
54
54
|
##
|
55
55
|
# Execute a solr query
|
56
56
|
# @see [Blacklight::SolrRepository#send_and_receive]
|
57
|
-
# @return [Blacklight::
|
57
|
+
# @return [Blacklight::Solr::Response] the solr response object
|
58
58
|
def find *args
|
59
59
|
request_params = args.extract_options!
|
60
60
|
path = args.first || blacklight_config.solr_path
|
@@ -121,7 +121,7 @@ module Blacklight::SearchHelper
|
|
121
121
|
# a solr query method
|
122
122
|
# @param [Hash,HashWithIndifferentAccess] user_params ({}) the user provided parameters (e.g. query, facets, sort, etc)
|
123
123
|
# @param [Hash,HashWithIndifferentAccess] extra_controller_params ({}) extra parameters to add to the search
|
124
|
-
# @return [Blacklight::
|
124
|
+
# @return [Blacklight::Solr::Response] the solr response object
|
125
125
|
def query_solr(user_params = params || {}, extra_controller_params = {})
|
126
126
|
query = search_builder.with(user_params).merge(extra_controller_params)
|
127
127
|
repository.search(query)
|
@@ -146,7 +146,7 @@ module Blacklight::SearchHelper
|
|
146
146
|
deprecation_deprecate get_solr_response_for_doc_id: "use fetch(id) instead"
|
147
147
|
|
148
148
|
# given a field name and array of values, get the matching SOLR documents
|
149
|
-
# @return [Blacklight::
|
149
|
+
# @return [Blacklight::Solr::Response, Array<Blacklight::SolrDocument>] the solr response object and a list of solr documents
|
150
150
|
def get_solr_response_for_field_values(field, values, extra_controller_params = {})
|
151
151
|
query = Deprecation.silence(Blacklight::RequestBuilders) do
|
152
152
|
search_builder.with(params).merge(extra_controller_params).merge(solr_documents_by_field_values_params(field, values))
|
@@ -181,7 +181,9 @@ module Blacklight::CatalogHelperBehavior
|
|
181
181
|
value = if blacklight_config.view_config(document_index_view_type).thumbnail_method
|
182
182
|
send(blacklight_config.view_config(document_index_view_type).thumbnail_method, document, image_options)
|
183
183
|
elsif blacklight_config.view_config(document_index_view_type).thumbnail_field
|
184
|
-
|
184
|
+
url = thumbnail_url(document)
|
185
|
+
|
186
|
+
image_tag url, image_options if url.present?
|
185
187
|
end
|
186
188
|
|
187
189
|
if value
|
@@ -30,5 +30,13 @@ module Blacklight
|
|
30
30
|
def sidebar_classes
|
31
31
|
'col-md-3 col-sm-4'
|
32
32
|
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Class used for specifying main layout container classes. Can be
|
36
|
+
# overwritten to return 'container-fluid' for Bootstrap full-width layout
|
37
|
+
# @return [String]
|
38
|
+
def container_classes
|
39
|
+
'container'
|
40
|
+
end
|
33
41
|
end
|
34
42
|
end
|
@@ -192,7 +192,7 @@ module Blacklight
|
|
192
192
|
# rendering values
|
193
193
|
case
|
194
194
|
when (field_config and field_config.helper_method)
|
195
|
-
@controller.send(field_config.helper_method, options.merge(:
|
195
|
+
@controller.send(field_config.helper_method, options.merge(document: @document, field: field, config: field_config, value: value))
|
196
196
|
when (field_config and field_config.link_to_search)
|
197
197
|
link_field = if field_config.link_to_search === true
|
198
198
|
field_config.key
|
@@ -35,7 +35,7 @@
|
|
35
35
|
|
36
36
|
<%= render partial: 'shared/ajax_modal' %>
|
37
37
|
|
38
|
-
<div id="main-container" class="
|
38
|
+
<div id="main-container" class="<%= container_classes %>">
|
39
39
|
<%= content_tag :h1, application_name, class: 'sr-only application-heading' %>
|
40
40
|
|
41
41
|
<%= render :partial=>'/flash_msg', layout: 'shared/flash_messages' %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="header-navbar" class="navbar navbar-inverse navbar-static-top" role="navigation">
|
2
|
-
<div class="
|
2
|
+
<div class="<%= container_classes %>">
|
3
3
|
<div class="navbar-header">
|
4
4
|
<button type="button" class="navbar-toggle btn collapsed" data-toggle="collapse" data-target="#user-util-collapse">
|
5
5
|
<span class="sr-only">Toggle navigation</span>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<div id="search-navbar" class="navbar navbar-default navbar-static-top" role="navigation">
|
20
|
-
<div class="
|
20
|
+
<div class="<%= container_classes %>">
|
21
21
|
<%= render_search_bar %>
|
22
22
|
</div>
|
23
23
|
</div>
|
data/lib/blacklight.rb
CHANGED
@@ -8,8 +8,6 @@ module Blacklight
|
|
8
8
|
autoload :Routes, 'blacklight/routes'
|
9
9
|
autoload :Solr, 'blacklight/solr'
|
10
10
|
|
11
|
-
SolrRepository = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Blacklight::SolrRepository', 'Blacklight::Solr::Repository')
|
12
|
-
SolrResponse = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Blacklight::SolrResponse', 'Blacklight::Solr::Response')
|
13
11
|
autoload :SolrHelper, 'blacklight/solr_helper'
|
14
12
|
|
15
13
|
autoload :AbstractRepository, 'blacklight/abstract_repository'
|
@@ -25,6 +23,22 @@ module Blacklight
|
|
25
23
|
attr_accessor :solr, :solr_config
|
26
24
|
end
|
27
25
|
|
26
|
+
class SolrRepository < Solr::Repository
|
27
|
+
extend Deprecation
|
28
|
+
def initialize blacklight_config
|
29
|
+
Deprecation.warn(self, 'Blacklight::SolrRepository is deprecated; use Blacklight::Solr::Repository instead')
|
30
|
+
super
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class SolrResponse < Solr::Response
|
35
|
+
extend Deprecation
|
36
|
+
def initialize(data, request_params, options = {})
|
37
|
+
Deprecation.warn(self, 'Blacklight::SolrResponse is deprecated; use Blacklight::Solr::Response instead')
|
38
|
+
super
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
28
42
|
# Secret key used to share session information with
|
29
43
|
# other services (e.g. refworks callback urls)
|
30
44
|
mattr_accessor :secret_key
|
@@ -239,13 +239,13 @@ describe BlacklightHelper do
|
|
239
239
|
|
240
240
|
describe "render_grouped_response?" do
|
241
241
|
it "should check if the response ivar contains grouped data" do
|
242
|
-
assign(:response, double("
|
242
|
+
assign(:response, double("Solr::Response", :grouped? => true))
|
243
243
|
expect(helper.render_grouped_response?).to be true
|
244
244
|
end
|
245
245
|
|
246
246
|
|
247
247
|
it "should check if the response param contains grouped data" do
|
248
|
-
response = double("
|
248
|
+
response = double("Solr::Response", :grouped? => true)
|
249
249
|
expect(helper.render_grouped_response?(response)).to be true
|
250
250
|
end
|
251
251
|
end
|
@@ -417,7 +417,7 @@ describe BlacklightHelper do
|
|
417
417
|
|
418
418
|
before do
|
419
419
|
allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
420
|
-
assign(:response, double("
|
420
|
+
assign(:response, double("Solr::Response", grouped?: false, start: 0))
|
421
421
|
allow(helper).to receive(:link_to_document).and_return('<a/>')
|
422
422
|
allow(helper).to receive(:render_index_doc_actions).and_return('<div/>')
|
423
423
|
end
|
@@ -226,6 +226,14 @@ describe CatalogHelper do
|
|
226
226
|
|
227
227
|
expect(helper.render_thumbnail_tag document).to be_nil
|
228
228
|
end
|
229
|
+
|
230
|
+
it "should return nil if no thumbnail is in the document" do
|
231
|
+
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new(:index => Blacklight::OpenStructWithHashAccess.new(:thumbnail_field => :xyz) ))
|
232
|
+
|
233
|
+
allow(document).to receive(:has?).with(:xyz).and_return(false)
|
234
|
+
|
235
|
+
expect(helper.render_thumbnail_tag document).to be_nil
|
236
|
+
end
|
229
237
|
end
|
230
238
|
|
231
239
|
describe "thumbnail_url" do
|
@@ -28,4 +28,11 @@ describe LayoutHelper do
|
|
28
28
|
expect(helper.sidebar_classes).to eq 'col-md-3 col-sm-4'
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
describe '#container_classes' do
|
33
|
+
it 'returns a string of classe(s)' do
|
34
|
+
expect(helper.container_classes).to be_an String
|
35
|
+
expect(helper.container_classes).to eq 'container'
|
36
|
+
end
|
37
|
+
end
|
31
38
|
end
|
@@ -334,4 +334,32 @@ describe Blacklight::DocumentPresenter do
|
|
334
334
|
expect(subject.document_show_html_title).to eq "value"
|
335
335
|
end
|
336
336
|
end
|
337
|
+
|
338
|
+
describe '#get_field_values' do
|
339
|
+
context 'for a field with the helper_method option' do
|
340
|
+
let(:field_name) { 'field_with_helper' }
|
341
|
+
let(:field_config) { config.add_facet_field 'field_with_helper', helper_method: 'render_field_with_helper' }
|
342
|
+
|
343
|
+
before do
|
344
|
+
document['field_with_helper'] = 'value'
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should check call the helper method with arguments" do
|
348
|
+
allow(request_context).to receive(:render_field_with_helper) do |*args|
|
349
|
+
args.first
|
350
|
+
end
|
351
|
+
|
352
|
+
render_options = { a: 1 }
|
353
|
+
|
354
|
+
options = subject.get_field_values field_name, field_config, a: 1
|
355
|
+
|
356
|
+
expect(options).to include :document, :field, :value, :config, :a
|
357
|
+
expect(options[:document]).to eq document
|
358
|
+
expect(options[:field]).to eq 'field_with_helper'
|
359
|
+
expect(options[:value]).to eq 'value'
|
360
|
+
expect(options[:config]).to eq field_config
|
361
|
+
expect(options[:a]).to eq 1
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|
337
365
|
end
|
@@ -14,7 +14,7 @@ describe "catalog/_sort_and_per_page" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should render the pagination, sort, per page and view type controls" do
|
17
|
-
assign(:response, double("
|
17
|
+
assign(:response, double("Solr::Response", limit_value: 1))
|
18
18
|
stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
|
19
19
|
stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
|
20
20
|
stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
|
@@ -27,7 +27,7 @@ describe "catalog/_sort_and_per_page" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should not render the pagination controls with bad limit values" do
|
30
|
-
assign(:response, double("
|
30
|
+
assign(:response, double("Solr::Response", limit_value: 0))
|
31
31
|
stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
|
32
32
|
stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
|
33
33
|
stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
|
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.16.
|
4
|
+
version: 5.16.4
|
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: 2015-11-
|
20
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|