blacklight_range_limit 7.7.0 → 7.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight_range_limit/range_limit_distro_facets.js +5 -5
- data/app/assets/javascripts/blacklight_range_limit/range_limit_slider.js +3 -4
- data/app/helpers/range_limit_helper.rb +25 -3
- data/app/views/blacklight_range_limit/_range_limit_panel.html.erb +1 -1
- data/app/views/blacklight_range_limit/_range_segments.html.erb +5 -2
- data/blacklight_range_limit.gemspec +2 -2
- data/config/locales/blacklight_range_limit.ar.yml +2 -2
- data/config/locales/blacklight_range_limit.en.yml +2 -2
- data/lib/blacklight_range_limit/engine.rb +3 -1
- data/lib/blacklight_range_limit/view_helper_override.rb +5 -5
- data/lib/generators/blacklight_range_limit/install_generator.rb +1 -1
- data/spec/features/blacklight_range_limit_spec.rb +9 -1
- data/spec/lib/blacklight_range_limit/view_helper_override_helper_spec.rb +19 -2
- data/spec/test_app_templates/Gemfile.extra +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68ba781f0cbb0071d01c7c4f271e2f313acb1d9c12b867ccc49fdc707c886b4f
|
|
4
|
+
data.tar.gz: 9653d4141da91db97aa7130563fe5048dab111e5e42ccc46ec820aa1477d3d84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ea0eac18d3819f38f2b92fc103cca7023553d9d8c3cac27561b8d8c188825f46f6d6f5f270876162c46864a53d7fb4902cd2d7855dcd58b74790156993eb0bb
|
|
7
|
+
data.tar.gz: 35295bea937bb314c4354d20f1f0d7962f702096af42c079bd74b76feb985019d21513b12049dd52e3578245ffd04e1aa79a731e12bd70e34cff58b71ff77775
|
data/.travis.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
dist:
|
|
1
|
+
dist: bionic
|
|
2
2
|
language: ruby
|
|
3
3
|
addons:
|
|
4
4
|
chrome: stable
|
|
@@ -14,6 +14,8 @@ matrix:
|
|
|
14
14
|
env: "RAILS_VERSION=6.0.0 ENGINE_CART_RAILS_OPTIONS=\"--skip-webpack-install\""
|
|
15
15
|
- rvm: 2.6.5
|
|
16
16
|
env: "RAILS_VERSION=5.2.3"
|
|
17
|
+
- rvm: 2.6.5
|
|
18
|
+
env: "RAILS_VERSION=5.2.3 BLACKLIGHT_VERSION=7.6.0"
|
|
17
19
|
- rvm: 2.5.7
|
|
18
20
|
env: "RAILS_VERSION=5.1.7"
|
|
19
21
|
|
|
@@ -25,4 +27,4 @@ notifications:
|
|
|
25
27
|
global_env:
|
|
26
28
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
|
27
29
|
|
|
28
|
-
jdk:
|
|
30
|
+
jdk: openjdk11
|
data/README.md
CHANGED
|
@@ -52,7 +52,7 @@ config.add_facet_field 'pub_date', label: 'Publication Year', range: true
|
|
|
52
52
|
You should now get range limit display. More complicated configuration is available if desired, see Range Facet Configuration below.
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
You can also configure the look and feel of the Flot chart using the jQuery .data() method. On the `.facet-limit` container you want to configure, add a Flot options associative array (documented at http://people.iola.dk/olau/flot/API.txt) as the `plot-config` key. The `plot-config` key to set the `plot-config` key on the appropriate `.facet-limit` container. In order to customize the plot colors, for example, you could use this code:
|
|
55
|
+
You can also configure the look and feel of the Flot chart using the jQuery .data() method. On the `.blrl-plot-config` or `.facet-limit` container you want to configure, add a Flot options associative array (documented at http://people.iola.dk/olau/flot/API.txt) as the `plot-config` key. The `plot-config` key to set the `plot-config` key on the appropriate `.blrl-plot-config` or `.facet-limit` container. In order to customize the plot colors, for example, you could use this code:
|
|
56
56
|
|
|
57
57
|
```javascript
|
|
58
58
|
$('.blacklight-year_i').data('plot-config', {
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
7.
|
|
1
|
+
7.9.1
|
|
@@ -166,12 +166,12 @@ Blacklight.onLoad(function() {
|
|
|
166
166
|
var series_data = new Array();
|
|
167
167
|
var pointer_lookup = new Array();
|
|
168
168
|
var x_ticks = new Array();
|
|
169
|
-
var min = BlacklightRangeLimit.parseNum($(container).find("ul li:first-child span.from").
|
|
170
|
-
var max = BlacklightRangeLimit.parseNum($(container).find("ul li:last-child span.to").
|
|
169
|
+
var min = BlacklightRangeLimit.parseNum($(container).find("ul li:first-child span.from").first().data('blrlBegin'));
|
|
170
|
+
var max = BlacklightRangeLimit.parseNum($(container).find("ul li:last-child span.to").first().data('blrlEnd'));
|
|
171
171
|
|
|
172
172
|
$(container).find("ul li").each(function() {
|
|
173
|
-
var from = BlacklightRangeLimit.parseNum($(this).find("span.from").
|
|
174
|
-
var to = BlacklightRangeLimit.parseNum($(this).find("span.to").
|
|
173
|
+
var from = BlacklightRangeLimit.parseNum($(this).find("span.from").first().data('blrlBegin'));
|
|
174
|
+
var to = BlacklightRangeLimit.parseNum($(this).find("span.to").first().data('blrlEnd'));
|
|
175
175
|
var count = BlacklightRangeLimit.parseNum($(this).find("span.count").text());
|
|
176
176
|
var avg = (count / (to - from + 1));
|
|
177
177
|
|
|
@@ -191,7 +191,7 @@ Blacklight.onLoad(function() {
|
|
|
191
191
|
|
|
192
192
|
|
|
193
193
|
var plot;
|
|
194
|
-
var config = $(container).closest('.facet-limit').data('plot-config') || {};
|
|
194
|
+
var config = $(container).closest('.blrl-plot-config').data('plot-config') || $(container).closest('.facet-limit').data('plot-config') || {};
|
|
195
195
|
|
|
196
196
|
try {
|
|
197
197
|
plot = $.plot($(container), [series_data],
|
|
@@ -33,10 +33,10 @@ function min_max(range_element) {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var min = max = BlacklightRangeLimit.parseNum(current_limit.find(".single").
|
|
36
|
+
var min = max = BlacklightRangeLimit.parseNum(current_limit.find(".single").data('blrlSingle'))
|
|
37
37
|
if ( isNaN(min)) {
|
|
38
|
-
min = BlacklightRangeLimit.parseNum(current_limit.find(".from").first().
|
|
39
|
-
max = BlacklightRangeLimit.parseNum(current_limit.find(".to").first().
|
|
38
|
+
min = BlacklightRangeLimit.parseNum(current_limit.find(".from").first().data('blrlBegin'));
|
|
39
|
+
max = BlacklightRangeLimit.parseNum(current_limit.find(".to").first().data('blrlEnd'));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (isNaN(min) || isNaN(max)) {
|
|
@@ -44,7 +44,6 @@ function min_max(range_element) {
|
|
|
44
44
|
min = BlacklightRangeLimit.parseNum($(range_element).find(".min").first().text());
|
|
45
45
|
max = BlacklightRangeLimit.parseNum($(range_element).find(".max").first().text());
|
|
46
46
|
}
|
|
47
|
-
|
|
48
47
|
return [min, max]
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -42,13 +42,35 @@ module RangeLimitHelper
|
|
|
42
42
|
return t('blacklight.range_limit.missing')
|
|
43
43
|
elsif hash["begin"] || hash["end"]
|
|
44
44
|
if hash["begin"] == hash["end"]
|
|
45
|
-
return t(
|
|
45
|
+
return t(
|
|
46
|
+
'blacklight.range_limit.single_html',
|
|
47
|
+
begin: format_range_display_value(hash['begin'], solr_field),
|
|
48
|
+
begin_value: hash['begin']
|
|
49
|
+
)
|
|
46
50
|
else
|
|
47
|
-
return t(
|
|
51
|
+
return t(
|
|
52
|
+
'blacklight.range_limit.range_html',
|
|
53
|
+
begin: format_range_display_value(hash['begin'], solr_field),
|
|
54
|
+
begin_value: hash['begin'],
|
|
55
|
+
end: format_range_display_value(hash['end'], solr_field),
|
|
56
|
+
end_value: hash['end']
|
|
57
|
+
)
|
|
48
58
|
end
|
|
49
59
|
end
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
''
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
##
|
|
65
|
+
# A method that is meant to be overridden downstream to format how a range
|
|
66
|
+
# label might be displayed to a user. By default it just returns the value
|
|
67
|
+
# as rendered by the presenter
|
|
68
|
+
def format_range_display_value(value, solr_field)
|
|
69
|
+
if respond_to?(:facet_item_presenter)
|
|
70
|
+
facet_item_presenter(facet_configuration_for_field(solr_field), value, solr_field).label
|
|
71
|
+
else
|
|
72
|
+
facet_display_value(solr_field, value)
|
|
73
|
+
end
|
|
52
74
|
end
|
|
53
75
|
|
|
54
76
|
# Show the limit area if:
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
maxlength = field_config[:maxlength]
|
|
8
8
|
-%>
|
|
9
9
|
|
|
10
|
-
<div class="limit_content range_limit">
|
|
10
|
+
<div class="limit_content range_limit <%= field_name %>-config blrl-plot-config">
|
|
11
11
|
<% if has_selected_range_limit?(field_name) %>
|
|
12
12
|
<ul class="current list-unstyled facet-values">
|
|
13
13
|
<li class="selected">
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
<span class="facet-label">
|
|
8
8
|
<%= link_to(
|
|
9
9
|
t('blacklight.range_limit.range_html',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
begin: format_range_display_value(hash[:from], solr_field),
|
|
11
|
+
begin_value: hash[:from],
|
|
12
|
+
end: format_range_display_value(hash[:to], solr_field),
|
|
13
|
+
end_value: hash[:to]
|
|
14
|
+
),
|
|
12
15
|
search_action_url(add_range(solr_field, hash[:from], hash[:to]).except(:controller, :action)),
|
|
13
16
|
class: 'facet_select'
|
|
14
17
|
) %>
|
|
@@ -17,14 +17,14 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
|
|
18
18
|
s.license = 'Apache 2.0'
|
|
19
19
|
|
|
20
|
-
s.add_dependency 'blacklight', '
|
|
20
|
+
s.add_dependency 'blacklight', '~> 7.0'
|
|
21
21
|
|
|
22
22
|
s.add_development_dependency 'rspec', '~> 3.0'
|
|
23
23
|
s.add_development_dependency 'rspec-rails'
|
|
24
24
|
s.add_development_dependency 'capybara', '~> 3'
|
|
25
25
|
s.add_development_dependency 'sqlite3'
|
|
26
26
|
s.add_development_dependency 'launchy'
|
|
27
|
-
s.add_development_dependency 'solr_wrapper', '~> 0
|
|
27
|
+
s.add_development_dependency 'solr_wrapper', '~> 2.0'
|
|
28
28
|
s.add_development_dependency 'engine_cart', '~> 2.1'
|
|
29
29
|
s.add_development_dependency 'selenium-webdriver', '>= 3.13.1'
|
|
30
30
|
s.add_development_dependency 'webdrivers', '~>3.0'
|
|
@@ -9,5 +9,5 @@ ar:
|
|
|
9
9
|
view_distribution: 'عرض التوزيع'
|
|
10
10
|
view_larger: 'عرض بحجم أكبر »'
|
|
11
11
|
results_range_html: 'تمتد النتائج الحالية من <span class="min">%{min}</span> إلى<span class="max">%{max}</span>'
|
|
12
|
-
single_html: '<span class="single">%{begin}</span>'
|
|
13
|
-
range_html: '<span class="from">%{begin}</span>
|
|
12
|
+
single_html: '<span class="single" data-blrl-single="%{begin_value}">%{begin}</span>'
|
|
13
|
+
range_html: '<span class="from" data-blrl-begin="%{begin_value}">%{begin}</span> الى <span class="to" data-blrl-end="%{end_value}">%{end}</span>'
|
|
@@ -9,5 +9,5 @@ en:
|
|
|
9
9
|
view_distribution: 'View distribution'
|
|
10
10
|
view_larger: 'View larger »'
|
|
11
11
|
results_range_html: 'Current results range from <span class="min">%{min}</span> to <span class="max">%{max}</span>'
|
|
12
|
-
single_html: '<span class="single">%{begin}</span>'
|
|
13
|
-
range_html: '<span class="from">%{begin}</span> to <span class="to">%{end}</span>'
|
|
12
|
+
single_html: '<span class="single" data-blrl-single="%{begin_value}">%{begin}</span>'
|
|
13
|
+
range_html: '<span class="from" data-blrl-begin="%{begin_value}">%{begin}</span> to <span class="to" data-blrl-end="%{end_value}">%{end}</span>'
|
|
@@ -7,7 +7,9 @@ module BlacklightRangeLimit
|
|
|
7
7
|
# Need to tell asset pipeline to precompile the excanvas
|
|
8
8
|
# we use for IE.
|
|
9
9
|
initializer "blacklight_range_limit.assets", :after => "assets" do
|
|
10
|
-
|
|
10
|
+
if defined? Sprockets
|
|
11
|
+
Rails.application.config.assets.precompile += %w( flot/excanvas.min.js )
|
|
12
|
+
end
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
config.action_dispatch.rescue_responses.merge!(
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
facet_field_label(solr_field),
|
|
36
36
|
range_display(solr_field, my_params),
|
|
37
37
|
escape_value: false,
|
|
38
|
-
remove: remove_range_param(solr_field, my_params)
|
|
38
|
+
remove: search_action_path(remove_range_param(solr_field, my_params))
|
|
39
39
|
)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
private
|
|
88
88
|
|
|
89
89
|
def range_params(my_params = params)
|
|
90
|
-
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)
|
|
91
91
|
|
|
92
92
|
my_params[:range].select do |_solr_field, range_options|
|
|
93
93
|
next unless range_options
|
|
94
94
|
|
|
95
|
-
[range_options['missing'],
|
|
96
|
-
range_options['begin'],
|
|
97
|
-
range_options['end']].any?
|
|
95
|
+
[range_options['missing'].presence,
|
|
96
|
+
range_options['begin'].presence,
|
|
97
|
+
range_options['end'].presence].any?
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
end
|
|
@@ -9,7 +9,7 @@ module BlacklightRangeLimit
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def install_catalog_controller_mixin
|
|
12
|
-
|
|
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
|
-
|
|
27
|
+
within '.blacklight-pub_date_si' do
|
|
28
|
+
expect(page).to have_content "2000 to 2008 ✖ [remove] 12"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
within '.constraints-container' 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
|
|
@@ -5,7 +5,13 @@ RSpec.describe BlacklightRangeLimit::ViewHelperOverride, type: :helper do
|
|
|
5
5
|
before do
|
|
6
6
|
allow(helper).to receive_messages(
|
|
7
7
|
facet_field_label: 'Date Range',
|
|
8
|
-
remove_range_param:
|
|
8
|
+
remove_range_param: {},
|
|
9
|
+
search_action_path: '/catalog',
|
|
10
|
+
blacklight_config: CatalogController.blacklight_config,
|
|
11
|
+
search_state: {},
|
|
12
|
+
)
|
|
13
|
+
allow(controller).to receive_messages(
|
|
14
|
+
search_state_class: Blacklight::SearchState,
|
|
9
15
|
)
|
|
10
16
|
end
|
|
11
17
|
|
|
@@ -32,7 +38,11 @@ RSpec.describe BlacklightRangeLimit::ViewHelperOverride, type: :helper do
|
|
|
32
38
|
|
|
33
39
|
describe 'render_search_to_s_filters' do
|
|
34
40
|
before do
|
|
35
|
-
allow(helper).to receive_messages(
|
|
41
|
+
allow(helper).to receive_messages(
|
|
42
|
+
facet_field_label: 'Date Range',
|
|
43
|
+
blacklight_config: CatalogController.blacklight_config,
|
|
44
|
+
search_state: {},
|
|
45
|
+
)
|
|
36
46
|
end
|
|
37
47
|
|
|
38
48
|
it 'does not return any content when the range parameter invalid' do
|
|
@@ -82,6 +92,13 @@ RSpec.describe BlacklightRangeLimit::ViewHelperOverride, type: :helper do
|
|
|
82
92
|
ActionController::Parameters.new(range: { field_name: { 'wrong' => 'data' } })
|
|
83
93
|
)
|
|
84
94
|
).to eq({})
|
|
95
|
+
|
|
96
|
+
expect(
|
|
97
|
+
helper.send(
|
|
98
|
+
:range_params,
|
|
99
|
+
ActionController::Parameters.new(range: { field_name: { 'begin' => '', 'end' => '' } })
|
|
100
|
+
)
|
|
101
|
+
).to eq({})
|
|
85
102
|
end
|
|
86
103
|
|
|
87
104
|
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: 7.
|
|
4
|
+
version: 7.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Rochkind
|
|
@@ -9,20 +9,20 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2020-
|
|
12
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: blacklight
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
|
-
- - "
|
|
18
|
+
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
20
|
version: '7.0'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
|
-
- - "
|
|
25
|
+
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '7.0'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
@@ -101,14 +101,14 @@ dependencies:
|
|
|
101
101
|
requirements:
|
|
102
102
|
- - "~>"
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '0
|
|
104
|
+
version: '2.0'
|
|
105
105
|
type: :development
|
|
106
106
|
prerelease: false
|
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
|
108
108
|
requirements:
|
|
109
109
|
- - "~>"
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
|
-
version: '0
|
|
111
|
+
version: '2.0'
|
|
112
112
|
- !ruby/object:Gem::Dependency
|
|
113
113
|
name: engine_cart
|
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|