From 0065e03873b619ef1aa504da9abdcb04f5e002c1 Mon Sep 17 00:00:00 2001 From: Yogesh Ojha Date: Sat, 13 Jul 2024 10:28:18 +0530 Subject: [PATCH 1/2] add function in js to handle hash in url --- web/static/custom/custom.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/static/custom/custom.js b/web/static/custom/custom.js index ee8452845..51fe0504e 100644 --- a/web/static/custom/custom.js +++ b/web/static/custom/custom.js @@ -3276,3 +3276,18 @@ function convertToCamelCase(inputString) { return camelCaseString; } + +function handleHashInUrl(){ + // this function handles hash in url used to tab navigation + const hash = window.location.hash; + if (hash) { + const targetId = hash.substring(1); + const tabLink = $(`a[href="#${targetId}"][data-bs-toggle="tab"]`); + if (tabLink.length) { + tabLink.tab('show'); + setTimeout(() => { + tabLink.click(); + }, 100); + } + } +} From 0abc59e0acba505803aba89444b6f6426f9f40af Mon Sep 17 00:00:00 2001 From: Yogesh Ojha Date: Sat, 13 Jul 2024 10:28:36 +0530 Subject: [PATCH 2/2] append hash in url when clicked on tab --- web/templates/base/base.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/templates/base/base.html b/web/templates/base/base.html index eff87e5e9..a3d5ac984 100644 --- a/web/templates/base/base.html +++ b/web/templates/base/base.html @@ -109,6 +109,14 @@

{% block page_title %}{% endblock page_title %}