From bbbd6828e0dde319eb14828f3984c8ba0d76cace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C4=9F=C4=B1zhan?= Date: Wed, 8 Mar 2023 08:38:40 +0300 Subject: [PATCH] Introduced the new Modals toolkit (#903) * The first editions of the new modals toolkit * Make the modals centered and implement it to the batch delete partial * Made CodeFactor happier * Combining 'danger' and 'success' into one * New 'small' modal type. * Added 'small-confirm' type and refactored the massmailer template a bit. * Minor refactoring for the form builder module * Make apiLink use modals to confirm * Minor updates * Made the "notes" icon visible again and got rid of some jQuery * Cleared some leftover jQuery code here and there --- .../mod_formbuilder_settings.html.twig | 10 +- .../mod_massmailer_message.html.twig | 59 ++--- .../html_admin/mod_support_tickets.html.twig | 30 ++- .../admin_default/assets/fossbilling.js | 1 + .../assets/icons/alert-triangle.svg | 7 + .../assets/icons/circle-check.svg | 7 + .../admin_default/assets/icons/notes.svg | 9 + .../admin_default/assets/js/fossbilling.js | 18 +- .../admin_default/assets/js/ui/modals.js | 240 ++++++++++++++++++ .../html/partial_batch_delete.html.twig | 13 +- 10 files changed, 342 insertions(+), 52 deletions(-) create mode 100644 src/themes/admin_default/assets/icons/alert-triangle.svg create mode 100644 src/themes/admin_default/assets/icons/circle-check.svg create mode 100644 src/themes/admin_default/assets/icons/notes.svg create mode 100644 src/themes/admin_default/assets/js/ui/modals.js diff --git a/src/modules/Formbuilder/html_admin/mod_formbuilder_settings.html.twig b/src/modules/Formbuilder/html_admin/mod_formbuilder_settings.html.twig index 1c92766cd..ba3e33529 100644 --- a/src/modules/Formbuilder/html_admin/mod_formbuilder_settings.html.twig +++ b/src/modules/Formbuilder/html_admin/mod_formbuilder_settings.html.twig @@ -293,15 +293,19 @@ var fid = $(this).attr('data-field-id'); var rm = $(this); - jConfirm('Are you sure?', 'Confirm', function (r) { - if (r) { - bb.post('admin/formbuilder/delete_field', { id: fid, CSRFToken: "{{ CSRFToken }}" }, function () { + Modals.create({ + type: 'small-confirm', + title: 'Are you sure?', + content: 'Are you sure you want to delete this field?', + confirmCallback: function () { + API.admin.post('formbuilder/delete_field', { id: fid }, function () { $(rm).parents('.wrap-field').slideUp("normal", function () { $(rm).remove(); }); }); } }); + return false; }); diff --git a/src/modules/Massmailer/html_admin/mod_massmailer_message.html.twig b/src/modules/Massmailer/html_admin/mod_massmailer_message.html.twig index c15bd6684..ddb1986db 100644 --- a/src/modules/Massmailer/html_admin/mod_massmailer_message.html.twig +++ b/src/modules/Massmailer/html_admin/mod_massmailer_message.html.twig @@ -109,38 +109,39 @@ {% autoescape "js" %} {% endautoescape %} {% endblock %} \ No newline at end of file diff --git a/src/modules/Support/html_admin/mod_support_tickets.html.twig b/src/modules/Support/html_admin/mod_support_tickets.html.twig index d7d4d42e1..9f047516d 100644 --- a/src/modules/Support/html_admin/mod_support_tickets.html.twig +++ b/src/modules/Support/html_admin/mod_support_tickets.html.twig @@ -221,7 +221,9 @@ {% if ticket.notes|length %} - + + + {% endif %} {{ ticket.updated_at|timeago }} {{ 'ago'|trans }} @@ -355,18 +357,24 @@ {% block js %}