N°5904 - Use attribute linked set edit mode to enable actions (#440)

* Add corresponding buttons depending on old edit mode (need to check with piR pour récuperer l'ancienne valeur.

* N°5904 - Handle attribute linked set edit_mode

* N°5904 Move calls to private jquery widget methods to public

* N°5904 - Worker improvements add button on link tagset

* Change itop set widget to new set block UI (5)

* Change itop set widget to new set block UI (5)

* Renommage variables JS avec le prefix combodo

* Search dialog block id conflict with form id

* add moved js files in iTopWebPage compatibility list

---------

Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
This commit is contained in:
bdalsass
2023-02-06 16:07:55 +01:00
committed by GitHub
parent 3fbc5e1ce0
commit 1fe9520b7e
28 changed files with 801 additions and 356 deletions

View File

@@ -78,14 +78,14 @@ Selectize.define("combodo_multi_values_synthesis", function (aOptions) {
}
// Element exist in default selection,
// click allow user to switch between add or ignore states
if(oSelf.settings.initial.includes(sItemValue)) {
if(oSelf.plugins.settings.combodo_update_operations.initial.includes(sItemValue)) {
oSelf.listenClick($Item, sItemValue);
}
return;
}
// If no operation to restore
if(!oSelf.settings.initial.includes(sItemValue)) {
if(!oSelf.plugins.settings.combodo_update_operations.initial.includes(sItemValue)) {
// Element doesn't exist in initial value, we mark it as added
oSelf.Add($Item, sItemValue);
@@ -112,7 +112,7 @@ Selectize.define("combodo_multi_values_synthesis", function (aOptions) {
const $Item = oSelf.getItem(sItem);
// Element doesn't exist in default selection,
if(!oSelf.settings.initial.includes(sItem)) {
if(!oSelf.plugins.settings.combodo_update_operations.initial.includes(sItem)) {
// Remove operation
delete aOperations[sItem];

View File

@@ -15,11 +15,18 @@
*
* You should have received a copy of the GNU Affero General Public License
*/
Selectize.define("combodo_update_operations", function () {
Selectize.define("combodo_update_operations", function (aOptions) {
// Selectize instance
let oSelf = this;
// Plugin options
aOptions = $.extend({
initial: [],
},
aOptions
);
// Plugin variables
oSelf.bIsInitialized = false;
oSelf.operations = {};
@@ -88,7 +95,7 @@ Selectize.define("combodo_update_operations", function () {
// Scan items in current value and not in initial value
aCurrentItems.forEach(function(e){
if(!oSelf.settings.initial.includes(e)){
if(!aOptions.initial.includes(e)){
oSelf.operations[e] = {
operation: 'add',
data: CombodoGlobalToolbox.ExtractArrayItemsContainingThisKeyAndValue(aCurrentOptions, oSelf.settings.valueField, e)
@@ -97,7 +104,7 @@ Selectize.define("combodo_update_operations", function () {
});
// scan items in initial value and not in current value
oSelf.settings.initial.forEach(function(e){
aOptions.initial.forEach(function(e){
if(!aCurrentItems.includes(e)){
oSelf.operations[e] = {
operation: 'remove',
@@ -109,4 +116,12 @@ Selectize.define("combodo_update_operations", function () {
};
})();
// Declare addInitialValue function
oSelf.addInitialValue = (function () {
return function (value) {
aOptions.initial.push(value);
oSelf.updateOperationsInput();
};
})();
});