glider-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ###
2
- glider 0.1.1 - AngularJS slider
2
+ glider 0.1.2 - 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.
@@ -59,7 +59,9 @@ app.directive 'slider', ['$document', ($document) ->
59
59
  link: (scope, element, attrs) ->
60
60
  parseIncrements = ->
61
61
  trim = (input) -> if input then input.replace(/^\s+|\s+$/g, '') else input
62
- offset = (min, max, value) -> value / Math.abs(max - min) * 100
62
+ offset = (min, max, value) ->
63
+ value = parseInt(value) - min
64
+ value / Math.abs(max - min) * 100
63
65
  if attrs.increments
64
66
  min = scope.min()
65
67
  max = scope.max()
@@ -1,6 +1,6 @@
1
1
  // Generated by CoffeeScript 1.6.3
2
2
  /*
3
- glider 0.1.1 - AngularJS slider
3
+ glider 0.1.2 - 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.
@@ -55,6 +55,7 @@
55
55
  }
56
56
  };
57
57
  offset = function(min, max, value) {
58
+ value = parseInt(value) - min;
58
59
  return value / Math.abs(max - min) * 100;
59
60
  };
60
61
  if (attrs.increments) {
@@ -263,3 +264,7 @@
263
264
  });
264
265
 
265
266
  }).call(this);
267
+
268
+ /*
269
+ //@ sourceMappingURL=glider.map
270
+ */
@@ -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 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)"></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);
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.1"
7
+ gem.version = "0.1.2"
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.1
4
+ version: 0.1.2
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-04 00:00:00.000000000 Z
13
+ date: 2013-10-09 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Glider, AngularJS UI slider for rails asset pipeline
16
16
  email: