[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX][UI] Tracker Fields: standardize admin modals and update requireConfirm to use Tiki UI
"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <699418311cc_3b1867088618b@gitlab-sidekiq-low-urgency-cpu-bound-v2-68d4c9bc4c-fd7ct.mail> |
MAGENE Sem Joel pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
e19b9679 by MAGENE Sem Joel at 2026-02-17T07:18:59+00:00
[BP][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
---
* [FIX][UI] Tracker Fields: standardize admin modals and update requireConfirm to use Tiki UI
See merge request tikiwiki/tiki!9582
(cherry picked from commit 37c0f809f3996460f675eb5f36e826a13f9923e5)
See merge request tikiwiki/tiki!9585
- - - - -
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/e19b9679f0e7081ad0f2a5a624151519a4b38b0d
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/e19b9679f0e7081ad0f2a5a624151519a4b38b0d
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