From abff8de1553a6d18c03a8ac6438a0eaff91314bc Mon Sep 17 00:00:00 2001 From: cthorne Date: Wed, 8 Jan 2025 04:26:03 +1000 Subject: [PATCH] Fix closing results section (#41) Fix for the closing of results when doing search for a second time --- static/js/main.js | 8 ++++++-- templates/index.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index 454e8dc..1458503 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -4,7 +4,8 @@ document.addEventListener('DOMContentLoaded', () => { const elements = { searchInput: document.getElementById('search-input'), searchButton: document.getElementById('search-button'), - resultsSection: document.getElementById('results-section'), + resultsSectionAccordion: document.getElementById('results-section-accordion'), + searchAccordion: document.getElementById('search-accordion'), resultsHeading: document.getElementById('results-heading'), resultsTable: document.getElementById('results-table'), resultsTableBody: document.querySelector('#results-table tbody'), @@ -96,7 +97,10 @@ document.addEventListener('DOMContentLoaded', () => { STATE.isSearching = true; utils.showLoading(elements.searchLoading); - utils.showAccordion(elements.resultsSection); + if (!elements.searchAccordion.classList.contains('uk-open')) + { + utils.showAccordion(elements.resultsSectionAccordion); + }; const data = await utils.fetchJson( `${API_ENDPOINTS.search}?query=${encodeURIComponent(query)}` ); diff --git a/templates/index.html b/templates/index.html index 8722d6f..a73baeb 100644 --- a/templates/index.html +++ b/templates/index.html @@ -34,7 +34,7 @@ -