Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing range option for prototype engine. Fixes #1509

  • Loading branch information...
commit 584116524bcf9f217122b050a02b7eb3301afa0f 1 parent f2a4b1e
@markstory markstory authored
View
8 cake/libs/view/helpers/prototype_engine.php
@@ -330,10 +330,14 @@ function slider($options = array()) {
unset($options['handle']);
if (isset($options['min']) && isset($options['max'])) {
- $options['range'] = array($options['min'], $options['max']);
+ $options['range'] = sprintf('$R(%s,%s)', $options['min'], $options['max']);
unset($options['min'], $options['max']);
}
- $optionString = $this->_processOptions('slider', $options);
+ $options = $this->_mapOptions('slider', $options);
+ $options = $this->_prepareCallbacks('slider', $options);
+ $optionString = $this->_parseOptions(
+ $options, array_merge(array_keys($this->_callbackArguments['slider']), array('range'))
+ );
if (!empty($optionString)) {
$optionString = ', {' . $optionString . '}';
}
View
6 cake/tests/cases/libs/view/helpers/prototype_engine.test.php
@@ -348,9 +348,11 @@ function testSlider() {
'handle' => '#handle',
'change' => 'change();',
'complete' => 'complete();',
- 'value' => 4
+ 'value' => 4,
+ 'min' => 10,
+ 'max' => 100
));
- $expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {onChange:function (value) {complete();}, onSlide:function (value) {change();}, sliderValue:4});';
+ $expected = 'var jsSlider = new Control.Slider($("handle"), $("element"), {onChange:function (value) {complete();}, onSlide:function (value) {change();}, range:$R(10,100), sliderValue:4});';
$this->assertEqual($result, $expected);
}
Please sign in to comment.
Something went wrong with that request. Please try again.