blacklight 5.11.2 → 5.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/url_helper_behavior.rb +6 -1
- data/app/views/catalog/_sms_form.html.erb +1 -1
- data/lib/blacklight/configuration/facet_field.rb +1 -1
- data/lib/blacklight/configuration/search_field.rb +1 -1
- data/lib/blacklight/document.rb +19 -5
- data/spec/helpers/configuration_helper_spec.rb +7 -0
- data/spec/helpers/url_helper_spec.rb +11 -0
- data/spec/lib/blacklight/configuration_spec.rb +33 -6
- 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: d66f63cc8f730572a615a21e6e02c6f2bec32a04
|
4
|
+
data.tar.gz: 0e0a72eaec2d8ac932f37c96cff9c3482e1c884d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cfd5cd4a3c90a7f88aace8b30f706adc7a932ae8f1b49f30464051fddaf35cc48de2259c307d6501d4e555c934c4196ed5a841cac232d97cca1322ea1c146fb
|
7
|
+
data.tar.gz: 87e32807796642701f8891a2fb8c2ae6027bc8fc1b24d9e2dc1e3fe66387c6c4710af5ae306e0ef2bf3258b3f055ceb8d915729c4b9b1d35c53c35979cb103ca
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.11.
|
1
|
+
5.11.3
|
@@ -118,7 +118,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
118
118
|
# @param [Symbol] any number of additional keys
|
119
119
|
# @param [Symbol] ...
|
120
120
|
def field_label *i18n_keys
|
121
|
-
first, *rest = i18n_keys
|
121
|
+
first, *rest = i18n_keys.compact
|
122
122
|
|
123
123
|
t(first, default: rest)
|
124
124
|
end
|
@@ -82,10 +82,15 @@ module Blacklight::UrlHelperBehavior
|
|
82
82
|
return {}
|
83
83
|
end
|
84
84
|
|
85
|
-
{ :data => {:'context-href' =>
|
85
|
+
{ :data => {:'context-href' => session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id))}}
|
86
86
|
end
|
87
87
|
protected :session_tracking_params
|
88
88
|
|
89
|
+
##
|
90
|
+
# Get the URL for tracking search sessions across pages using polymorphic routing
|
91
|
+
def session_tracking_path document, params = {}
|
92
|
+
polymorphic_path([:track, document], params)
|
93
|
+
end
|
89
94
|
|
90
95
|
#
|
91
96
|
# link based helpers ->
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Blacklight
|
2
2
|
class Configuration::SearchField < Blacklight::Configuration::Field
|
3
3
|
def normalize! blacklight_config = nil
|
4
|
-
self.if
|
4
|
+
self.if = self.include_in_simple_select if self.if.nil?
|
5
5
|
|
6
6
|
super
|
7
7
|
self.qt ||= blacklight_config.default_solr_params[:qt] if blacklight_config && blacklight_config.default_solr_params
|
data/lib/blacklight/document.rb
CHANGED
@@ -31,7 +31,7 @@ module Blacklight::Document
|
|
31
31
|
include Blacklight::Document::Extensions
|
32
32
|
end
|
33
33
|
|
34
|
-
attr_reader :response
|
34
|
+
attr_reader :response, :_source
|
35
35
|
alias_method :solr_response, :response
|
36
36
|
|
37
37
|
def initialize(source_doc={}, response=nil)
|
@@ -52,11 +52,19 @@ module Blacklight::Document
|
|
52
52
|
# If a method is missing, it gets sent to @_source
|
53
53
|
# with all of the original params and block
|
54
54
|
def method_missing(m, *args, &b)
|
55
|
-
|
55
|
+
if _source and _source.respond_to? m
|
56
|
+
_source.send(m, *args, &b)
|
57
|
+
else
|
58
|
+
super
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def respond_to_missing? *args
|
63
|
+
(_source && _source.respond_to?(*args)) || super
|
56
64
|
end
|
57
65
|
|
58
66
|
def [] *args
|
59
|
-
|
67
|
+
_source.send :[], *args
|
60
68
|
end
|
61
69
|
|
62
70
|
def _read_attribute(attr)
|
@@ -85,7 +93,7 @@ module Blacklight::Document
|
|
85
93
|
end
|
86
94
|
|
87
95
|
def key? k
|
88
|
-
|
96
|
+
_source.key? k
|
89
97
|
end
|
90
98
|
|
91
99
|
# helper
|
@@ -116,7 +124,7 @@ module Blacklight::Document
|
|
116
124
|
end
|
117
125
|
|
118
126
|
def as_json(options = nil)
|
119
|
-
|
127
|
+
_source.as_json(options)
|
120
128
|
end
|
121
129
|
|
122
130
|
def to_partial_path
|
@@ -139,6 +147,12 @@ module Blacklight::Document
|
|
139
147
|
nil
|
140
148
|
end
|
141
149
|
|
150
|
+
##
|
151
|
+
# Implementations that support More-Like-This should override this method
|
152
|
+
# to return an array of documents that are like this one.
|
153
|
+
def more_like_this
|
154
|
+
[]
|
155
|
+
end
|
142
156
|
|
143
157
|
# Certain class-level methods needed for the document-specific
|
144
158
|
# extendability architecture
|
@@ -159,6 +159,13 @@ describe BlacklightConfigurationHelper do
|
|
159
159
|
|
160
160
|
label = helper.field_label :key_a, :key_b, "default text"
|
161
161
|
end
|
162
|
+
|
163
|
+
it "should compact nil keys (fixes rails/rails#19419)" do
|
164
|
+
allow(helper).to receive(:t).with(:key_a, default: [:key_b])
|
165
|
+
|
166
|
+
label = helper.field_label :key_a, nil, :key_b
|
167
|
+
|
168
|
+
end
|
162
169
|
end
|
163
170
|
|
164
171
|
describe "#default_per_page" do
|
@@ -499,4 +499,15 @@ describe BlacklightUrlHelper do
|
|
499
499
|
expect(url).to eq helper.bookmarks_url(format: :html, encrypted_user_id: 'xyz')
|
500
500
|
end
|
501
501
|
end
|
502
|
+
|
503
|
+
describe "#session_tracking_path" do
|
504
|
+
let(:document) { SolrDocument.new(id: 1) }
|
505
|
+
it "should determine the correct route for the document class" do
|
506
|
+
expect(helper.session_tracking_path(document)).to eq helper.track_solr_document_path(document)
|
507
|
+
end
|
508
|
+
|
509
|
+
it "should pass through tracking parameters" do
|
510
|
+
expect(helper.session_tracking_path(document, x: 1)).to eq helper.track_solr_document_path(document, x: 1)
|
511
|
+
end
|
512
|
+
end
|
502
513
|
end
|
@@ -213,11 +213,25 @@ describe "Blacklight::Configuration" do
|
|
213
213
|
"another_field_facet" => {},
|
214
214
|
"a_facet_field" => {},
|
215
215
|
})
|
216
|
-
expect { |b| @config.
|
217
|
-
|
218
|
-
expect(@config.index_fields.keys).to eq ["some_field_facet", "another_field_facet"]
|
216
|
+
expect { |b| @config.add_facet_field "*_facet", &b }.to yield_control.twice
|
217
|
+
expect(@config.facet_fields.keys).to eq ["some_field_facet", "another_field_facet"]
|
219
218
|
end
|
220
219
|
|
220
|
+
describe "if/unless conditions with legacy show parameter" do
|
221
|
+
it "should be hidden if the if condition is false" do
|
222
|
+
expect(@config.add_facet_field("hidden", if: false).if).to eq false
|
223
|
+
expect(@config.add_facet_field("hidden_with_legacy", if: false, show: true).if).to eq false
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should be true if the if condition is true" do
|
227
|
+
expect(@config.add_facet_field("hidden", if: true).if).to eq true
|
228
|
+
expect(@config.add_facet_field("hidden_with_legacy", if: true, show: false).if).to eq true
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should be true if the if condition is missing" do
|
232
|
+
expect(@config.add_facet_field("hidden", show: true).if).to eq true
|
233
|
+
end
|
234
|
+
end
|
221
235
|
end
|
222
236
|
|
223
237
|
describe "add_index_field" do
|
@@ -261,7 +275,6 @@ describe "Blacklight::Configuration" do
|
|
261
275
|
|
262
276
|
expect(@config.index_fields.keys).to eq ["some_field_display", "another_field_display"]
|
263
277
|
end
|
264
|
-
|
265
278
|
end
|
266
279
|
|
267
280
|
describe "add_show_field" do
|
@@ -370,8 +383,22 @@ describe "Blacklight::Configuration" do
|
|
370
383
|
|
371
384
|
expect(@config.search_fields["author_name"].label).to eq "Author Name"
|
372
385
|
end
|
373
|
-
|
374
|
-
|
386
|
+
|
387
|
+
describe "if/unless conditions with legacy include_in_simple_search" do
|
388
|
+
it "should be hidden if the if condition is false" do
|
389
|
+
expect(@config.add_search_field("hidden", if: false).if).to eq false
|
390
|
+
expect(@config.add_search_field("hidden_with_legacy", if: false, include_in_simple_search: true).if).to eq false
|
391
|
+
end
|
392
|
+
|
393
|
+
it "should be true if the if condition is true" do
|
394
|
+
expect(@config.add_search_field("hidden", if: true).if).to eq true
|
395
|
+
expect(@config.add_search_field("hidden_with_legacy", if: true, include_in_simple_search: false).if).to eq true
|
396
|
+
end
|
397
|
+
|
398
|
+
it "should be true if the if condition is missing" do
|
399
|
+
expect(@config.add_search_field("hidden", include_in_simple_search: true).if).to eq true
|
400
|
+
end
|
401
|
+
end
|
375
402
|
end
|
376
403
|
|
377
404
|
describe "add_sort_field" do
|
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.11.
|
4
|
+
version: 5.11.3
|
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-03-
|
20
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|