[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH][UX] WebAuthn: Add new parameter to confirmPopup() JS function to allow...

"Camile \(@camilevahviraki\) via TikiWiki-cvs" <[email protected]> Wed, 15 Jul 2026 15:42:27 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a57aa63963f_38213bd0390d1@gitlab-sidekiq-low-urgency-cpu-bound-v2-69c4b759db-wlx56.mail>

Camile pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
6352325b by Camile at 2026-07-15T15:25:01+00:00
[ENH][UX] WebAuthn: Add new parameter to confirmPopup() JS function to allow separating title and the message content
---
* [ENH][UX] WebAuthn: Add new parameter to confirmPopup() JS function to allow separating title and the message content

See merge request tikiwiki/tiki!10721

- - - - -


2 changed files:

- lib/jquery_tiki/tiki-confirm.js
- templates/tiki-webauthn.tpl


Changes:

=====================================
lib/jquery_tiki/tiki-confirm.js
=====================================
@@ -50,15 +50,21 @@ if (typeof window.tikiScriptStartDate === 'undefined') {
  * javascript is not enabled
  *
  *
- * @param title        string        Confirmation text. Default is tr('Complete
- *     this action?'). Not used for ajax services since the service will
- *     provide the text
+ * @param title    string        Confirmation text used as the modal
+ *     title/header. Default is tr('Complete this action?'). Not used for
+ *     ajax services since the service will provide the text
  * @param ticket    string        Security token. Usually only needed for
  *     anchors since the function will get the token from the form inputs when
  *     it's a form
+ * @param message    string        Optional confirmation message/description
+ *     displayed in the body of the popup, separate from the title, for
+ *     longer explanations that shouldn't be crammed into the title. Not used
+ *     for ajax services since the service will provide the text.
+ *     Alternatively, a data-confirm-message attribute can be set on a select
+ *     option with the confirm-popup class (see data-confirm-text above)
  * @returns {boolean}
  */
-function confirmPopup(title, ticket) {
+function confirmPopup(title, ticket, message) {
     if (! this.event) {
         return false;
     }
@@ -113,11 +119,16 @@ function confirmPopup(title, ticket) {
                     $.each(selected, function (key, item) {
                         if ($(selected[key]).data('confirm-text')) {
                             title = $(selected[key]).data('confirm-text');
+                        }
+                        if ($(selected[key]).data('confirm-message')) {
+                            message = $(selected[key]).data('confirm-message');
+                        }
+                        if ($(selected[key]).data('confirm-text') || $(selected[key]).data('confirm-message')) {
                             return false;
                         }
                     });
                 }
-                simpleConfirmForm(el, newForm, title, ticket).modal('show');
+                simpleConfirmForm(el, newForm, title, ticket, message).modal('show');
             //
             } else {
                 $(el.form).trigger("submit");
@@ -134,7 +145,7 @@ function confirmPopup(title, ticket) {
                         value: decodeURIComponent(parampair[1])}));
                 }
             }
-            simpleConfirmForm(el, newForm, title, ticket).modal('show');
+            simpleConfirmForm(el, newForm, title, ticket, message).modal('show');
         }
     }
 }
@@ -166,19 +177,28 @@ function isAjaxRequest(el) {
  * @param clickedElement    object        Element clicked
  * @param newForm            object        Form that has been started and that
  *     will be completed with this function
- * @param title                string        Confirmation text. Alternatively
- *     the function will look for a data-confirm-text attribute before using
- *     the default tr('Complete this action?')
+ * @param title                string        Confirmation text used as the
+ *     modal title/header. Alternatively the function will look for a
+ *     data-confirm-text attribute before using the default
+ *     tr('Complete this action?')
  * @param ticket            string        Security token
+ * @param message            string        Optional confirmation
+ *     message/description displayed in the body of the popup, separate from
+ *     the title. Alternatively the function will look for a
+ *     data-confirm-message attribute. Not required - if not provided, the
+ *     modal body will only contain the (usually hidden) form inputs
  * @returns {object}
  */
-function simpleConfirmForm(clickedElement, newForm, title, ticket) {
+function simpleConfirmForm(clickedElement, newForm, title, ticket, message) {
     // hide any popovers they may have contained the element that was clicked
     $('div.popover-body:visible').parent().hide();
     if (! title) {
         title = $(clickedElement).data('confirm-text') ? $(clickedElement).data('confirm-text')
             : tr('Complete this action?');
     }
+    if (! message && $(clickedElement).data('confirm-message')) {
+        message = $(clickedElement).data('confirm-message');
+    }
     if (! ticket && ! $(newForm).find('input[name=ticket]').length && $(clickedElement).data('ticket')) {
         ticket = $(clickedElement).data('ticket');
     }
@@ -190,6 +210,9 @@ function simpleConfirmForm(clickedElement, newForm, title, ticket) {
     $('.modal-content', target).html(
         '<div class="modal-header">' +
         '<h4 class="modal-title" id="myModalLabel">' + title + '</h4>' +
+        '</div>' +
+        '<div class="modal-body">' +
+        (message ? '<p class="confirm-popup-message">' + message + '</p>' : '') +
         $(newForm).prop('outerHTML') +
         '</div>' +
         '<div class="modal-footer">' +


=====================================
templates/tiki-webauthn.tpl
=====================================
@@ -29,7 +29,9 @@
                         <td class="action">
                             {actions}
                                 <action>
-                                    <a href="tiki-webauthn.php?authenticator_id={$devices[device].id}&amp;action=remove" onclick="confirmPopup('{tr}Delete this passkey from this site? Note: the copy saved on your device will NOT be removed automatically. You must delete it from your device\'s passkey/password manager separately.{/tr}', '{ticket mode=get}')">
+                                    <a href="tiki-webauthn.php?authenticator_id={$devices[device].id}&amp;action=remove"
+                                        onclick="confirmPopup('{tr}Delete this passkey from this site?{/tr}', '{ticket mode=get}', '{tr}Note: the copy saved on your device will NOT be removed automatically. You must delete it from your device\'s passkey/password manager separately.{/tr}')"
+                                    >
                                         {icon name='delete' _menu_text='y' _menu_icon='y' alt="{tr}Remove{/tr}"}
                                     </a>
                                 </action>



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/6352325b379b72effe73cf0454b273e7a87521d4

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/6352325b379b72effe73cf0454b273e7a87521d4
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs