From f73cb584ed6c6353a890f86707ed6a29b6f68dbb Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 4 Nov 2025 12:23:13 -0100 Subject: [PATCH] Bug 41178: (VueJS framework): Add i18n.deleteConfirmationBody Otherwise, we're unable to override the contents of the delete dialog This and the previous patch allow fetching related accounts on the fly when attempting to delete an institutions. This allows to provide a message stating how many (or which) accounts will be deleted if the selected institution is deleted. The way its implemented applies for both deleting the resource from the list or from the 'show' page. If the institution does not have any associated accounts, the delete dialog's behavior is the same as it was before. --- .../prog/js/vue/components/SIP2/SIP2InstitutionResource.vue | 4 ++-- .../intranet-tmpl/prog/js/vue/components/SkeletonResource.vue | 3 +++ .../intranet-tmpl/prog/js/vue/composables/base-resource.js | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue index bd7ff9b04aa..1a68c4b5a15 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue @@ -162,7 +162,7 @@ export default { }); if (accounts.length > 0) { - baseResource.i18n.deleteConfirmationMessage = $__( + baseResource.i18n.deleteConfirmationBody = $__( "You're removing institution %s.
It has %s associated accounts (%s), which will also be removed. Are you sure?" ).format( resource.name, @@ -170,7 +170,7 @@ export default { accounts.map(a => a.login_id).join(", ") ); } else { - baseResource.i18n.deleteConfirmationMessage = null; + baseResource.i18n.deleteConfirmationBody = null; } }; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SkeletonResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SkeletonResource.vue index bbb139a2ed2..6fc72c26137 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SkeletonResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SkeletonResource.vue @@ -88,6 +88,9 @@ export default { deleteConfirmationMessage: $__( "Are you sure you want to remove this skeleton?" ), + deleteConfirmationBody: $__( + null // "Optional - Dialog content body when deleting a resource. Defaults to resource's nameAttr value" + ), deleteSuccessMessage: $__("Skeleton %s deleted"), displayName: $__("Skeleton"), editLabel: $__("Edit skeleton #%s"), diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js index 7448bda1873..505b9f6a619 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-resource.js @@ -264,7 +264,9 @@ export function useBaseResource(resourceConfig) { setConfirmationDialog( { title: i18n.deleteConfirmationMessage, - message: resourceName, + message: i18n.deleteConfirmationBody + ? i18n.deleteConfirmationBody + : resourceName, accept_label: $__("Yes, delete"), cancel_label: $__("No, do not delete"), }, -- 2.39.5