bootstrap-slider-rails 5.1.1 → 5.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef1225eb6566694b65ce0ed0ee87be7dc0b2228a
4
- data.tar.gz: a4e3b94bfd3fefb14256d769b8a647488ca39732
3
+ metadata.gz: 90123995000b4f3d34b11d73779582b9601e2b12
4
+ data.tar.gz: b2b7fd3bccf4950d22ba5549a5187335320fad30
5
5
  SHA512:
6
- metadata.gz: 0b5916059d8a52c8c18217fa3597412c107f61e974d180ded12c91d92c3382ba15581d67e894993f1fab81971bd9b14ff0ce89b5fa4b17e83ccdb8b0d9e12fae
7
- data.tar.gz: e473977a2f3f90efbd835bf5deedc1052275dddb65507875272f44b1dcd16cfe5cb3e3736d18ea225ab1453075ff2289ceb7aca24934fc9d7a6d58ea67371162
6
+ metadata.gz: 6d46482d300fadb9c51b0ba101766eabe7abb23945e7c309f966e84d352f46b0e008e48d5ede04f6190540d106b60b206b7414b4380a21deaed1b0cb4fe81cf2
7
+ data.tar.gz: 757e882d5581d7b8116afe8602b4d0c92c59dbb857832efa27aeed926321c0cca924071b5a87c7f053ecec2caea995cd3293dfcfcff51d199957c59fc0b670e1
@@ -1,5 +1,5 @@
1
1
  module BootstrapSlider
2
2
  module Rails
3
- VERSION = '5.1.1'
3
+ VERSION = '5.2.1'
4
4
  end
5
5
  end
@@ -448,8 +448,10 @@
448
448
 
449
449
  for (i = 0; i < this.options.ticks_labels.length; i++) {
450
450
  var label = document.createElement('div');
451
+ var noTickPositionsSpecified = this.options.ticks_positions.length === 0;
452
+ var tickLabelsIndex = (this.options.reversed && noTickPositionsSpecified) ? (this.options.ticks_labels.length - (i + 1)) : i;
451
453
  label.className = 'slider-tick-label';
452
- label.innerHTML = this.options.ticks_labels[i];
454
+ label.innerHTML = this.options.ticks_labels[tickLabelsIndex];
453
455
 
454
456
  this.tickLabels.push(label);
455
457
  this.tickLabelContainer.appendChild(label);
@@ -857,14 +859,14 @@
857
859
  return this;
858
860
  },
859
861
 
860
- off: function(evt, callback) {
861
- if($) {
862
- this.$element.off(evt, callback);
863
- this.$sliderElem.off(evt, callback);
864
- } else {
865
- this._unbindNonQueryEventHandler(evt, callback);
866
- }
867
- },
862
+ off: function(evt, callback) {
863
+ if($) {
864
+ this.$element.off(evt, callback);
865
+ this.$sliderElem.off(evt, callback);
866
+ } else {
867
+ this._unbindNonQueryEventHandler(evt, callback);
868
+ }
869
+ },
868
870
 
869
871
  getAttribute: function(attribute) {
870
872
  if(attribute) {
@@ -980,8 +982,6 @@
980
982
 
981
983
  /* Position ticks and labels */
982
984
  if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
983
- var maxTickValue = Math.max.apply(Math, this.options.ticks);
984
- var minTickValue = Math.min.apply(Math, this.options.ticks);
985
985
 
986
986
  var styleSize = this.options.orientation === 'vertical' ? 'height' : 'width';
987
987
  var styleMargin = this.options.orientation === 'vertical' ? 'marginTop' : 'marginLeft';
@@ -1006,8 +1006,11 @@
1006
1006
  }
1007
1007
  for (var i = 0; i < this.options.ticks.length; i++) {
1008
1008
 
1009
- var percentage = this.options.ticks_positions[i] ||
1010
- 100 * (this.options.ticks[i] - minTickValue) / (maxTickValue - minTickValue);
1009
+ var percentage = this.options.ticks_positions[i] || this._toPercentage(this.options.ticks[i]);
1010
+
1011
+ if (this.options.reversed) {
1012
+ percentage = 100 - percentage;
1013
+ }
1011
1014
 
1012
1015
  this.ticks[i].style[this.stylePos] = percentage + '%';
1013
1016
 
@@ -1028,7 +1031,7 @@
1028
1031
 
1029
1032
  if (this.options.ticks_positions[i] !== undefined) {
1030
1033
  this.tickLabels[i].style.position = 'absolute';
1031
- this.tickLabels[i].style[this.stylePos] = this.options.ticks_positions[i] + '%';
1034
+ this.tickLabels[i].style[this.stylePos] = percentage + '%';
1032
1035
  this.tickLabels[i].style[styleMargin] = -labelSize/2 + 'px';
1033
1036
  }
1034
1037
  }
@@ -1,5 +1,5 @@
1
1
  /*! =======================================================
2
- VERSION 5.1.1
2
+ VERSION 5.2.1
3
3
  ========================================================= */
4
4
  /*! =========================================================
5
5
  * bootstrap-slider.js
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-slider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedr Browne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties