blacklight_range_limit 5.0.4 → 5.1.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
  SHA1:
3
- metadata.gz: 634026b870d878f4ab9ffc0f8d0f101ff2136317
4
- data.tar.gz: 4a89fdf27b5acf0d237fa77848edec77a0d30f8c
3
+ metadata.gz: b3332162f26f3c37988434d3f9f5cfcf4ad3f8ac
4
+ data.tar.gz: 1b58632167c84866a291472c294540977417fce6
5
5
  SHA512:
6
- metadata.gz: ed2522f9cb021084721312501b7b7044c7fa7e8526f90a65f7eded30dad4426fa2c727686aa7a80e102968de5e6239e7286a952470a6c3615da5a091344c7c69
7
- data.tar.gz: d23895c6afeb3b24dc22e30f2fa0b69b5a49f9f24e9ef28da418e5b3b1586755bb967c0fe7f92d70825418c0e55db7fe8f40025f08bb29c1c41e485d1bfc5fab
6
+ metadata.gz: 8cae1eb92de55315ef2318ce89029b2bb70bcb2bcdea411b6adc5a94470fceadd6d3d3be551f0af364710ed01aab5125a7561a4d4a3c49ddabfdf422f8895005
7
+ data.tar.gz: 7f2356c2213b6c1bf522f9ad7e7c555a497c44a187d50c8e185fc07c0bc6f178d23a8e22521bcbca31e7a2ca033f8843b67fb3e53ed07c7b3a9be4fe4b31b713
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.4
1
+ 5.1.0
@@ -155,13 +155,13 @@ Blacklight.onLoad(function() {
155
155
  var series_data = new Array();
156
156
  var pointer_lookup = new Array();
157
157
  var x_ticks = new Array();
158
- var min = parseInt($(container).find("ul li:first-child span.from").text());
159
- var max = parseInt($(container).find("ul li:last-child span.to").text());
158
+ var min = BlacklightRangeLimit.parseNum($(container).find("ul li:first-child span.from").text());
159
+ var max = BlacklightRangeLimit.parseNum($(container).find("ul li:last-child span.to").text());
160
160
 
161
161
  $(container).find("ul li").each(function() {
162
- var from = parseInt($(this).find("span.from").text());
163
- var to = parseInt($(this).find("span.to").text());
164
- var count = parseInt($(this).find("span.count").text());
162
+ var from = BlacklightRangeLimit.parseNum($(this).find("span.from").text());
163
+ var to = BlacklightRangeLimit.parseNum($(this).find("span.to").text());
164
+ var count = BlacklightRangeLimit.parseNum($(this).find("span.count").text());
165
165
  var avg = (count / (to - from + 1));
166
166
 
167
167
 
@@ -174,7 +174,7 @@ Blacklight.onLoad(function() {
174
174
 
175
175
  pointer_lookup.push({'from': from, 'to': to, 'count': count, 'label': $(this).find(".facet_select").text() });
176
176
  });
177
- var max_plus_one = parseInt($(container).find("ul li:last-child span.to").text())+1;
177
+ var max_plus_one = BlacklightRangeLimit.parseNum($(container).find("ul li:last-child span.to").text())+1;
178
178
  x_ticks.push( max_plus_one );
179
179
 
180
180
 
@@ -205,7 +205,7 @@ Blacklight.onLoad(function() {
205
205
 
206
206
  if(segment != last_segment) {
207
207
  $('.distribution').tooltip('destroy');
208
- $('.distribution').tooltip({'title': function() { return find_segment_for(pos.x).label + ' (' + segment.count + ')' }, 'placement': 'bottom', 'trigger': 'manual', 'delay': { show: 0, hide: 100}});
208
+ $('.distribution').tooltip({'title': function() { return find_segment_for(pos.x).label + ' (' + BlacklightRangeLimit.parseNum(segment.count) + ')' }, 'placement': 'bottom', 'trigger': 'manual', 'delay': { show: 0, hide: 100}});
209
209
  $('.distribution').tooltip('show');
210
210
 
211
211
  last_segment = segment;
@@ -266,11 +266,11 @@ Blacklight.onLoad(function() {
266
266
  }
267
267
 
268
268
  function form_selection(form, min, max) {
269
- var begin_val = parseInt($(form).find("input.range_begin").val());
269
+ var begin_val = BlacklightRangeLimit.parseNum($(form).find("input.range_begin").val());
270
270
  if (isNaN(begin_val) || begin_val < min) {
271
271
  begin_val = min;
272
272
  }
273
- var end_val = parseInt($(form).find("input.range_end").val());
273
+ var end_val = BlacklightRangeLimit.parseNum($(form).find("input.range_end").val());
274
274
  if (isNaN(end_val) || end_val > max) {
275
275
  end_val = max;
276
276
  }
@@ -297,4 +297,4 @@ Blacklight.onLoad(function() {
297
297
 
298
298
  return (flotLoaded && canvasAvailable);
299
299
  }
300
- });
300
+ });
@@ -0,0 +1,24 @@
1
+
2
+ // takes a string and parses into an integer, but throws away commas first, to avoid truncation when there is a comma
3
+ // use in place of javascript's native parseInt
4
+ !function(global) {
5
+ 'use strict';
6
+
7
+ var previousBlacklightRangeLimit = global.BlacklightRangeLimit;
8
+
9
+ function BlacklightRangeLimit(options) {
10
+ this.options = options || {};
11
+ }
12
+
13
+ BlacklightRangeLimit.noConflict = function noConflict() {
14
+ global.BlacklightRangeLimit = previousBlacklightRangeLimit;
15
+ return BlacklightRangeLimit;
16
+ };
17
+
18
+ BlacklightRangeLimit.parseNum = function parseNum(str) {
19
+ str = String(str).replace(/[^0-9]/g, '');
20
+ return parseInt(str, 10);
21
+ };
22
+
23
+ global.BlacklightRangeLimit = BlacklightRangeLimit;
24
+ }(this);
@@ -50,7 +50,7 @@ $(".range_limit .profile .range.slider_js").each(function() {
50
50
  end_el.val(max);
51
51
 
52
52
  begin_el.change( function() {
53
- var val = parseInt($(this).val());
53
+ var val = BlacklightRangeLimit.parseNum($(this).val());
54
54
  if ( isNaN(val) || val < min) {
55
55
  //for weird data, set slider at min
56
56
  val = min;
@@ -61,7 +61,7 @@ $(".range_limit .profile .range.slider_js").each(function() {
61
61
  });
62
62
 
63
63
  end_el.change( function() {
64
- var val = parseInt($(this).val());
64
+ var val = BlacklightRangeLimit.parseNum($(this).val());
65
65
  if ( isNaN(val) || val > max ) {
66
66
  //weird entry, set slider to max
67
67
  val = max;
@@ -96,16 +96,16 @@ function min_max(range_element) {
96
96
 
97
97
 
98
98
 
99
- var min = max = parseInt(current_limit.find(".single").text())
99
+ var min = max = BlacklightRangeLimit.parseNum(current_limit.find(".single").text())
100
100
  if ( isNaN(min)) {
101
- min = parseInt(current_limit.find(".from").first().text());
102
- max = parseInt(current_limit.find(".to").first().text());
101
+ min = BlacklightRangeLimit.parseNum(current_limit.find(".from").first().text());
102
+ max = BlacklightRangeLimit.parseNum(current_limit.find(".to").first().text());
103
103
  }
104
104
 
105
105
  if (isNaN(min) || isNaN(max)) {
106
106
  //no current limit, take from results min max included in spans
107
- min = parseInt($(range_element).find(".min").first().text());
108
- max = parseInt($(range_element).find(".max").first().text());
107
+ min = BlacklightRangeLimit.parseNum($(range_element).find(".min").first().text());
108
+ max = BlacklightRangeLimit.parseNum($(range_element).find(".max").first().text());
109
109
  }
110
110
 
111
111
  return [min, max]
@@ -43,7 +43,7 @@ module BlacklightRangeLimit
43
43
  # Not really any good way to turn off facet.field's from the solr default,
44
44
  # no big deal it should be well-cached at this point.
45
45
 
46
- @response = Blacklight.solr.get( blacklight_config.solr_path, :params => solr_params )
46
+ @response = Blacklight.default_index.connection.get( blacklight_config.solr_path, :params => solr_params )
47
47
 
48
48
  render('blacklight_range_limit/range_segments', :locals => {:solr_field => solr_field}, :layout => !request.xhr?)
49
49
  end
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: 5.0.4
4
+ version: 5.1.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: 2015-03-24 00:00:00.000000000 Z
12
+ date: 2015-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -185,6 +185,7 @@ files:
185
185
  - VERSION
186
186
  - app/assets/javascripts/blacklight_range_limit.js
187
187
  - app/assets/javascripts/blacklight_range_limit/range_limit_distro_facets.js
188
+ - app/assets/javascripts/blacklight_range_limit/range_limit_shared.js
188
189
  - app/assets/javascripts/blacklight_range_limit/range_limit_slider.js
189
190
  - app/assets/stylesheets/blacklight_range_limit.css.scss
190
191
  - app/assets/stylesheets/blacklight_range_limit/blacklight_range_limit.css