From 2325a7f6303a314609f68cae3dbfc18f18bd8e6f Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 13 Feb 2025 10:33:30 +0000 Subject: [PATCH] Bug 38010: (QA follow-up) Convert vendor menu to Vue island Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart --- .../prog/en/includes/vendor-menu.inc | 32 +++++++++---------- .../js/vue/components/Islands/VendorMenu.vue | 16 ++++++++++ .../prog/js/vue/modules/islands.ts | 15 +++++++++ 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc index 399b41d994a..8ee596a062a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/vendor-menu.inc @@ -1,17 +1,15 @@ -[% IF ( booksellerid ) %] - - -[% END %] +[% USE Koha %] +[% USE Asset %] +[% USE raw %] +[% USE To %] + + + +[% Asset.js("js/vue/dist/islands.js", "init" => "1") | $raw %] 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 956e760e42a..4a4ea82c21c 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 @@ -8,6 +8,7 @@ " > {{ $__("Baskets") }} @@ -19,6 +20,7 @@ " > {{ $__("Basket groups") }} @@ -30,6 +32,7 @@ " > {{ $__("Contracts") }} @@ -41,12 +44,14 @@ " > {{ $__("Vendor issues") }}
  • {{ $__("Invoices") }} @@ -59,11 +64,13 @@ > {{ $__("Uncertain prices") }} {{ $__("Uncertain prices") }} @@ -114,6 +121,15 @@ export default { vendorId, }; }, + 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"); + } + }); + }, }; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts index 88b52286017..808b39d8950 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/islands.ts @@ -62,6 +62,21 @@ export const componentRegistry: Map = }, }, ], + [ + "vendor-menu", + { + importFn: async () => { + const module = await import( + /* webpackChunkName: "vendor-menu" */ + "../components/Islands/VendorMenu.vue" + ); + return module.default; + }, + config: { + stores: ["navigationStore", "permissionsStore"], + }, + }, + ], ]); /** -- 2.34.1