glider-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,10 @@
|
|
1
1
|
###
|
2
|
-
glider 0.0.
|
2
|
+
glider 0.0.5 - 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.
|
6
6
|
###
|
7
|
+
'use strict';
|
7
8
|
app = angular.module("glider", [])
|
8
9
|
# example:
|
9
10
|
# <slider min="0" max="100" step="1" value="age"></slider>
|
@@ -27,11 +28,11 @@ app.directive "slider", ["$document", ($document) ->
|
|
27
28
|
</span>
|
28
29
|
<span class="side dec">
|
29
30
|
<span class="button" ng-click="step(-1)">-</span>
|
30
|
-
<span class="bound-value">{{min()}}</span>
|
31
|
+
<span class="bound-value">{{min() | slice}}</span>
|
31
32
|
</span>
|
32
33
|
<span class="side inc">
|
33
34
|
<span class="button" ng-click="step(+1)">+</span>
|
34
|
-
<span class="bound-value">{{max()}}</span>
|
35
|
+
<span class="bound-value">{{max() | slice}}</span>
|
35
36
|
</span>
|
36
37
|
</span>
|
37
38
|
"""
|
@@ -108,3 +109,12 @@ app.directive "slider", ["$document", ($document) ->
|
|
108
109
|
updateValue() if deferUpdate
|
109
110
|
$document.off "mousemove"
|
110
111
|
]
|
112
|
+
app.filter 'slice', ->
|
113
|
+
(input) ->
|
114
|
+
input = input.toString()
|
115
|
+
reverse = (input) -> input.split('').reverse().join('')
|
116
|
+
reversed = reverse(input)
|
117
|
+
reversed_and_sliced = reversed.replace(/(.{3})/g, '$1 ')
|
118
|
+
sliced = reverse(reversed_and_sliced)
|
119
|
+
sliced.trim()
|
120
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// Generated by CoffeeScript 1.6.3
|
2
2
|
/*
|
3
|
-
glider 0.0.
|
3
|
+
glider 0.0.5 - 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.
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
(function() {
|
11
|
+
'use strict';
|
11
12
|
var app;
|
12
13
|
|
13
14
|
app = angular.module("glider", []);
|
@@ -23,7 +24,7 @@
|
|
23
24
|
return angular.element(getSubElement(elem, "range")).css("width", "" + posX + "%");
|
24
25
|
};
|
25
26
|
return {
|
26
|
-
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()}}</span>\n </span>\n <span class=\"side inc\">\n <span class=\"button\" ng-click=\"step(+1)\">+</span>\n <span class=\"bound-value\">{{max()}}</span>\n </span>\n</span>",
|
27
|
+
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() | slice}}</span>\n </span>\n <span class=\"side inc\">\n <span class=\"button\" ng-click=\"step(+1)\">+</span>\n <span class=\"bound-value\">{{max() | slice}}</span>\n </span>\n</span>",
|
27
28
|
replace: true,
|
28
29
|
restrict: "E",
|
29
30
|
scope: {
|
@@ -119,4 +120,18 @@
|
|
119
120
|
}
|
120
121
|
]);
|
121
122
|
|
123
|
+
app.filter('slice', function() {
|
124
|
+
return function(input) {
|
125
|
+
var reverse, reversed, reversed_and_sliced, sliced;
|
126
|
+
input = input.toString();
|
127
|
+
reverse = function(input) {
|
128
|
+
return input.split('').reverse().join('');
|
129
|
+
};
|
130
|
+
reversed = reverse(input);
|
131
|
+
reversed_and_sliced = reversed.replace(/(.{3})/g, '$1 ');
|
132
|
+
sliced = reverse(reversed_and_sliced);
|
133
|
+
return sliced.trim();
|
134
|
+
};
|
135
|
+
});
|
136
|
+
|
122
137
|
}).call(this);
|
@@ -1 +1 @@
|
|
1
|
-
!function(){var
|
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() | slice}}</span>\n </span>\n <span class="side inc">\n <span class="button" ng-click="step(+1)">+</span>\n <span class="bound-value">{{max() | slice}}</span>\n </span>\n</span>',replace:!0,restrict:"E",scope:{value:"=",min:"&",max:"&"},link:function(s,t,u){var r,l,i,c,o,p;return c=e(t,"slider"),l=!1,p=0,o=null!=u.step?parseInt(u.step,10):1,r=null!=u.deferUpdate,null==s.value&&(s.value=s.min()),i=function(){var n;return n=s.max()-s.min(),0===n?p=0:(p=100*((s.value-s.min())/n),p=Math.min(Math.max(0,p),100)),a(t,p)},s.$watch("min()",function(n){return s.value<n?s.value=n:i()}),s.$watch("max()",function(n){return s.value>n?s.value=n:i()}),s.$watch("value",function(){return l?void 0:i()}),s.step=function(n){var e;return e=s.value+n*o,s.min()<=e&&e<=s.max()?s.value=e:void 0},s.mouseDown=function(e){var u,i;return l=!0,u=e.pageX,i=function(){return s.value=Math.round(((s.max()-s.min())*(p/100)+s.min())/o)*o,s.$apply()},n.on("mousemove",function(n){var e;if(l)return e=n.pageX-u,p+=100*(e/c.offsetWidth),0>p?p=0:p>100?p=100:u=n.pageX,r||i(),a(t,p)}),n.on("mouseup",function(){return l=!1,r&&i(),n.off("mousemove")})}}}}]),n.filter("slice",function(){return function(n){var e,a,s,t;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.0.
|
7
|
+
gem.version = "0.0.5"
|
8
8
|
gem.authors = ["Valentin Vasilyev", "Dmitry 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.0.
|
4
|
+
version: 0.0.5
|
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-09-
|
13
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Glider, AngularJS UI slider for rails asset pipeline
|
16
16
|
email:
|