From c564c8a69614b7f43584d7cdd9f5ffbdfff9a935 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 Jan 2023 17:20:14 +0100 Subject: [PATCH] Bug 32728: ERM - Update search header depending on navigation Search header should change to match the section you are in. Default is "agreement". If you are in "local titles" or "local packages", the header will be positionned on the relevant tab. To replicate: 1. Enable the ERM module: ERMModule system preference. 2. Go to the ERM module: Home > E-resource management. 3. Select the options from the sidebar menu (Agreements, Packages and Titles), and note that the ERM search header options don't change. 4. Add a minimal agreement, package and title. 5. Change the search header to another option, for example 'Search titles', then perform a search. Note that: - the appropriate sidebar menu option is highlighted, for example: 'Titles' - the search header changes back to 'Agreement search' 6. Apply patch, run yarn build 7. Verify the search options are now switched when moving between pages Signed-off-by: Jonathan Field Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/vue/main-erm.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/main-erm.ts b/koha-tmpl/intranet-tmpl/prog/js/vue/main-erm.ts index c42ebe1745..3382d1a1be 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/main-erm.ts +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/main-erm.ts @@ -60,3 +60,12 @@ const { removeMessages } = mainStore; router.beforeEach((to, from) => { removeMessages(); // This will actually flag the messages as displayed already }); +router.afterEach((to, from) => { + let tab_id = 1; // Agreements + if ( to.path.match(/\/erm\/eholdings\/local\/titles/)){ + tab_id = 2; + } else if ( to.path.match(/\/erm\/eholdings\/local\/packages/)){ + tab_id = 3; + } + document.getElementById('ui-id-' + tab_id).click(); +})