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

"Camile \(@camilevahviraki\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a8f89e728379_3818d9404181a@gitlab-sidekiq-low-urgency-cpu-bound-v2-7bb4b6f85d-wfvzc.mail>

Camile pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
628c18bf by Camile at 2026-08-27T00:44:12+00:00
[ENH][UX] WebAuthn: Add new parameter to confirmPopup() JS function to allow...
---
* [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

See merge request tikiwiki/tiki!11073

- - - - -


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
=====================================
@@ -31,7 +31,9 @@
                         <td class="action">
                             {actions}
                                 <action>
-                                    <a href="tiki-webauthn.php?authenticator_id={$devices[device].id}&amp;action=remove" onclick="confirmPopup('{tr}Delete authenticator?{/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/628c18bf0a1f0c7ebd62e77967004396c2120c52

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/628c18bf0a1f0c7ebd62e77967004396c2120c52
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
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.