From 9b10a07dd200029485659b514a6d2041fe89d029 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 | 2 +- .../intranet-tmpl/prog/js/vue/components/SkeletonResource.vue | 3 +++ .../intranet-tmpl/prog/js/vue/composables/base-resource.js | 4 +++- 3 files changed, 7 insertions(+), 2 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 17a371ab45b..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, 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 10444ebeb5b..30986c84bd7 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 eead7ca2386..9bfd4614ddf 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 @@ -262,7 +262,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