From f7ca6c0747f97fe686a171c34c1bb31065a66e36 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Sat, 24 Jan 2026 21:53:15 +0100 Subject: [PATCH] refactor: align copy code pattern with rest of components page Use inline template literals with {% raw %}{% endraw %} and HTML entities (") for quotes, consistent with other copy code buttons on the page. Removed the codeSnippets JS variables. Co-Authored-By: Claude Opus 4.5 --- app/templates/admin/components.html | 48 +++++++++++++++++++---------- static/admin/js/components.js | 28 ----------------- 2 files changed, 32 insertions(+), 44 deletions(-) diff --git a/app/templates/admin/components.html b/app/templates/admin/components.html index 91af3983..f9824efd 100644 --- a/app/templates/admin/components.html +++ b/app/templates/admin/components.html @@ -2626,24 +2626,40 @@ goToPage(n) { if (n !== '...' && n >= 1 && n <= this.totalPages) { this.paginati
-
-

Static Message (confirm_modal):

- -
-
+

Static Message (confirm_modal):

+
-
-

Dynamic Message (confirm_modal_dynamic):

- -
-
+

Dynamic Message (confirm_modal_dynamic):

+
diff --git a/static/admin/js/components.js b/static/admin/js/components.js index 445011ef..fbd93a44 100644 --- a/static/admin/js/components.js +++ b/static/admin/js/components.js @@ -435,34 +435,6 @@ function adminComponents() { showDynamicConfirmDemo: false, dynamicItemName: '', - // Code snippets for confirm modal macros - codeSnippets: { - confirmModal: `{% from 'shared/macros/modals.html' import confirm_modal %} - -{{ confirm_modal( - 'deleteConfirm', - 'Delete Item', - 'Are you sure you want to delete this item?', - 'deleteItem()', - 'showDeleteModal', - 'Delete', - 'Cancel', - 'danger' -) }}`, - confirmModalDynamic: `{% from 'shared/macros/modals.html' import confirm_modal_dynamic %} - -{{ confirm_modal_dynamic( - 'removePlatformModal', - 'Remove Platform', - "'Are you sure you want to remove \\\"' + (item?.name || '') + '\\\" ?'", - 'confirmRemove()', - 'showConfirmModal', - 'Remove', - 'Cancel', - 'warning' -) }}` - }, - // Example log data for demo showErrorLogDemo() { this.exampleLog = {