1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 09:44:38 +02:00
This commit is contained in:
Ryan Cramer
2019-11-05 11:56:28 -05:00
parent a22e6287be
commit 5887997698
3 changed files with 23 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ class InputfieldAsmSelect extends InputfieldSelectMultiple implements Inputfield
public static function getModuleInfo() { public static function getModuleInfo() {
return array( return array(
'title' => __('asmSelect', __FILE__), 'title' => __('asmSelect', __FILE__),
'version' => 201, 'version' => 202,
'summary' => __('Multiple selection, progressive enhancement to select multiple', __FILE__), // Module Summary 'summary' => __('Multiple selection, progressive enhancement to select multiple', __FILE__), // Module Summary
'permanent' => true, 'permanent' => true,
); );

View File

@@ -185,22 +185,27 @@
var fieldsetItems = []; var fieldsetItems = [];
var sortableUpdate = function($ul, e, data) {
var $option = $('#' + data.item.attr('rel'));
var updatedOptionId = $option.attr('id');
$ul.children("li").each(function(n) {
$option = $('#' + $(this).attr('rel'));
$original.append($option);
});
if(updatedOptionId) {
triggerOriginalChange(updatedOptionId, 'sort');
}
}
$ol.sortable({ $ol.sortable({
items: 'li.' + options.listItemClass, items: 'li.' + options.listItemClass,
axis: 'y', axis: 'y',
cancel: 'a.asmEditLinkModalLongclick', cancel: 'a.asmEditLinkModalLongclick',
update: function(e, ui) { update: function(e, data) {
if(data.item.hasClass('asmFieldsetStart')) return;
var updatedOptionId; sortableUpdate(jQuery(this), e, data);
$option = $('#' + ui.item.attr('rel'));
updatedOptionId = $option.attr('id');
$(this).children("li").each(function(n) {
$option = $('#' + $(this).attr('rel'));
$original.append($option);
});
if(updatedOptionId) triggerOriginalChange(updatedOptionId, 'sort');
}, },
start: function(e, data) { start: function(e, data) {
if(options.jQueryUI) data.item.addClass('ui-state-highlight'); if(options.jQueryUI) data.item.addClass('ui-state-highlight');
@@ -229,8 +234,11 @@
$item.slideDown('fast').fadeTo('fast', 1.0); $item.slideDown('fast').fadeTo('fast', 1.0);
} }
fieldsetItems = []; fieldsetItems = [];
setupFieldsets();
sortableUpdate(jQuery(this), e, data);
} else {
setupFieldsets();
} }
setupFieldsets();
} }
}).addClass(options.listSortableClass); }).addClass(options.listSortableClass);

File diff suppressed because one or more lines are too long