blacklight_range_limit 6.4.0 → 6.5.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
  SHA256:
3
- metadata.gz: d1d06f2026c9872ba165877b0d2e5a533e4522ebe0bc273b46586ce916708db5
4
- data.tar.gz: 7d7cae7865815f99228acb3264b59499d9a313f219f69e8bd47090fbc98e767c
3
+ metadata.gz: 454aced55fe12cf920d7f33fc5338f40707ae450e78f3863f2d99a7721c9dc40
4
+ data.tar.gz: 19b80f76873f3a1a3e59ffaa7291c1f8d2f7af680a7979a8e3f3655adf716296
5
5
  SHA512:
6
- metadata.gz: 4cd3f8e9c6d1f32a9a1ff1b8b2ff66b7619d4b45f88a85f4d15c80b38501f681d250ead319b823ef19b3d10249bfc16291d430f4a44c023985cdeb46ae112370
7
- data.tar.gz: 3f5a12bedc924cea811b1ad562ae1df9cbb6499b1015143206c64c36b86994eb5441ab968290524324e9a62a7c462a083d3f606c3831faf5e7e57c6b68ed7997
6
+ metadata.gz: d8e45fed92431f1f46db61c9c76986f4552a7c01aba77aa1f85890cae4a8fc0dee42812ef4c4de0a11473653fceb1dc1e8a4f07588ae67761ecae6fa52410bab
7
+ data.tar.gz: 2bf5fccb09e9f21de9c7a783e4f0e426d1eb5299010a0cea108619c30182d11d20e1df0ba58110d0f7ac036828fcdbd16e6dd243f50d8a1078a783f05317a049
data/Rakefile CHANGED
@@ -6,8 +6,6 @@ require 'rspec/core/rake_task'
6
6
  require 'engine_cart/rake_task'
7
7
  require 'solr_wrapper'
8
8
 
9
- EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
10
-
11
9
  task :default => :ci
12
10
 
13
11
  desc "Run specs"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.4.0
1
+ 6.5.0
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_dependency 'rails', '>= 4.2', '< 6'
21
21
  s.add_dependency 'jquery-rails' # our JS needs jquery_rails
22
- s.add_dependency 'blacklight', '>= 6.10.0', '< 7.0.0'
22
+ s.add_dependency 'blacklight', '~> 6.10'
23
23
 
24
24
  s.add_development_dependency 'chromedriver-helper'
25
25
  s.add_development_dependency 'rspec', '~> 3.0'
@@ -29,6 +29,6 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency 'launchy'
30
30
  s.add_development_dependency 'selenium-webdriver'
31
31
  s.add_development_dependency 'solr_wrapper', '~> 2.2'
32
- s.add_development_dependency 'engine_cart', '~> 1.0'
32
+ s.add_development_dependency 'engine_cart', '~> 2.0'
33
33
  s.add_development_dependency 'webdrivers'
34
34
  end
@@ -9,6 +9,7 @@ module BlacklightRangeLimit
9
9
  included do
10
10
  helper BlacklightRangeLimit::ViewHelperOverride
11
11
  helper RangeLimitHelper
12
+ helper_method :has_range_limit_parameters?
12
13
  end
13
14
 
14
15
  # Action method of our own!
@@ -28,5 +29,18 @@ module BlacklightRangeLimit
28
29
 
29
30
  render('blacklight_range_limit/range_segments', :locals => {:solr_field => params[:range_field]}, :layout => !request.xhr?)
30
31
  end
32
+
33
+ # over-ride, call super, but make sure our range limits count too
34
+ def has_search_parameters?
35
+ super || has_range_limit_parameters?
36
+ end
37
+
38
+ def has_range_limit_parameters?(my_params = params)
39
+ my_params[:range] &&
40
+ my_params[:range].to_unsafe_h.any? do |key, v|
41
+ v.present? && v.respond_to?(:'[]') &&
42
+ (v["begin"].present? || v["end"].present? || v["missing"].present?)
43
+ end
44
+ end
31
45
  end
32
46
  end
@@ -11,19 +11,6 @@
11
11
  super
12
12
  end
13
13
 
14
- def has_range_limit_parameters?(my_params = params)
15
- my_params[:range] &&
16
- my_params[:range].to_unsafe_h.any? do |key, v|
17
- v.present? && v.respond_to?(:'[]') &&
18
- (v["begin"].present? || v["end"].present? || v["missing"].present?)
19
- end
20
- end
21
-
22
- # over-ride, call super, but make sure our range limits count too
23
- def has_search_parameters?
24
- super || has_range_limit_parameters?
25
- end
26
-
27
14
  def query_has_constraints?(my_params = params)
28
15
  super || has_range_limit_parameters?(my_params)
29
16
  end
@@ -100,14 +87,14 @@
100
87
  private
101
88
 
102
89
  def range_params(my_params = params)
103
- return {} unless my_params[:range].is_a?(ActionController::Parameters)
90
+ return {} unless my_params[:range].is_a?(ActionController::Parameters) || my_params[:range].is_a?(Hash)
104
91
 
105
92
  my_params[:range].select do |_solr_field, range_options|
106
93
  next unless range_options
107
94
 
108
- [range_options['missing'],
109
- range_options['begin'],
110
- range_options['end']].any?
95
+ [range_options['missing'].presence,
96
+ range_options['begin'].presence,
97
+ range_options['end'].presence].any?
111
98
  end
112
99
  end
113
100
  end
@@ -9,7 +9,7 @@ module BlacklightRangeLimit
9
9
  end
10
10
 
11
11
  def install_catalog_controller_mixin
12
- inject_into_class 'app/controllers/catalog_controller.rb', CatalogController do
12
+ inject_into_file 'app/controllers/catalog_controller.rb', after: /include Blacklight::Catalog.*$/ do
13
13
  "\n include BlacklightRangeLimit::ControllerOverride\n"
14
14
  end
15
15
  end
@@ -24,7 +24,15 @@ describe "Blacklight Range Limit" do
24
24
  click_link 'View distribution'
25
25
  click_link '2000 to 2008'
26
26
 
27
- expect(page).to have_content "2000 to 2008 [remove] 12"
27
+ within '.blacklight-pub_date_sort' do
28
+ expect(page).to have_content "2000 to 2008 [remove] 12"
29
+ end
30
+
31
+ within '#appliedParams' do
32
+ expect(page).to have_content '2000 to 2008'
33
+ end
34
+
35
+ expect(page).to have_content '1 - 10 of 12'
28
36
  end
29
37
 
30
38
  it "should not include page parameter" do
@@ -61,9 +69,9 @@ describe "Blacklight Range Limit with configured input labels" do
61
69
  maxlength: 6
62
70
  }
63
71
  config.default_solr_params[:'facet.field'] = config.facet_fields.keys
64
- end
65
- end
66
-
72
+ end
73
+ end
74
+
67
75
  it "should show the range limit facet with configured labels and maxlength" do
68
76
  visit '/catalog'
69
77
  expect(page).to have_selector 'label.sr-only[for="range_pub_date_sort_begin"]', :text => 'from publication date'
@@ -82,6 +82,13 @@ RSpec.describe BlacklightRangeLimit::ViewHelperOverride, type: :helper do
82
82
  ActionController::Parameters.new(range: { field_name: { 'wrong' => 'data' } })
83
83
  )
84
84
  ).to eq({})
85
+
86
+ expect(
87
+ helper.send(
88
+ :range_params,
89
+ ActionController::Parameters.new(range: { field_name: { 'begin' => '', 'end' => '' } })
90
+ )
91
+ ).to eq({})
85
92
  end
86
93
 
87
94
  it 'returns the range parameters that are present' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_range_limit
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-01 00:00:00.000000000 Z
12
+ date: 2020-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -49,22 +49,16 @@ dependencies:
49
49
  name: blacklight
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 6.10.0
55
- - - "<"
52
+ - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: 7.0.0
54
+ version: '6.10'
58
55
  type: :runtime
59
56
  prerelease: false
60
57
  version_requirements: !ruby/object:Gem::Requirement
61
58
  requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 6.10.0
65
- - - "<"
59
+ - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: 7.0.0
61
+ version: '6.10'
68
62
  - !ruby/object:Gem::Dependency
69
63
  name: chromedriver-helper
70
64
  requirement: !ruby/object:Gem::Requirement
@@ -183,14 +177,14 @@ dependencies:
183
177
  requirements:
184
178
  - - "~>"
185
179
  - !ruby/object:Gem::Version
186
- version: '1.0'
180
+ version: '2.0'
187
181
  type: :development
188
182
  prerelease: false
189
183
  version_requirements: !ruby/object:Gem::Requirement
190
184
  requirements:
191
185
  - - "~>"
192
186
  - !ruby/object:Gem::Version
193
- version: '1.0'
187
+ version: '2.0'
194
188
  - !ruby/object:Gem::Dependency
195
189
  name: webdrivers
196
190
  requirement: !ruby/object:Gem::Requirement
@@ -301,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
295
  - !ruby/object:Gem::Version
302
296
  version: '0'
303
297
  requirements: []
304
- rubygems_version: 3.0.3
298
+ rubygems_version: 3.1.2
305
299
  signing_key:
306
300
  specification_version: 4
307
301
  summary: Blacklight Range Limit plugin