glider-rails 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Glider - angularjs UI slider
2
2
 
3
- Glider - angularjs slider with no dependencies. Dead simple - ~~74~~ 98 LOC.
3
+ Glider - angularjs slider with no dependencies. Dead simple - ~~74~~ ~~98~~ 165 LOC.
4
4
 
5
5
  ## Demo
6
6
 
@@ -47,6 +47,18 @@ To defer value update until `mouseup`:
47
47
  <slider defer_update min="21" max="130" value="age"></slider>
48
48
  ```
49
49
 
50
+ Show value in handle:
51
+
52
+ ```html
53
+ <slider show_value_in_handle min="21" max="130" value="age"></slider>
54
+ ```
55
+
56
+ Use increments with snapping:
57
+
58
+ ```html
59
+ <slider min="50" max="500" increments="100,200,300,400" value="price"></slider>
60
+ ```
61
+
50
62
  ## CoffeeScript to JavaScript compilation
51
63
 
52
64
  To convert the `src/glider.coffee` to javascript, use coffeescript compiler.
@@ -59,10 +71,10 @@ npm -g install coffee-script
59
71
  Then compile the file with:
60
72
 
61
73
  ```
62
- coffee -c -o . src/glider.coffee
74
+ coffee -c -o . --map src/glider.coffee
63
75
  ```
64
76
 
65
- This will compile the src/glider.coffee to glider.js
77
+ This will compile the src/glider.coffee to glider.js and generate the source map.
66
78
 
67
79
  ## Minification
68
80
 
@@ -89,13 +101,13 @@ online services, such as [Google Closure compiler][closure]
89
101
  * Valve - Valentin Vasilyev
90
102
  * KODerFunk - Dmitry Karpunin
91
103
 
92
- Inspired by a plunkr snippet
104
+ Inspired by an anonymous plunkr snippet
93
105
 
94
106
  ### Licence
95
107
 
96
108
  This code is [MIT][mit] licenced:
97
109
 
98
- Copyright (c) 2013 Valentin Vasilyev, Dmitry Karpunin
110
+ Copyright (c) 2013 Valentin Valve Vasilyev, Dmitry KODer Karpunin
99
111
 
100
112
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
101
113
 
@@ -1,5 +1,5 @@
1
1
  ###
2
- glider 0.1.2 - AngularJS slider
2
+ glider 0.1.3 - AngularJS slider
3
3
  https://github.com/evrone/glider
4
4
  Copyright (c) 2013 Valentin Vasilyev, Dmitry Karpunin
5
5
  Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
@@ -9,16 +9,19 @@
9
9
  basic:
10
10
  <slider min="0" max="100" step="1" value="age"></slider>
11
11
 
12
- update only on mouse up
12
+ update only on mouse up:
13
13
  <slider defer_update min="0" max="100" step="1" value="age"></slider>
14
14
 
15
+ show value in handle:
16
+ <slider show_value_in_handle min="0" max="100" step="1" value="age"></slider>
17
+
15
18
  slider with increments (incompatible with step option)
16
19
  <slider min="0" max="100" increments="10,50,60,90"></slider>
17
20
  ###
18
21
  'use strict';
19
- app = angular.module("glider", [])
22
+ gliderModule = angular.module('glider', [])
20
23
 
21
- app.directive 'slider', ['$document', ($document) ->
24
+ gliderModule.directive 'slider', ['$document', ($document) ->
22
25
 
23
26
  getSubElement = (sliderElement, className) ->
24
27
  sliderElement[0].getElementsByClassName(className)[0]
@@ -31,7 +34,9 @@ app.directive 'slider', ['$document', ($document) ->
31
34
  <span class="g-slider horizontal">
32
35
  <span class="slider">
33
36
  <span class="range"></span>
34
- <span class="handle" ng-mousedown="mouseDown($event)"></span>
37
+ <span class="handle" ng-mousedown="mouseDown($event)">
38
+ <span class="value" ng-show="showValueInHandle">{{value | intersperse}}</span>
39
+ </span>
35
40
  </span>
36
41
  <span class="side dec">
37
42
  <span class="button" ng-click="step(-1)">-</span>
@@ -80,6 +85,7 @@ app.directive 'slider', ['$document', ($document) ->
80
85
  xPosition = 0
81
86
  step = if attrs.step? then parseInt(attrs.step, 10) else 1
82
87
  deferUpdate = attrs.deferUpdate?
88
+ scope.showValueInHandle = attrs.showValueInHandle?
83
89
 
84
90
  scope.value = scope.min() unless scope.value?
85
91
 
@@ -134,6 +140,7 @@ app.directive 'slider', ['$document', ($document) ->
134
140
 
135
141
 
136
142
  scope.mouseDown = ($event) ->
143
+ return unless angular.element($event.target).hasClass('handle')
137
144
  dragging = true
138
145
  startPointX = $event.pageX
139
146
 
@@ -174,7 +181,7 @@ app.directive 'slider', ['$document', ($document) ->
174
181
  snap() if scope.increments
175
182
  $document.off 'mousemove'
176
183
  ]
177
- app.filter 'intersperse', ->
184
+ gliderModule.filter 'intersperse', ->
178
185
  (input) ->
179
186
  return unless input?
180
187
  input = input.toString()
@@ -1,6 +1,6 @@
1
1
  // Generated by CoffeeScript 1.6.3
2
2
  /*
3
- glider 0.1.2 - AngularJS slider
3
+ glider 0.1.3 - AngularJS slider
4
4
  https://github.com/evrone/glider
5
5
  Copyright (c) 2013 Valentin Vasilyev, Dmitry Karpunin
6
6
  Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
@@ -10,9 +10,12 @@
10
10
  basic:
11
11
  <slider min="0" max="100" step="1" value="age"></slider>
12
12
 
13
- update only on mouse up
13
+ update only on mouse up:
14
14
  <slider defer_update min="0" max="100" step="1" value="age"></slider>
15
15
 
16
+ show value in handle:
17
+ <slider show_value_in_handle min="0" max="100" step="1" value="age"></slider>
18
+
16
19
  slider with increments (incompatible with step option)
17
20
  <slider min="0" max="100" increments="10,50,60,90"></slider>
18
21
  */
@@ -20,11 +23,11 @@
20
23
 
21
24
  (function() {
22
25
  'use strict';
23
- var app;
26
+ var gliderModule;
24
27
 
25
- app = angular.module("glider", []);
28
+ gliderModule = angular.module('glider', []);
26
29
 
27
- app.directive('slider', [
30
+ gliderModule.directive('slider', [
28
31
  '$document', function($document) {
29
32
  var getSubElement, moveHandle;
30
33
  getSubElement = function(sliderElement, className) {
@@ -35,7 +38,7 @@
35
38
  return angular.element(getSubElement(elem, 'range')).css('width', "" + posX + "%");
36
39
  };
37
40
  return {
38
- template: "<span class=\"g-slider horizontal\">\n <span class=\"slider\">\n <span class=\"range\"></span>\n <span class=\"handle\" ng-mousedown=\"mouseDown($event)\"></span>\n </span>\n <span class=\"side dec\">\n <span class=\"button\" ng-click=\"step(-1)\">-</span>\n <span class=\"bound-value\">{{min() | intersperse}}</span>\n </span>\n <span class=\"side inc\">\n <span class=\"button\" ng-click=\"step(+1)\">+</span>\n <span class=\"bound-value\">{{max() | intersperse}}</span>\n </span>\n <span class=\"increments\">\n <span ng-repeat=\"i in increments\" class=\"i\" style=\"left: {{i.offset}}%\">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>",
41
+ template: "<span class=\"g-slider horizontal\">\n <span class=\"slider\">\n <span class=\"range\"></span>\n <span class=\"handle\" ng-mousedown=\"mouseDown($event)\">\n <span class=\"value\" ng-show=\"showValueInHandle\">{{value | intersperse}}</span>\n </span>\n </span>\n <span class=\"side dec\">\n <span class=\"button\" ng-click=\"step(-1)\">-</span>\n <span class=\"bound-value\">{{min() | intersperse}}</span>\n </span>\n <span class=\"side inc\">\n <span class=\"button\" ng-click=\"step(+1)\">+</span>\n <span class=\"bound-value\">{{max() | intersperse}}</span>\n </span>\n <span class=\"increments\">\n <span ng-repeat=\"i in increments\" class=\"i\" style=\"left: {{i.offset}}%\">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>",
39
42
  replace: true,
40
43
  restrict: "E",
41
44
  scope: {
@@ -99,6 +102,7 @@
99
102
  xPosition = 0;
100
103
  step = attrs.step != null ? parseInt(attrs.step, 10) : 1;
101
104
  deferUpdate = attrs.deferUpdate != null;
105
+ scope.showValueInHandle = attrs.showValueInHandle != null;
102
106
  if (scope.value == null) {
103
107
  scope.value = scope.min();
104
108
  }
@@ -187,6 +191,9 @@
187
191
  };
188
192
  return scope.mouseDown = function($event) {
189
193
  var snap, startPointX, updateValue;
194
+ if (!angular.element($event.target).hasClass('handle')) {
195
+ return;
196
+ }
190
197
  dragging = true;
191
198
  startPointX = $event.pageX;
192
199
  updateValue = function() {
@@ -246,7 +253,7 @@
246
253
  }
247
254
  ]);
248
255
 
249
- app.filter('intersperse', function() {
256
+ gliderModule.filter('intersperse', function() {
250
257
  return function(input) {
251
258
  var reverse, reversed, reversed_and_sliced, sliced;
252
259
  if (input == null) {
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "file": "glider.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "src/glider.coffee"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";AAAA;;;;;;;;;;;;;;;;;;;;CAAA;CAAA;CAAA;CAAA,CAoBA,UApBA;CAAA,KAAA,MAAA;;CAAA,CAqBA,CAAe,GAAA,CAAO,CAAP,IAAf;;CArBA,CAuBA,MAAA,CAAA,GAAY;EAAmC,CAAA,EAAb,IAAc,EAAf;CAE/B,SAAA,eAAA;CAAA,CAAgC,CAAhB,GAAhB,GAAiB,IAAjB;CACgB,QAAd,IAAc,EAAd,OAAA;CADF,MAAgB;CAAhB,CAGoB,CAAP,CAAA,EAAb,GAAc,CAAd;CACE,CAAoC,CAApC,CAAgB,EAAhB,CAAO,CAAP,KAAgB;CACR,CAA4B,CAApC,CAAgB,GAAT,MAAS,EAAhB;CALF,MAGa;aAIb;CAAA,CAAU,MAAV,2wBAAA;CAAA,CAwBS,EAxBT,GAwBA,CAAA;CAxBA,CAyBU,CAzBV,KAyBA;CAzBA,CA2BE,GADF,GAAA;CACE,CAAO,CAAP,EAAA,KAAA;CAAA,CACK,CAAL,OAAA;CADA,CAEK,CAAL,OAAA;UA7BF;CAAA,CA+BM,CAAA,CAAN,CAAM,EAAA,CAAN,CAAO;CACL,aAAA,yFAAA;CAAA,EAAkB,MAAA,CAAlB,KAAA;CACE,eAAA,qBAAA;CAAA,EAAO,CAAP,CAAO,IAAC,GAAR;CAAkB,GAAG,CAAH,SAAA;CAAoB,CAAsB,GAAvB,EAAL,KAAA,WAAA;MAAd,UAAA;CAAA,sBAAmD;gBAA9D;CAAP,YAAO;CAAP,CACe,CAAN,EAAA,CAAT,GAAU,GAAV;CACE,EAAQ,EAAR,GAAQ,MAAR;CACa,EAAL,C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,MAAA;CACA,GAAiB,OAAjB,GAAA;CAAA,UAAA,KAAA;gBADA;CAEA,GAAU,CAAK,KAAf,IAAA;CAAA,GAAA,YAAA;gBAFA;CAGU,EAAV,MAAS,EAAT,UAAA;CAJF,YAAwB;CAlHtB,UA8Ec;CA7GpB,QA+BM;CAxCuC;CAAd,IAAc;CAvB/C,GAuBA;;CAvBA,CAuLA,CAAmC,GAAnC,GAAmC,GAAvB,CAAZ;GACE,EAAA,IAAC,EAAD;CACE,SAAA,oCAAA;CAAA,GAAc,EAAd,OAAA;CAAA,aAAA;QAAA;CAAA,EACQ,EAAR,CAAA,EAAQ;CADR,EAEU,EAAA,CAAV,CAAA,EAAW;CAAgB,CAAN,EAAA,CAAK,EAAL,QAAA;CAFrB,MAEU;CAFV,EAGW,EAAA,CAAX,CAAW,CAAX;CAHA,CAIkD,CAA5B,EAAA,CAAtB,CAAsB,CAAQ,CAAR,UAAtB;CAJA,EAKS,GAAT,CAAS,YAAA;CACF,GAAP,EAAM,OAAN;CAR+B,IACjC;CADF,EAAmC;CAvLnC"
10
+ }
@@ -1 +1 @@
1
- !function(){"use strict";var n;n=angular.module("glider",[]),n.directive("slider",["$document",function(n){var e,a;return e=function(n,e){return n[0].getElementsByClassName(e)[0]},a=function(n,a){return angular.element(e(n,"handle")).css("left",""+a+"%"),angular.element(e(n,"range")).css("width",""+a+"%")},{template:'<span class="g-slider horizontal">\n <span class="slider">\n <span class="range"></span>\n <span class="handle" ng-mousedown="mouseDown($event)"></span>\n </span>\n <span class="side dec">\n <span class="button" ng-click="step(-1)">-</span>\n <span class="bound-value">{{min() | intersperse}}</span>\n </span>\n <span class="side inc">\n <span class="button" ng-click="step(+1)">+</span>\n <span class="bound-value">{{max() | intersperse}}</span>\n </span>\n <span class="increments">\n <span ng-repeat="i in increments" class="i" style="left: {{i.offset}}%">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>',replace:!0,restrict:"E",scope:{value:"=",min:"&",max:"&"},link:function(t,r,s){var u,i,l,c,o,p,f,m;return c=function(){var n,e,a,r,u,i;return i=function(n){return n?n.replace(/^\s+|\s+$/g,""):n},u=function(n,e,a){return a=parseInt(a)-n,100*(a/Math.abs(e-n))},s.increments?(r=t.min(),a=t.max(),e=s.increments.split(","),e=function(){var t,s,l,c;for(c=[],t=0,s=e.length;s>t;t++)n=e[t],r<(l=parseInt(n))&&a>l&&c.push({value:parseInt(i(n),10),offset:u(r,a,n)});return c}()):void 0},u=function(n){var e;return null!=s.increments?[t.min(),t.max()].concat(function(){var a,t,r;for(r=[],a=0,t=n.length;t>a;a++)e=n[a],r.push(e.value);return r}()).sort(function(n,e){return n-e}):void 0},p=e(r,"slider"),l=!1,m=0,f=null!=s.step?parseInt(s.step,10):1,i=null!=s.deferUpdate,null==t.value&&(t.value=t.min()),t.increments=c(s.increments),t.snapValues=u(t.increments),o=function(){var n;return n=t.max()-t.min(),0===n?m=0:(m=100*((t.value-t.min())/n),m=Math.min(Math.max(0,m),100)),a(r,m)},t.$watch("min()",function(n){return t.value<n?t.value=n:o()}),t.$watch("max()",function(n){return t.value>n?t.value=n:o()}),t.$watch("value",function(n,e){return l?void 0:t.min()<=n&&n<=t.max()?o():n=e}),t.step=function(n){var e,a;return a=function(n){var e;return e=t.value+n*f,t.min()<=e&&e<=t.max()?t.value=e:void 0},e=function(n){var e,a;return e=n>0?function(){var n,e,r,s;for(r=t.snapValues,s=[],n=0,e=r.length;e>n;n++)a=r[n],a>t.value&&s.push(a);return s}()[0]:function(){var n,e,r,s;for(r=t.snapValues,s=[],n=0,e=r.length;e>n;n++)a=r[n],a<t.value&&s.push(a);return s}().sort(function(n,e){return e-n})[0],null!=e?t.value=e:void 0},null!=s.increments?e(n):a(n)},t.mouseDown=function(e){var s,u,c;return l=!0,u=e.pageX,c=function(){return t.value=Math.round(((t.max()-t.min())*(m/100)+t.min())/f)*f,t.$apply()},s=function(){var n,e,a,r,s;for(a=0,r=t.snapValues.length;r>a;)e=Math.abs(t.snapValues[a]-t.value),("undefined"==typeof s||null===s)&&(s=e),s>=e&&(n=t.snapValues[a],s=e),a++;return t.value=n,t.$apply()},n.on("mousemove",function(n){var e;if(l)return e=n.pageX-u,m+=100*(e/p.offsetWidth),0>m?m=0:m>100?m=100:u=n.pageX,i||c(),a(r,m)}),n.on("mouseup",function(){return l=!1,i&&c(),t.increments&&s(),n.off("mousemove")})}}}}]),n.filter("intersperse",function(){return function(n){var e,a,t,r;if(null!=n)return n=n.toString(),e=function(n){return n.split("").reverse().join("")},a=e(n),t=a.replace(/(.{3})/g,"$1 "),r=e(t),r.trim()}})}.call(this);
1
+ (function(){"use strict";var n;n=angular.module("glider",[]),n.directive("slider",["$document",function(n){var e,a;return e=function(n,e){return n[0].getElementsByClassName(e)[0]},a=function(n,a){return angular.element(e(n,"handle")).css("left",""+a+"%"),angular.element(e(n,"range")).css("width",""+a+"%")},{template:'<span class="g-slider horizontal">\n <span class="slider">\n <span class="range"></span>\n <span class="handle" ng-mousedown="mouseDown($event)">\n <span class="value" ng-show="showValueInHandle">{{value | intersperse}}</span>\n </span>\n </span>\n <span class="side dec">\n <span class="button" ng-click="step(-1)">-</span>\n <span class="bound-value">{{min() | intersperse}}</span>\n </span>\n <span class="side inc">\n <span class="button" ng-click="step(+1)">+</span>\n <span class="bound-value">{{max() | intersperse}}</span>\n </span>\n <span class="increments">\n <span ng-repeat="i in increments" class="i" style="left: {{i.offset}}%">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>',replace:!0,restrict:"E",scope:{value:"=",min:"&",max:"&"},link:function(s,t,r){var u,l,i,o,c,p,f,v;return o=function(){var n,e,a,t,u,l;return l=function(n){return n?n.replace(/^\s+|\s+$/g,""):n},u=function(n,e,a){return a=parseInt(a)-n,100*(a/Math.abs(e-n))},r.increments?(t=s.min(),a=s.max(),e=r.increments.split(","),e=function(){var s,r,i,o;for(o=[],s=0,r=e.length;r>s;s++)n=e[s],t<(i=parseInt(n))&&a>i&&o.push({value:parseInt(l(n),10),offset:u(t,a,n)});return o}()):void 0},u=function(n){var e;return null!=r.increments?[s.min(),s.max()].concat(function(){var a,s,t;for(t=[],a=0,s=n.length;s>a;a++)e=n[a],t.push(e.value);return t}()).sort(function(n,e){return n-e}):void 0},p=e(t,"slider"),i=!1,v=0,f=null!=r.step?parseInt(r.step,10):1,l=null!=r.deferUpdate,s.showValueInHandle=null!=r.showValueInHandle,null==s.value&&(s.value=s.min()),s.increments=o(r.increments),s.snapValues=u(s.increments),c=function(){var n;return n=s.max()-s.min(),0===n?v=0:(v=100*((s.value-s.min())/n),v=Math.min(Math.max(0,v),100)),a(t,v)},s.$watch("min()",function(n){return s.value<n?s.value=n:c()}),s.$watch("max()",function(n){return s.value>n?s.value=n:c()}),s.$watch("value",function(n,e){return i?void 0:s.min()<=n&&n<=s.max()?c():n=e}),s.step=function(n){var e,a;return a=function(n){var e;return e=s.value+n*f,s.min()<=e&&e<=s.max()?s.value=e:void 0},e=function(n){var e,a;return e=n>0?function(){var n,e,t,r;for(t=s.snapValues,r=[],n=0,e=t.length;e>n;n++)a=t[n],a>s.value&&r.push(a);return r}()[0]:function(){var n,e,t,r;for(t=s.snapValues,r=[],n=0,e=t.length;e>n;n++)a=t[n],a<s.value&&r.push(a);return r}().sort(function(n,e){return e-n})[0],null!=e?s.value=e:void 0},null!=r.increments?e(n):a(n)},s.mouseDown=function(e){var r,u,o;if(angular.element(e.target).hasClass("handle"))return i=!0,u=e.pageX,o=function(){return s.value=Math.round(((s.max()-s.min())*(v/100)+s.min())/f)*f,s.$apply()},r=function(){var n,e,a,t,r;for(a=0,t=s.snapValues.length;t>a;)e=Math.abs(s.snapValues[a]-s.value),("undefined"==typeof r||null===r)&&(r=e),r>=e&&(n=s.snapValues[a],r=e),a++;return s.value=n,s.$apply()},n.on("mousemove",function(n){var e;if(i)return e=n.pageX-u,v+=100*(e/p.offsetWidth),0>v?v=0:v>100?v=100:u=n.pageX,l||o(),a(t,v)}),n.on("mouseup",function(){return i=!1,l&&o(),s.increments&&r(),n.off("mousemove")})}}}}]),n.filter("intersperse",function(){return function(n){var e,a,s,t;if(null!=n)return n=n.toString(),e=function(n){return n.split("").reverse().join("")},a=e(n),s=a.replace(/(.{3})/g,"$1 "),t=e(s),t.trim()}})}).call(this);
data/glider-rails.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "glider-rails"
7
- gem.version = "0.1.2"
7
+ gem.version = "0.1.3"
8
8
  gem.authors = ["Valentin Valve Vasilyev", "Dmitry KODer Karpunin"]
9
9
  gem.email = ["iamvalentin@gmail.com", "koderfunk@gmail.com"]
10
10
  gem.description = "Glider, AngularJS UI slider for rails asset pipeline"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-09 00:00:00.000000000 Z
13
+ date: 2013-10-22 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Glider, AngularJS UI slider for rails asset pipeline
16
16
  email:
@@ -27,6 +27,7 @@ files:
27
27
  - Rakefile
28
28
  - app/assets/javascripts/glider.coffee
29
29
  - app/assets/javascripts/glider.js
30
+ - app/assets/javascripts/glider.map
30
31
  - app/assets/javascripts/glider.min.js
31
32
  - glider-rails.gemspec
32
33
  - lib/glider-rails.rb
@@ -51,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  version: '0'
52
53
  requirements: []
53
54
  rubyforge_project:
54
- rubygems_version: 1.8.23
55
+ rubygems_version: 1.8.25
55
56
  signing_key:
56
57
  specification_version: 3
57
58
  summary: Glider — AngularJS UI slider library, packaged for Ruby-on-Rails asset pipeline