mirror of
https://github.com/processwire/processwire.git
synced 2025-08-18 12:31:17 +02:00
Update related to processwire/processwire-issues#1526 - prevent asmSelect for marking an item "pending delete" unless the item was already selected when the page rendered
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* AsmSelect is a sortable multiple-select Inputfield
|
||||
*
|
||||
* Copyright (c) 2009-2020 by Ryan Cramer
|
||||
* Copyright (c) 2009-2022 by Ryan Cramer
|
||||
*
|
||||
* @property bool $addable Can items be added to selection? (default=true)
|
||||
* @property string $addItemTarget Where to place new selected items in list: top or bottom (default='bottom')
|
||||
@@ -40,7 +40,7 @@ class InputfieldAsmSelect extends InputfieldSelectMultiple implements Inputfield
|
||||
public static function getModuleInfo() {
|
||||
return array(
|
||||
'title' => __('asmSelect', __FILE__),
|
||||
'version' => 202,
|
||||
'version' => 203,
|
||||
'summary' => __('Multiple selection, progressive enhancement to select multiple', __FILE__), // Module Summary
|
||||
'permanent' => true,
|
||||
);
|
||||
|
@@ -116,6 +116,9 @@
|
||||
// initialize the alternate select multiple
|
||||
if(options.deletable && !options.addable) options.hideDeleted = false;
|
||||
|
||||
// identify which items were already selected in the original
|
||||
$original.find('option[selected]').addClass('asmOriginalSelected');
|
||||
|
||||
// this loop ensures uniqueness, in case of existing asmSelects placed by ajax (1.0.3)
|
||||
while($("#" + options.containerClass + index).length > 0) index++;
|
||||
|
||||
@@ -789,7 +792,7 @@
|
||||
|
||||
var $O = $('#' + optionId);
|
||||
|
||||
if(options.hideDeleted) {
|
||||
if(options.hideDeleted || !$O.hasClass('asmOriginalSelected')) {
|
||||
|
||||
if(typeof highlightItem == "undefined") highlightItem = true;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user