From ed9fa10dcd03d398307fd5288e4f25a1422a6431 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 19 Sep 2025 17:48:27 -0400 Subject: [PATCH 001/107] fix: instrument navbar style - Set the active tab to "instruments" for instrument detail page - Removed active style to unify active navtab style refs: #391 --- .../django/VIM/apps/instruments/views/instrument_detail.py | 2 ++ web-app/frontend/assets/scss/instruments/index.scss | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/web-app/django/VIM/apps/instruments/views/instrument_detail.py b/web-app/django/VIM/apps/instruments/views/instrument_detail.py index e6e50f05..942b2429 100644 --- a/web-app/django/VIM/apps/instruments/views/instrument_detail.py +++ b/web-app/django/VIM/apps/instruments/views/instrument_detail.py @@ -59,4 +59,6 @@ def get_context_data(self, **kwargs): # Get all languages for the dropdown context["languages"] = Language.objects.all() + context["active_tab"] = "instruments" + return context diff --git a/web-app/frontend/assets/scss/instruments/index.scss b/web-app/frontend/assets/scss/instruments/index.scss index 39cf0162..7d67f0df 100644 --- a/web-app/frontend/assets/scss/instruments/index.scss +++ b/web-app/frontend/assets/scss/instruments/index.scss @@ -24,10 +24,6 @@ h4 { color: $umil-green-primary; } -.active { - font-weight: bold; -} - .toggle-more { color: #0b0f07; } From 20558a526e4600b1941ec3b0e616d7c4a54e5a43 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 23 Sep 2025 17:35:27 -0400 Subject: [PATCH 002/107] fix: add navigation support for google translate - Removed existing google translate widge on initialization - Added event listeners for navigation refs: #394 --- web-app/frontend/src/GoogleTranslate.ts | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/web-app/frontend/src/GoogleTranslate.ts b/web-app/frontend/src/GoogleTranslate.ts index 98a1fcb7..a363470d 100644 --- a/web-app/frontend/src/GoogleTranslate.ts +++ b/web-app/frontend/src/GoogleTranslate.ts @@ -36,6 +36,19 @@ function googleTranslateElementInit() { return; } + // Check if Google Translate widget already exists and remove it + // This is needed for back/forward navigation + const existingWidget = document.querySelector('.goog-te-banner-frame'); + if (existingWidget) { + existingWidget.remove(); + } + + // Clear any existing Google Translate elements + const existingElements = document.querySelectorAll( + '.goog-te-combo, .goog-te-gadget', + ); + existingElements.forEach((element) => element.remove()); + try { new google.translate.TranslateElement( { @@ -177,6 +190,30 @@ googleTranslateElementInit(); // Set up site language button listeners setupSiteLanguageListeners(); +// Handle browser navigation events (back/forward buttons) +function handleNavigationEvents() { + // Listen for popstate events (back/forward navigation) + window.addEventListener('popstate', () => { + // Small delay to ensure DOM is ready after navigation + setTimeout(() => { + googleTranslateElementInit(); + }, 100); + }); + + // Listen for pageshow events (handles both initial load and back/forward cache) + window.addEventListener('pageshow', (event) => { + // Reinitialize if the page was loaded from cache (back/forward navigation) + if (event.persisted) { + setTimeout(() => { + googleTranslateElementInit(); + }, 100); + } + }); +} + +// Set up navigation event listeners +handleNavigationEvents(); + // Add the type definition to the Window interface declare global { interface Window { From 5b2aa557af0af074921285337d307a97d93c8f2c Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 25 Sep 2025 15:42:31 -0400 Subject: [PATCH 003/107] fix: move count num outside of hbs facet list for google translate - Google translate doesn't work well with numbers. The best practice is to only put human-readable part in a separate span. - This is needed to make sure that all the hbs items can be translated well. refs: #393 --- web-app/django/VIM/templates/instruments/index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web-app/django/VIM/templates/instruments/index.html b/web-app/django/VIM/templates/instruments/index.html index 59eae873..75c34a93 100644 --- a/web-app/django/VIM/templates/instruments/index.html +++ b/web-app/django/VIM/templates/instruments/index.html @@ -58,12 +58,11 @@

Hornbostel-Sachs Classification