mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 15:06:27 +00:00
Updating mootools and prototype sortable implementation.
This commit is contained in:
parent
c6c7630d8f
commit
49f689a9ce
4 changed files with 21 additions and 4 deletions
|
@ -203,7 +203,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
|
||||||
$options = $this->_mapOptions('sortable', $options);
|
$options = $this->_mapOptions('sortable', $options);
|
||||||
$callbacks = array('onStart', 'onSort', 'onComplete');
|
$callbacks = array('onStart', 'onSort', 'onComplete');
|
||||||
$options = $this->_parseOptions($options, $callbacks);
|
$options = $this->_parseOptions($options, $callbacks);
|
||||||
return 'var mooSortable = new Sortables(' . $this->selection . ', {' . $options . '});';
|
return 'var jsSortable = new Sortables(' . $this->selection . ', {' . $options . '});';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -41,6 +41,12 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
||||||
'success' => 'onSuccess',
|
'success' => 'onSuccess',
|
||||||
'complete' => 'onComplete',
|
'complete' => 'onComplete',
|
||||||
'error' => 'onFailure'
|
'error' => 'onFailure'
|
||||||
|
),
|
||||||
|
'sortable' => array(
|
||||||
|
'start' => 'onStart',
|
||||||
|
'sort' => 'onDrag',
|
||||||
|
'complete' => 'onDrop',
|
||||||
|
'distance' => 'snap',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -189,7 +195,10 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
||||||
* @see JsHelper::sortable() for options list.
|
* @see JsHelper::sortable() for options list.
|
||||||
**/
|
**/
|
||||||
function sortable($options = array()) {
|
function sortable($options = array()) {
|
||||||
|
$options = $this->_mapOptions('sortable', $options);
|
||||||
|
$callbacks = array('onStart', 'change', 'onDrag', 'onDrop');
|
||||||
|
$options = $this->_parseOptions($options, $callbacks);
|
||||||
|
return 'var jsSortable = Sortable.create(' . $this->selection . ', {' . $options . '});';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -207,7 +207,7 @@ class MooEngineHelperTestCase extends CakeTestCase {
|
||||||
'complete' => 'onStop',
|
'complete' => 'onStop',
|
||||||
'sort' => 'onSort',
|
'sort' => 'onSort',
|
||||||
));
|
));
|
||||||
$expected = 'var mooSortable = new Sortables($("myList"), {constrain:"parent", onComplete:onStop, onSort:onSort, onStart:onStart, snap:5});';
|
$expected = 'var jsSortable = new Sortables($("myList"), {constrain:"parent", onComplete:onStop, onSort:onSort, onStart:onStart, snap:5});';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -215,7 +215,15 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
function testSortable() {
|
function testSortable() {
|
||||||
|
$this->Proto->get('#myList');
|
||||||
|
$result = $this->Proto->sortable(array(
|
||||||
|
'distance' => 5,
|
||||||
|
'start' => 'onStart',
|
||||||
|
'complete' => 'onComplete',
|
||||||
|
'sort' => 'onSort',
|
||||||
|
));
|
||||||
|
$expected = 'var jsSortable = Sortable.create($("myList"), {onDrag:onSort, onDrop:onComplete, onStart:onStart, snap:5});';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue