blacklight_range_limit 7.7.0 → 7.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2167f6be6b6b4e9b67276d274aed5d5a3422779297c7630509bc9d562d355a76
4
- data.tar.gz: 290370f3bfc33223c8a8ead2547241f6d5af25647acd6fce5f37bfefbcf3bbdc
3
+ metadata.gz: 6c31bc65d3f409a118dffda97b7b744f1d846151e57e7c64b3757660fb2af23c
4
+ data.tar.gz: baf34fb3d88a9f0d438b3689dfd51aa1ec3dfc4e5636ef654bc414a46ff17646
5
5
  SHA512:
6
- metadata.gz: 52823d196806781d9c00ffe501f9b96c1d6c0808fdb6cd0aa14484873624ab744079d0751a8c9a9f9de5082b28cf1226214bcd517cbc2eae04d7125dff3d0a6d
7
- data.tar.gz: '04678a126c9947e4d6dcd9f56a9ffb71b61072e9d0f3f5f907ca6e98c1b0958bf8e2fd89d7057c5114ad08af444301f3d19a9b65dd1c2c1e093eef0a8eb897e8'
6
+ metadata.gz: 3c4dd6d2ce9248b5587687d3b2f56db705ebb2915e1e6772e799493bad5c1bb4d47a822eeb5319c3daba2f88d7f60b62188f9856cb0dbbd16feb2c9e4f78294d
7
+ data.tar.gz: b08cc82a380cedb3ed79122c5dd92a21e0232c6e6fa5644b66cb82e67787e71126c382be80bab556786fb852e40c4557cb2524242af58877048fe89f7a134f03
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.7.0
1
+ 7.8.0
@@ -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").text());
170
- var max = BlacklightRangeLimit.parseNum($(container).find("ul li:last-child span.to").text());
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").text());
174
- var to = BlacklightRangeLimit.parseNum($(this).find("span.to").text());
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").text())
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().text());
39
- max = BlacklightRangeLimit.parseNum(current_limit.find(".to").first().text());
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,7 @@ 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
-
47
+ console.log(min, max)
48
48
  return [min, max]
49
49
  }
50
50
 
@@ -42,13 +42,30 @@ 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('blacklight.range_limit.single_html', begin: h(hash['begin']))
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('blacklight.range_limit.range_html', begin: h(hash['begin']), end: h(hash['end']))
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
- return ""
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
+ def format_range_display_value(value, _solr_field)
68
+ value
52
69
  end
53
70
 
54
71
  # 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,10 @@
7
7
  <span class="facet-label">
8
8
  <%= link_to(
9
9
  t('blacklight.range_limit.range_html',
10
- begin: facet_display_value(solr_field, hash[:from]),
11
- end: facet_display_value(solr_field, hash[:to])),
10
+ begin: format_range_display_value(facet_display_value(solr_field, hash[:from]), solr_field),
11
+ begin_value: facet_display_value(solr_field, hash[:from]),
12
+ end: format_range_display_value(facet_display_value(solr_field, hash[:to]), solr_field),
13
+ end_value: facet_display_value(solr_field, hash[:to])),
12
14
  search_action_url(add_range(solr_field, hash[:from], hash[:to]).except(:controller, :action)),
13
15
  class: 'facet_select'
14
16
  ) %>
@@ -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> إلى<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> إلى<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>'
@@ -1,3 +1,2 @@
1
- gem 'blacklight', github: 'projectblacklight/blacklight', branch: 'master'
2
1
  gem 'rails-controller-testing'
3
2
  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.7.0
4
+ version: 7.8.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-02 00:00:00.000000000 Z
12
+ date: 2020-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight