[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX][UI] Tracker Fields: standardize admin modals and update requireConfirm to use Tiki UI

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69933845d5fc1_3b1858bc94355@gitlab-sidekiq-low-urgency-cpu-bound-v2-7b68dd745d-rqvgn.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
37c0f809 by MAGENE Sem Joel at 2026-02-16T15:22:27+00:00
[FIX][UI] Tracker Fields: standardize admin modals and update requireConfirm to use Tiki UI
---
* [FIX][UI] Tracker Fields: standardize admin modals and update requireConfirm to use Tiki UI

See merge request tikiwiki/tiki!9582

- - - - -


2 changed files:

- lib/jquery_tiki/tiki-trackers.js
- templates/tiki-admin_tracker_fields.tpl


Changes:

=====================================
lib/jquery_tiki/tiki-trackers.js
=====================================
@@ -145,12 +145,25 @@
 
                             $row.append($('<td class="action"/>').append($('<a href="#" class="text-danger"><span class="icon fas fa-times"/></a>')
                                 .attr('href', $.service('tracker', 'remove_fields', {trackerId: trackerId, 'fields~0': field.fieldId}))
-                                .requireConfirm({
-                                    message: tr('Removing the field will result in data loss. Are you sure?'),
-                                    success: function (data) {
-                                        $(this).closest('tr').remove();
-                                        $.fn.resetFieldsCache();
-                                    }
+                                .on('click', function(e) {
+                                    e.preventDefault();
+                                    var $link = $(this);
+                                    // Use confirmationDialog to bypass the native browser confirm
+                                    $link.confirmationDialog({
+                                        title: tr('Confirm Delete'),
+                                        message: tr('Removing the field will result in data loss. Are you sure?'),
+                                        success: function() {
+                                            $.ajax($link.attr('href'), {
+                                                type: 'POST',
+                                                dataType: 'json',
+                                                data: { 'confirm': 1 },
+                                                success: function () {
+                                                    $link.closest('tr').remove();
+                                                    $.fn.resetFieldsCache();
+                                                }
+                                            });
+                                        }
+                                    });
                                 })
                             ));
                         } else if (data.typesDisabled) {


=====================================
templates/tiki-admin_tracker_fields.tpl
=====================================
@@ -76,15 +76,35 @@
     {jq}
         var trackerId = {{$trackerId|escape}};
         $('.save-fields').on("submit", function () {
-            var form = this, confirmed = false
-
-            if ($(form.action).val() === 'remove_fields' && validateForm()) {
-                confirmed = confirm(tr('Do you really want to delete the selected fields?'));
-                $(form.confirm).val(confirmed ? '1' : '0');
+            var form = this;
+            var action = $(form.action).val();
 
-                if (! confirmed) {
-                    return false;
+            // Internal helper to perform the Ajax submission logic
+            var executeAjax = function () {
+                $.ajax($(form).attr('action'), {
+                    type: 'POST',
+                    data: $(form).serialize(),
+                    dataType: 'json',
+                    success: function () {
+                        $container.tracker_load_fields(trackerId);
+                        if (action === 'remove_fields') {
+                            $.fn.resetFieldsCache();
+                        }
+                    }
+                });
+            };
+            if (action === 'remove_fields') {
+                if (validateForm()) {
+                    $(form).confirmationDialog({
+                        title: tr('Delete Fields'),
+                        message: tr('Do you really want to delete the selected fields?'),
+                        success: function() {
+                            $(form.confirm).val('1');
+                            executeAjax();
+                        }
+                    });
                 }
+                return false;
             }
 
             if ($(form.action).val() === 'export_fields') {
@@ -99,17 +119,7 @@
                 return false;
 
             } else {
-                $.ajax($(form).attr('action'), {
-                    type: 'POST',
-                    data: $(form).serialize(),
-                    dataType: 'json',
-                    success: function () {
-                        $container.tracker_load_fields(trackerId);
-                        if ($(form.action).val() === 'remove_fields') {
-                            $.fn.resetFieldsCache();
-                        }
-                    }
-                });
+                executeAjax();
             }
             return false;
         });
@@ -224,7 +234,7 @@
 
             // If no checkbox is checked, show an alert and prevent submission
             if (!isChecked) {
-                alert(tr("Please select at least one element."));
+                feedback(tr("Please select at least one element."), "error");
                 return false;
             }
 



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/37c0f809f3996460f675eb5f36e826a13f9923e5

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/37c0f809f3996460f675eb5f36e826a13f9923e5
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.