From aa8c341e61e67b2f987333d464554e05732c1dd0 Mon Sep 17 00:00:00 2001 From: drfho Date: Thu, 26 Sep 2024 22:34:27 +0200 Subject: [PATCH] extract set_form_modified() as $ZMI-function --- .../bootstrap/plugin/bootstrap.plugin.zmi.js | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js b/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js index 9b7bf4192..c591902d0 100644 --- a/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js +++ b/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js @@ -977,29 +977,13 @@ ZMI.prototype.initInputFields = function(container) { var $label = $(this); $label.prepend(''); }); - // Check for intermediate modification by other user - const $body = $("body.zmi"); - const $btn_save = $(".controls.save button[value='BTN_SAVE']"); + // Check for intermediate modification (by other user) $("input,select,textarea",this).each(function() { var $this = $(this); const initialValue = $this.val(); $this.attr("data-initial-value",initialValue); $this.keyup(function() { - const value = $this.val(); - const $formGroup = $this.parents(".form-group"); - if (value == initialValue) { - $formGroup.removeClass("form-modified"); - } else { - $formGroup.addClass("form-modified"); - } - if ($(".form-group.form-modified").length == 0) { - $body.removeClass("form-modified"); - $btn_save.removeClass("btn-primary").addClass("btn-secondary"); - } - else { - $body.addClass("form-modified"); - $btn_save.removeClass("btn-secondary").addClass("btn-primary"); - } + $ZMI.set_form_modified($this,initialValue); }); }); // Icon-Class @@ -2396,3 +2380,31 @@ function sortOptions(what) { for (var i=0;i