blacklight_range_limit 7.1.0 → 7.2.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: fcbdbc78c473e59d57bd6453adf5f6c09eec1786f5a537b57b53077a736602c8
4
- data.tar.gz: 0eccabe9cd9231a0cb62d80d470762a056881aa93e34ea655a28268369d034ee
3
+ metadata.gz: ddb716f6bce403a2d7f369337d8f4a8da47dc279895c8c5bb3996a9ac2edcdae
4
+ data.tar.gz: f758c04d42477a7650b4f164c5ee4889a4edc903d22ddff3639c71ed216c3d70
5
5
  SHA512:
6
- metadata.gz: 34088b2dab05fb33d092fca7b4e407e8d0418e4531995c58fc3371da00ff7dd1a27bb6d4e2a52ecb47ed27309ca586befb24ae52c03ce4d3e3e10793a2cade13
7
- data.tar.gz: a6f1480b8b63f8ba8f1a2bed53518f45f9dca2efe42f73ff92af2553814650f25d74e46fc2c07222f7225afa06c9da287fa6f158c2d47041dc0019df103872de
6
+ metadata.gz: 1cb56737784cf18e63e857494d5f7b41216a4238ae7b02f2080f82146403e7e523d43beb1ad0e353d942df03fe4b5292a92d02fcfee53ab19c755c0da2e5e5e1
7
+ data.tar.gz: 6bb5e1f046e4db352ca9d9f0fcfe809af4d61bc75b75be55318bc40463f14be4421839669c60e7e9442cd8c51585ac76ee164c81eaa5b2af4c9b1f2bc16b75c6
@@ -1,18 +1,21 @@
1
- notifications:
2
- email: false
3
-
1
+ dist: trusty
2
+ language: ruby
4
3
  addons:
5
4
  chrome: stable
6
-
7
- language: ruby
8
- sudo: false
9
- rvm:
10
- - 2.5.5
11
-
12
5
  before_install:
13
- - gem install bundler
14
- - google-chrome-stable --headless --no-sandbox --disable-gpu --remote-debugging-port=9222 http://localhost &
6
+ - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
7
+
8
+ notifications:
9
+ email: false
15
10
 
11
+ matrix:
12
+ include:
13
+ - rvm: 2.6.5
14
+ env: "RAILS_VERSION=6.0.0 ENGINE_CART_RAILS_OPTIONS=\"--skip-webpack-install\""
15
+ - rvm: 2.6.5
16
+ env: "RAILS_VERSION=5.2.3"
17
+ - rvm: 2.5.7
18
+ env: "RAILS_VERSION=5.1.7"
16
19
 
17
20
  notifications:
18
21
  irc: "irc.freenode.org#blacklight"
@@ -22,4 +25,4 @@ notifications:
22
25
  global_env:
23
26
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
24
27
 
25
- jdk: oraclejdk8
28
+ jdk: oraclejdk9
data/Gemfile CHANGED
@@ -1,6 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
- gemspec
5
+ # Please see blacklight.gemspec for dependency information.
6
+ gemspec path: File.expand_path('..', __FILE__)
7
+
8
+ group :test do
9
+ gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
10
+ end
4
11
 
5
12
  # BEGIN ENGINE_CART BLOCK
6
13
  # engine_cart: 0.10.0
@@ -27,12 +34,17 @@ else
27
34
  end
28
35
 
29
36
  case ENV['RAILS_VERSION']
37
+ when /^5.[12]/, /^6.0/
38
+ gem 'sass-rails', '~> 5.0'
30
39
  when /^4.2/
31
40
  gem 'responders', '~> 2.0'
32
41
  gem 'sass-rails', '>= 5.0'
33
42
  gem 'coffee-rails', '~> 4.1.0'
43
+ gem 'json', '~> 1.8'
34
44
  when /^4.[01]/
35
45
  gem 'sass-rails', '< 5.0'
36
46
  end
37
47
  end
38
48
  # END ENGINE_CART BLOCK
49
+
50
+ eval_gemfile File.expand_path("spec/test_app_templates/Gemfile.extra", File.dirname(__FILE__))
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.1.0
1
+ 7.2.0
@@ -11,7 +11,7 @@
11
11
  }
12
12
 
13
13
  BlacklightRangeLimit.parseNum = function parseNum(str) {
14
- str = String(str).replace(/[^0-9]/g, '');
14
+ str = String(str).replace(/[^0-9-]/g, '');
15
15
  return parseInt(str, 10);
16
16
  };
17
17
 
@@ -72,11 +72,6 @@ module RangeLimitHelper
72
72
  my_params["range"][solr_field] ||= {}
73
73
  my_params["range"][solr_field]["missing"] = "true"
74
74
 
