From 406a46fcd0cf4490121ec612fe312df47cf8283c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 Apr 2025 10:38:55 +0200 Subject: [PATCH] Bug 38010: Code improvement (cherry picked from commit a14f1898672950be9d9097bc7b5dd56392a241b0) Signed-off-by: Jonathan Druart --- .../js/vue/components/Islands/AcquisitionsMenu.vue | 8 +++----- .../prog/js/vue/components/Islands/VendorMenu.vue | 10 ++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/AcquisitionsMenu.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/AcquisitionsMenu.vue index fd1a8a27b3a..792f0374ed9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/AcquisitionsMenu.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/AcquisitionsMenu.vue @@ -335,11 +335,9 @@ export default { mounted() { const path = location.pathname.substring(1); - Object.keys(this.$refs).forEach(ref => { - if (this.$refs[ref].href.includes(path)) { - this.$refs[ref].classList.add("current"); - } - }); + Object.values(this.$refs) + .find(a => a.href.includes(path)) + ?.classList.add("current"); }, }; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue index b97f6a48806..7a253b5afbc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Islands/VendorMenu.vue @@ -116,7 +116,7 @@ export default { }; }, data() { - const vendorId = this.vendorid ? this.vendorid : this.params.id; + const vendorId = this.vendorid || this.params.id; return { vendorId, }; @@ -124,11 +124,9 @@ export default { mounted() { const path = location.pathname.substring(1); - Object.keys(this.$refs).forEach(ref => { - if (this.$refs[ref].href.includes(path)) { - this.$refs[ref].classList.add("current"); - } - }); + Object.values(this.$refs) + .find(a => a.href.includes(path)) + ?.classList.add("current"); }, }; -- 2.34.1