Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
i20rzslider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jedife
i20rzslider
Commits
13c6dbfd
Commit
13c6dbfd
authored
Mar 11, 2016
by
Parrish, Nathaniel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support translation functions for sliders with steps
parent
8946cc88
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
19 deletions
+47
-19
rzslider.css
dist/rzslider.css
+5
-5
rzslider.js
dist/rzslider.js
+12
-7
rzslider.min.css
dist/rzslider.min.css
+2
-2
rzslider.min.js
dist/rzslider.min.js
+2
-2
rzslider.js
src/rzslider.js
+8
-3
options-handling-test.js
tests/specs/options-handling-test.js
+18
-0
No files found.
dist/rzslider.css
View file @
13c6dbfd
/*! angularjs-slider - v2.10.4 -
/*! angularjs-slider - v2.10.4 -
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
https://github.com/angular-slider/angularjs-slider -
https://github.com/angular-slider/angularjs-slider -
2016-03-
16
*/
2016-03-
28
*/
rzslider
{
rzslider
{
position
:
relative
;
position
:
relative
;
display
:
inline-block
;
display
:
inline-block
;
...
...
dist/rzslider.js
View file @
13c6dbfd
/*! angularjs-slider - v2.10.4 -
/*! angularjs-slider - v2.10.4 -
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
https://github.com/angular-slider/angularjs-slider -
https://github.com/angular-slider/angularjs-slider -
2016-03-
16
*/
2016-03-
28
*/
/*jslint unparam: true */
/*jslint unparam: true */
/*global angular: false, console: false, define, module */
/*global angular: false, console: false, define, module */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
...
@@ -423,9 +423,14 @@
...
@@ -423,9 +423,14 @@
this
.
options
.
floor
=
0
;
this
.
options
.
floor
=
0
;
this
.
options
.
ceil
=
this
.
options
.
stepsArray
.
length
-
1
;
this
.
options
.
ceil
=
this
.
options
.
stepsArray
.
length
-
1
;
this
.
options
.
step
=
1
;
this
.
options
.
step
=
1
;
if
(
this
.
options
.
translate
)
{
this
.
customTrFn
=
this
.
options
.
translate
;
}
else
{
this
.
customTrFn
=
function
(
value
)
{
this
.
customTrFn
=
function
(
value
)
{
return
this
.
options
.
stepsArray
[
value
];
return
this
.
options
.
stepsArray
[
value
];
};
};
}
}
else
if
(
this
.
options
.
translate
)
}
else
if
(
this
.
options
.
translate
)
this
.
customTrFn
=
this
.
options
.
translate
;
this
.
customTrFn
=
this
.
options
.
translate
;
else
else
...
...
dist/rzslider.min.css
View file @
13c6dbfd
/*! angularjs-slider - v2.10.4 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> - https://github.com/angular-slider/angularjs-slider - 2016-03-
16
*/
/*! angularjs-slider - v2.10.4 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> - https://github.com/angular-slider/angularjs-slider - 2016-03-
28
*/
rzslider
{
position
:
relative
;
display
:
inline-block
;
width
:
100%
;
height
:
4px
;
margin
:
35px
0
15px
0
;
vertical-align
:
middle
;
-webkit-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
user-select
:
none
}
rzslider
[
disabled
]
{
cursor
:
not-allowed
}
rzslider
[
disabled
]
.rz-pointer
{
cursor
:
not-allowed
;
background-color
:
#d8e0f3
}
rzslider
span
{
position
:
absolute
;
display
:
inline-block
;
white-space
:
nowrap
}
rzslider
.rz-base
{
width
:
100%
;
height
:
100%
;
padding
:
0
}
rzslider
.rz-bar-wrapper
{
left
:
0
;
z-index
:
1
;
width
:
100%
;
height
:
32px
;
padding-top
:
16px
;
margin-top
:
-16px
;
box-sizing
:
border-box
}
rzslider
.rz-bar-wrapper.rz-draggable
{
cursor
:
move
}
rzslider
.rz-bar
{
left
:
0
;
z-index
:
1
;
width
:
100%
;
height
:
4px
;
background
:
#d8e0f3
;
-webkit-border-radius
:
2px
;
-moz-border-radius
:
2px
;
border-radius
:
2px
}
rzslider
.rz-bar.rz-selection
{
z-index
:
2
;
background
:
#0db9f0
;
-webkit-border-radius
:
2px
;
-moz-border-radius
:
2px
;
border-radius
:
2px
}
rzslider
.rz-pointer
{
top
:
-14px
;
z-index
:
3
;
width
:
32px
;
height
:
32px
;
cursor
:
pointer
;
background-color
:
#0db9f0
;
-webkit-border-radius
:
16px
;
-moz-border-radius
:
16px
;
border-radius
:
16px
}
rzslider
.rz-pointer
:after
{
position
:
absolute
;
top
:
12px
;
left
:
12px
;
width
:
8px
;
height
:
8px
;
background
:
#fff
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
content
:
''
}
rzslider
.rz-pointer
:hover:after
{
background-color
:
#fff
}
rzslider
.rz-pointer.rz-active
{
z-index
:
4
}
rzslider
.rz-pointer.rz-active
:after
{
background-color
:
#451aff
}
rzslider
.rz-bubble
{
bottom
:
16px
;
padding
:
1px
3px
;
color
:
#55637d
;
cursor
:
default
}
rzslider
.rz-bubble.rz-selection
{
top
:
16px
}
rzslider
.rz-bubble.rz-limit
{
color
:
#55637d
}
rzslider
.rz-ticks
{
position
:
absolute
;
top
:
-3px
;
left
:
0
;
z-index
:
1
;
display
:
-webkit-flex
;
display
:
-ms-flexbox
;
display
:
flex
;
width
:
100%
;
height
:
0
;
padding
:
0
11px
;
margin
:
0
;
list-style
:
none
;
box-sizing
:
border-box
;
-webkit-justify-content
:
space-between
;
-ms-flex-pack
:
justify
;
justify-content
:
space-between
}
rzslider
.rz-ticks
.rz-tick
{
width
:
10px
;
height
:
10px
;
text-align
:
center
;
cursor
:
pointer
;
background
:
#d8e0f3
;
border-radius
:
50%
}
rzslider
.rz-ticks
.rz-tick.rz-selected
{
background
:
#0db9f0
}
rzslider
.rz-ticks
.rz-tick
.rz-tick-value
{
position
:
absolute
;
top
:
-30px
;
transform
:
translate
(
-50%
,
0
)}
rzslider
.rz-vertical
{
position
:
relative
;
width
:
4px
;
height
:
100%
;
padding
:
0
;
margin
:
0
20px
;
vertical-align
:
baseline
}
rzslider
.rz-vertical
.rz-base
{
width
:
100%
;
height
:
100%
;
padding
:
0
}
rzslider
.rz-vertical
.rz-bar-wrapper
{
top
:
auto
;
left
:
0
;
width
:
32px
;
height
:
100%
;
padding
:
0
0
0
16px
;
margin
:
0
0
0
-16px
}
rzslider
.rz-vertical
.rz-bar
{
bottom
:
0
;
left
:
auto
;
width
:
4px
;
height
:
100%
}
rzslider
.rz-vertical
.rz-pointer
{
top
:
auto
;
bottom
:
0
;
left
:
-14px
!important
}
rzslider
.rz-vertical
.rz-bubble
{
bottom
:
0
;
left
:
16px
!important
;
margin-left
:
3px
}
rzslider
.rz-vertical
.rz-bubble.rz-selection
{
top
:
auto
;
left
:
16px
!important
}
rzslider
.rz-vertical
.rz-ticks
{
top
:
0
;
left
:
-3px
;
z-index
:
1
;
width
:
0
;
height
:
100%
;
padding
:
11px
0
;
-webkit-flex-direction
:
column-reverse
;
-ms-flex-direction
:
column-reverse
;
flex-direction
:
column-reverse
}
rzslider
.rz-vertical
.rz-ticks
.rz-tick
{
vertical-align
:
middle
}
rzslider
.rz-vertical
.rz-ticks
.rz-tick
.rz-tick-value
{
top
:
auto
;
right
:
-30px
;
transform
:
translate
(
0
,
-28%
)}
rzslider
{
position
:
relative
;
display
:
inline-block
;
width
:
100%
;
height
:
4px
;
margin
:
35px
0
15px
0
;
vertical-align
:
middle
;
-webkit-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
user-select
:
none
}
rzslider
[
disabled
]
{
cursor
:
not-allowed
}
rzslider
[
disabled
]
.rz-pointer
{
cursor
:
not-allowed
;
background-color
:
#d8e0f3
}
rzslider
span
{
position
:
absolute
;
display
:
inline-block
;
white-space
:
nowrap
}
rzslider
.rz-base
{
width
:
100%
;
height
:
100%
;
padding
:
0
}
rzslider
.rz-bar-wrapper
{
left
:
0
;
z-index
:
1
;
width
:
100%
;
height
:
32px
;
padding-top
:
16px
;
margin-top
:
-16px
;
box-sizing
:
border-box
}
rzslider
.rz-bar-wrapper.rz-draggable
{
cursor
:
move
}
rzslider
.rz-bar
{
left
:
0
;
z-index
:
1
;
width
:
100%
;
height
:
4px
;
background
:
#d8e0f3
;
-webkit-border-radius
:
2px
;
-moz-border-radius
:
2px
;
border-radius
:
2px
}
rzslider
.rz-bar.rz-selection
{
z-index
:
2
;
background
:
#0db9f0
;
-webkit-border-radius
:
2px
;
-moz-border-radius
:
2px
;
border-radius
:
2px
}
rzslider
.rz-pointer
{
top
:
-14px
;
z-index
:
3
;
width
:
32px
;
height
:
32px
;
cursor
:
pointer
;
background-color
:
#0db9f0
;
-webkit-border-radius
:
16px
;
-moz-border-radius
:
16px
;
border-radius
:
16px
}
rzslider
.rz-pointer
:after
{
position
:
absolute
;
top
:
12px
;
left
:
12px
;
width
:
8px
;
height
:
8px
;
background
:
#fff
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
content
:
''
}
rzslider
.rz-pointer
:hover:after
{
background-color
:
#fff
}
rzslider
.rz-pointer.rz-active
{
z-index
:
4
}
rzslider
.rz-pointer.rz-active
:after
{
background-color
:
#451aff
}
rzslider
.rz-bubble
{
bottom
:
16px
;
padding
:
1px
3px
;
color
:
#55637d
;
cursor
:
default
}
rzslider
.rz-bubble.rz-selection
{
top
:
16px
}
rzslider
.rz-bubble.rz-limit
{
color
:
#55637d
}
rzslider
.rz-ticks
{
position
:
absolute
;
top
:
-3px
;
left
:
0
;
z-index
:
1
;
display
:
-webkit-flex
;
display
:
-ms-flexbox
;
display
:
flex
;
width
:
100%
;
height
:
0
;
padding
:
0
11px
;
margin
:
0
;
list-style
:
none
;
box-sizing
:
border-box
;
-webkit-justify-content
:
space-between
;
-ms-flex-pack
:
justify
;
justify-content
:
space-between
}
rzslider
.rz-ticks
.rz-tick
{
width
:
10px
;
height
:
10px
;
text-align
:
center
;
cursor
:
pointer
;
background
:
#d8e0f3
;
border-radius
:
50%
}
rzslider
.rz-ticks
.rz-tick.rz-selected
{
background
:
#0db9f0
}
rzslider
.rz-ticks
.rz-tick
.rz-tick-value
{
position
:
absolute
;
top
:
-30px
;
transform
:
translate
(
-50%
,
0
)}
rzslider
.rz-vertical
{
position
:
relative
;
width
:
4px
;
height
:
100%
;
padding
:
0
;
margin
:
0
20px
;
vertical-align
:
baseline
}
rzslider
.rz-vertical
.rz-base
{
width
:
100%
;
height
:
100%
;
padding
:
0
}
rzslider
.rz-vertical
.rz-bar-wrapper
{
top
:
auto
;
left
:
0
;
width
:
32px
;
height
:
100%
;
padding
:
0
0
0
16px
;
margin
:
0
0
0
-16px
}
rzslider
.rz-vertical
.rz-bar
{
bottom
:
0
;
left
:
auto
;
width
:
4px
;
height
:
100%
}
rzslider
.rz-vertical
.rz-pointer
{
top
:
auto
;
bottom
:
0
;
left
:
-14px
!important
}
rzslider
.rz-vertical
.rz-bubble
{
bottom
:
0
;
left
:
16px
!important
;
margin-left
:
3px
}
rzslider
.rz-vertical
.rz-bubble.rz-selection
{
top
:
auto
;
left
:
16px
!important
}
rzslider
.rz-vertical
.rz-ticks
{
top
:
0
;
left
:
-3px
;
z-index
:
1
;
width
:
0
;
height
:
100%
;
padding
:
11px
0
;
-webkit-flex-direction
:
column-reverse
;
-ms-flex-direction
:
column-reverse
;
flex-direction
:
column-reverse
}
rzslider
.rz-vertical
.rz-ticks
.rz-tick
{
vertical-align
:
middle
}
rzslider
.rz-vertical
.rz-ticks
.rz-tick
.rz-tick-value
{
top
:
auto
;
right
:
-30px
;
transform
:
translate
(
0
,
-28%
)}
dist/rzslider.min.js
View file @
13c6dbfd
This diff is collapsed.
Click to expand it.
src/rzslider.js
View file @
13c6dbfd
...
@@ -427,9 +427,14 @@
...
@@ -427,9 +427,14 @@
this
.
options
.
floor
=
0
;
this
.
options
.
floor
=
0
;
this
.
options
.
ceil
=
this
.
options
.
stepsArray
.
length
-
1
;
this
.
options
.
ceil
=
this
.
options
.
stepsArray
.
length
-
1
;
this
.
options
.
step
=
1
;
this
.
options
.
step
=
1
;
if
(
this
.
options
.
translate
)
{
this
.
customTrFn
=
this
.
options
.
translate
;
}
else
{
this
.
customTrFn
=
function
(
value
)
{
this
.
customTrFn
=
function
(
value
)
{
return
this
.
options
.
stepsArray
[
value
];
return
this
.
options
.
stepsArray
[
value
];
};
};
}
}
else
if
(
this
.
options
.
translate
)
}
else
if
(
this
.
options
.
translate
)
this
.
customTrFn
=
this
.
options
.
translate
;
this
.
customTrFn
=
this
.
options
.
translate
;
else
else
...
...
tests/specs/options-handling-test.js
View file @
13c6dbfd
...
@@ -115,6 +115,24 @@
...
@@ -115,6 +115,24 @@
expect
(
helper
.
slider
.
customTrFn
(
2
)).
to
.
equal
(
'C'
);
expect
(
helper
.
slider
.
customTrFn
(
2
)).
to
.
equal
(
'C'
);
});
});
it
(
'should allow a custom translate function when stepsArray is used'
,
function
()
{
helper
.
scope
.
slider
.
options
.
stepsArray
=
[{
'foo'
:
'barA'
},
{
'foo'
:
'barB'
},
{
'foo'
:
'barC'
}];
helper
.
scope
.
slider
.
options
.
translate
=
function
(
value
,
sliderId
,
label
)
{
if
(
value
>=
0
&&
value
<
helper
.
scope
.
slider
.
options
.
stepsArray
.
length
)
{
return
helper
.
scope
.
slider
.
options
.
stepsArray
[
value
][
'foo'
];
}
else
{
return
""
}
};
helper
.
scope
.
$digest
();
expect
(
helper
.
slider
.
options
.
step
).
to
.
equal
(
1
);
expect
(
helper
.
slider
.
options
.
floor
).
to
.
equal
(
0
);
expect
(
helper
.
slider
.
options
.
ceil
).
to
.
equal
(
2
);
expect
(
helper
.
slider
.
customTrFn
(
0
)).
to
.
equal
(
'barA'
);
expect
(
helper
.
slider
.
customTrFn
(
2
)).
to
.
equal
(
'barC'
);
});
it
(
'should sanitize rzSliderModel between floor and ceil'
,
function
()
{
it
(
'should sanitize rzSliderModel between floor and ceil'
,
function
()
{
helper
.
scope
.
slider
.
options
.
enforceRange
=
true
;
helper
.
scope
.
slider
.
options
.
enforceRange
=
true
;
helper
.
scope
.
slider
.
value
=
1000
;
helper
.
scope
.
slider
.
value
=
1000
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment