Revert reordering handler changes

This commit is contained in:
Ben Thomson 2019-04-11 10:37:39 +08:00
parent a00e546f5f
commit ac98f70a25
3 changed files with 1 additions and 34 deletions

View File

@ -316,11 +316,6 @@ class Repeater extends FormWidgetBase
return $widget->onRefresh();
}
public function onReorder()
{
// Handle reordering of repeater items
}
//
// Group mode
//

View File

@ -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
// ============================

View File

@ -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">