75
- # Need to ensure there's a search_field to trick Blacklight
76
- # into displaying results, not placeholder page. Kind of hacky,
77
- # but works for now.
78
- my_params["search_field"] ||= "dummy_range"
79
-
80
75
  my_params
81
76
  end
82
77
 
@@ -28,13 +28,6 @@
28
28
  <%= form_tag search_action_path, :method => :get, class: [BlacklightRangeLimit.classes[:form], "range_#{field_name}"].join(' ') do %>
29
29
  <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:page)) %>
30
30
 
31
- <!-- we need to include a dummy search_field parameter if none exists,
32
- to trick blacklight into displaying actual search results instead
33
- of home page. Not a great solution, but easiest for now. -->
34
- <% unless params.has_key?(:search_field) %>
35
- <%= hidden_field_tag("search_field", "dummy_range") %>
36
- <% end %>
37
-
38
31
  <%= render_range_input(field_name, :begin, input_label_range_begin, maxlength) %> – <%= render_range_input(field_name, :end, input_label_range_end, maxlength) %>
39
32
  <%= submit_tag t('blacklight.range_limit.submit_limit'), class: BlacklightRangeLimit.classes[:submit] %>
40
33
  <% end %>
@@ -17,16 +17,15 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.license = 'Apache 2.0'
19
19
 
20
- s.add_dependency 'rails', '>= 3.0'
21
20
  s.add_dependency 'blacklight', '>= 7.0'
22
21
 
23
22
  s.add_development_dependency 'rspec', '~> 3.0'
24
23
  s.add_development_dependency 'rspec-rails'
25
- s.add_development_dependency 'capybara'
24
+ s.add_development_dependency 'capybara', '~> 3'
26
25
  s.add_development_dependency 'sqlite3'
27
26
  s.add_development_dependency 'launchy'
28
27
  s.add_development_dependency 'solr_wrapper', '~> 0.14'
29
- s.add_development_dependency 'engine_cart', '~> 2.0'
30
- s.add_development_dependency 'selenium-webdriver', '~> 3.12.0'
31
- s.add_development_dependency 'webdrivers'
28
+ s.add_development_dependency 'engine_cart', '~> 2.1'
29
+ s.add_development_dependency 'selenium-webdriver', '>= 3.13.1'
30
+ s.add_development_dependency 'webdrivers', '~>3.0'
32
31
  end
@@ -12,46 +12,46 @@ module BlacklightRangeLimit
12
12
 
13
13
  # Method added to to fetch proper things for date ranges.
14
14
  def add_range_limit_params(solr_params)
15
- ranged_facet_configs =
16
- blacklight_config.facet_fields.select { |key, config| config.range }
15
+ ranged_facet_configs =
16
+ blacklight_config.facet_fields.select { |key, config| config.range }
17
17
  # In ruby 1.8, hash.select returns an array of pairs, in ruby 1.9
18
- # it returns a hash. Turn it into a hash either way.
18
+ # it returns a hash. Turn it into a hash either way.
19
19
  ranged_facet_configs = Hash[ ranged_facet_configs ] unless ranged_facet_configs.kind_of?(Hash)
20
-
21
- ranged_facet_configs.each_pair do |solr_field, config|
20
+
21
+ ranged_facet_configs.each_pair do |field_key, config|
22
22
  solr_params["stats"] = "true"
23
23
  solr_params["stats.field"] ||= []
24
- solr_params["stats.field"] << solr_field
25
-
26
- hash = blacklight_params["range"] && blacklight_params["range"][solr_field] ?
27
- blacklight_params["range"][solr_field] :
24
+ solr_params["stats.field"] << config.field
25
+
26
+ hash = blacklight_params["range"] && blacklight_params["range"][field_key] ?
27
+ blacklight_params["range"][field_key] :
28
28
  {}
29
-
29
+
30
30
  if !hash["missing"].blank?
31
31
  # missing specified in request params
32
32
  solr_params[:fq] ||= []
33
- solr_params[:fq] << "-#{solr_field}:[* TO *]"
34
-
33
+ solr_params[:fq] << "-#{config.field}:[* TO *]"
34
+
35
35
  elsif !(hash["begin"].blank? && hash["end"].blank?)
36
36
  # specified in request params, begin and/or end, might just have one
37
37
  start = hash["begin"].blank? ? "*" : hash["begin"]
38
38
  finish = hash["end"].blank? ? "*" : hash["end"]
39
-
39
+
40
40
  solr_params[:fq] ||= []
41
- solr_params[:fq] << "#{solr_field}: [#{start} TO #{finish}]"
42
-
41
+ solr_params[:fq] << "#{config.field}: [#{start} TO #{finish}]"
42
+
43
43
  if (config.segments != false && start != "*" && finish != "*")
44
44
  # Add in our calculated segments, can only do with both boundaries.
45
- add_range_segments_to_solr!(solr_params, solr_field, start.to_i, finish.to_i)
45
+ add_range_segments_to_solr!(solr_params, field_key, start.to_i, finish.to_i)
46
46
  end
47
-
47
+
48
48
  elsif (config.segments != false &&
49
49
  boundaries = config.assumed_boundaries)
50
50
  # assumed_boundaries in config
51
- add_range_segments_to_solr!(solr_params, solr_field, boundaries[0], boundaries[1])
51
+ add_range_segments_to_solr!(solr_params, field_key, boundaries[0], boundaries[1])
52
52
  end
53
53
  end
54
-
54
+
55
55
  return solr_params
56
56
  end
57
57
 
@@ -67,12 +67,12 @@ module BlacklightRangeLimit
67
67
  # Specified field and parameters are specified in incoming parameters
68
68
  # range_field, range_start, range_end
69
69
  def fetch_specific_range_limit(solr_params)
70
- solr_field = blacklight_params[:range_field] # what field to fetch for
70
+ field_key = blacklight_params[:range_field] # what field to fetch for
71
71
  start = blacklight_params[:range_start].to_i
72
72
  finish = blacklight_params[:range_end].to_i
73
73
 
74
- add_range_segments_to_solr!(solr_params, solr_field, start, finish )
75
-
74
+ add_range_segments_to_solr!(solr_params, field_key, start, finish )
75
+
76
76
  # Remove all field faceting for efficiency, we won't be using it.
77
77
  solr_params.delete("facet.field")
78
78
  solr_params.delete("facet.field".to_sym)
@@ -11,21 +11,22 @@ module BlacklightRangeLimit
11
11
  # by subtracting one from subsequent boundary.
12
12
  #
13
13
  # Changes solr_params passed in.
14
- def add_range_segments_to_solr!(solr_params, solr_field, min, max)
14
+ def add_range_segments_to_solr!(solr_params, facet_field, min, max)
15
15
  raise InvalidRange, "The min date must be before the max date" if min > max
16
+ field_config = blacklight_config.facet_fields[facet_field.to_s]
16
17
 
17
- field_config = BlacklightRangeLimit.range_config(blacklight_config, solr_field)
18
+ range_config = BlacklightRangeLimit.range_config(blacklight_config, facet_field)
18
19
 
19
20
  solr_params[:"facet.query"] ||= []
20
21
 
21
- boundaries = boundaries_for_range_facets(min, max, (field_config[:num_segments] || 10) )
22
+ boundaries = boundaries_for_range_facets(min, max, (range_config[:num_segments] || 10) )
22
23
 
23
24
  # Now make the boundaries into actual filter.queries.
24
25
  0.upto(boundaries.length - 2) do |index|
25
26
  first = boundaries[index]
26
27
  last = boundaries[index+1].to_i - 1
27
28
 
28
- solr_params[:"facet.query"] << "#{solr_field}:[#{first} TO #{last}]"
29
+ solr_params[:"facet.query"] << "#{field_config.field}:[#{first} TO #{last}]"
29
30
  end
30
31
 
31
32
  return solr_params
@@ -97,7 +97,7 @@
97
97
  array = []
98
98
 
99
99
  @response["facet_counts"]["facet_queries"].each_pair do |query, count|
100
- if query =~ /#{solr_field}: *\[ *(\d+) *TO *(\d+) *\]/
100
+ if query =~ /#{solr_field}: *\[ *(-?\d+) *TO *(-?\d+) *\]/
101
101
  array << {:from => $1, :to => $2, :count => count}
102
102
  end
103
103
  end
@@ -350,7 +350,6 @@
350
350
  <analyzer>
351
351
  <tokenizer class="solr.StandardTokenizerFactory"/>
352
352
  <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
353
- <filter class="solr.StandardFilterFactory"/>
354
353
  <filter class="solr.LowerCaseFilterFactory"/>
355
354
  <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
356
355
  </analyzer>
@@ -359,7 +358,6 @@
359
358
  <fieldType name="textSuggest" class="solr.TextField" positionIncrementGap="100">
360
359
  <analyzer>
361
360
  <tokenizer class="solr.KeywordTokenizerFactory"/>
362
- <filter class="solr.StandardFilterFactory"/>
363
361
  <filter class="solr.LowerCaseFilterFactory"/>
364
362
  <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
365
363
  </analyzer>
@@ -5,7 +5,12 @@ require 'spec_helper'
5
5
  describe 'JavaScript', js: true do
6
6
  it 'initializes canvas chart' do
7
7
  visit search_catalog_path
8
- click_link 'Publication Date'
8
+
9
+ within('#facets .navbar') do
10
+ page.find('button.navbar-toggler').click
11
+ end
12
+
13
+ click_button 'Publication Date Sort'
9
14
  expect(page).to have_css '.flot-base'
10
15
  end
11
16
  end
@@ -6,6 +6,7 @@ EngineCart.load_application!
6
6
  require 'rspec/rails'
7
7
  require 'capybara/rspec'
8
8
  require 'selenium-webdriver'
9
+ require 'webdrivers'
9
10
 
10
11
  Capybara.javascript_driver = :selenium_chrome_headless
11
12
 
@@ -1 +1,3 @@
1
1
  gem 'blacklight', github: 'projectblacklight/blacklight', branch: 'master'
2
+ gem 'rails-controller-testing'
3
+ gem 'thor', '~> 0.20'
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: 7.1.0
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-09 00:00:00.000000000 Z
12
+ date: 2019-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '3.0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '3.0'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: blacklight
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -71,16 +57,16 @@ dependencies:
71
57
  name: capybara
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
- - - ">="
60
+ - - "~>"
75
61
  - !ruby/object:Gem::Version
76
- version: '0'
62
+ version: '3'
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
- - - ">="
67
+ - - "~>"
82
68
  - !ruby/object:Gem::Version
83
- version: '0'
69
+ version: '3'
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: sqlite3
86
72
  requirement: !ruby/object:Gem::Requirement
@@ -129,42 +115,42 @@ dependencies:
129
115
  requirements:
130
116
  - - "~>"
131
117
  - !ruby/object:Gem::Version
132
- version: '2.0'
118
+ version: '2.1'
133
119
  type: :development
134
120
  prerelease: false
135
121
  version_requirements: !ruby/object:Gem::Requirement
136
122
  requirements:
137
123
  - - "~>"
138
124
  - !ruby/object:Gem::Version
139
- version: '2.0'
125
+ version: '2.1'
140
126
  - !ruby/object:Gem::Dependency
141
127
  name: selenium-webdriver
142
128
  requirement: !ruby/object:Gem::Requirement
143
129
  requirements:
144
- - - "~>"
130
+ - - ">="
145
131
  - !ruby/object:Gem::Version
146
- version: 3.12.0
132
+ version: 3.13.1
147
133
  type: :development
148
134
  prerelease: false
149
135
  version_requirements: !ruby/object:Gem::Requirement
150
136
  requirements:
151
- - - "~>"
137
+ - - ">="
152
138
  - !ruby/object:Gem::Version
153
- version: 3.12.0
139
+ version: 3.13.1
154
140
  - !ruby/object:Gem::Dependency
155
141
  name: webdrivers
156
142
  requirement: !ruby/object:Gem::Requirement
157
143
  requirements:
158
- - - ">="
144
+ - - "~>"
159
145
  - !ruby/object:Gem::Version
160
- version: '0'
146
+ version: '3.0'
161
147
  type: :development
162
148
  prerelease: false
163
149
  version_requirements: !ruby/object:Gem::Requirement
164
150
  requirements:
165
- - - ">="
151
+ - - "~>"
166
152
  - !ruby/object:Gem::Version
167
- version: '0'
153
+ version: '3.0'
168
154
  description:
169
155
  email:
170
156
  - blacklight-development@googlegroups.com
@@ -228,8 +214,8 @@ files:
228
214
  - solr/conf/xslt/example_rss.xsl
229
215
  - solr/conf/xslt/luke.xsl
230
216
  - solr/sample_solr_documents.yml
217
+ - spec/features/a_javascript_spec.rb
231
218
  - spec/features/blacklight_range_limit_spec.rb
232
- - spec/features/javascript_spec.rb
233
219
  - spec/fixtures/solr_documents/zero_year.yml
234
220
  - spec/helpers/blacklight_range_limit_helper_spec.rb
235
221
  - spec/lib/blacklight_range_limit/segment_calculation_spec.rb
@@ -260,14 +246,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
246
  - !ruby/object:Gem::Version
261
247
  version: '0'
262
248
  requirements: []
263
- rubyforge_project:
264
- rubygems_version: 2.7.6
249
+ rubygems_version: 3.0.3
265
250
  signing_key:
266
251
  specification_version: 4
267
252
  summary: Blacklight Range Limit plugin
268
253
  test_files:
254
+ - spec/features/a_javascript_spec.rb
269
255
  - spec/features/blacklight_range_limit_spec.rb
270
- - spec/features/javascript_spec.rb
271
256
  - spec/fixtures/solr_documents/zero_year.yml
272
257
  - spec/helpers/blacklight_range_limit_helper_spec.rb
273
258
  - spec/lib/blacklight_range_limit/segment_calculation_spec.rb