Revert reordering handler changes
This commit is contained in:
parent
a00e546f5f
commit
ac98f70a25
|
|
@ -316,11 +316,6 @@ class Repeater extends FormWidgetBase
|
|||
return $widget->onRefresh();
|
||||
}
|
||||
|
||||
public function onReorder()
|
||||
{
|
||||
// Handle reordering of repeater items
|
||||
}
|
||||
|
||||
//
|
||||
// Group mode
|
||||
//
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@
|
|||
this.$el = $(element)
|
||||
this.$sortable = $(options.sortableContainer, this.$el)
|
||||
|
||||
// Sortable tracking
|
||||
this.sortingStartIndex = null
|
||||
|
||||
$.oc.foundation.controlUtils.markDisposable(element)
|
||||
Base.call(this)
|
||||
this.init()
|
||||
|
|
@ -35,7 +32,6 @@
|
|||
|
||||
Repeater.DEFAULTS = {
|
||||
sortableHandle: '.repeater-item-handle',
|
||||
sortableHandler: null,
|
||||
sortableContainer: 'ul.field-repeater-items',
|
||||
titleFrom: null,
|
||||
minItems: null,
|
||||
|
|
@ -81,9 +77,7 @@
|
|||
Repeater.prototype.bindSorting = function() {
|
||||
var sortableOptions = {
|
||||
handle: this.options.sortableHandle,
|
||||
nested: false,
|
||||
onDragStart: this.proxy(this.onSortStart),
|
||||
onDrop: this.proxy(this.onSortStop)
|
||||
nested: false
|
||||
}
|
||||
|
||||
this.$sortable.sortable(sortableOptions)
|
||||
|
|
@ -230,27 +224,6 @@
|
|||
return defaultText
|
||||
}
|
||||
|
||||
Repeater.prototype.onSortStart = function($item, container, callback, event) {
|
||||
this.sortingStartIndex = $item.index()
|
||||
|
||||
callback($item, container, callback, event)
|
||||
}
|
||||
|
||||
Repeater.prototype.onSortStop = function($item, container, callback, event) {
|
||||
var endIndex = $item.index()
|
||||
|
||||
if (this.options.sortableHandler) {
|
||||
this.$el.request(this.options.sortableHandler, {
|
||||
data: {
|
||||
_repeater_index: this.sortingStartIndex,
|
||||
_repeater_new_index: endIndex
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
callback($item, container, callback, event)
|
||||
}
|
||||
|
||||
// FIELD REPEATER PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
<?= $titleFrom ? 'data-title-from="'.$titleFrom.'"' : '' ?>
|
||||
<?= $minItems ? 'data-min-items="'.$minItems.'"' : '' ?>
|
||||
<?= $maxItems ? 'data-max-items="'.$maxItems.'"' : '' ?>
|
||||
data-sortable-handler="<?= $this->getEventHandler('onReorder') ?>"
|
||||
data-sortable-container="#<?= $this->getId('items') ?>"
|
||||
data-sortable-handle=".<?= $this->getId('items') ?>-handle">
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue