Updated dashboard.js

It's a bit eh, but it works.
This should finally fix active sidebar menus getting deactivated in
certain conditions and all that kinda jazz.
This commit is contained in:
Bobby Wibowo 2020-10-02 04:34:44 +07:00
parent 22cd89779d
commit 3c1f0996a3
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -295,12 +295,14 @@ page.updateTrigger = (trigger, newState) => {
if (newState === 'loading') { if (newState === 'loading') {
trigger.classList.add('is-loading') trigger.classList.add('is-loading')
} else if (newState === 'active') { } else if (newState === 'active') {
if (!trigger.id.startsWith('item')) if (trigger.parentNode.tagName === 'LI' && !trigger.className.includes('pagination-link')) {
return for (let i = 0; i < page.menus.length; i++)
for (let i = 0; i < page.menus.length; i++) page.menus[i].classList.remove('is-active')
page.menus[i].classList.remove('is-active') trigger.classList.remove('is-loading')
trigger.classList.remove('is-loading') trigger.classList.add('is-active')
trigger.classList.add('is-active') } else {
trigger.classList.remove('is-loading')
}
} else { } else {
trigger.classList.remove('is-loading') trigger.classList.remove('is-loading')
trigger.classList.remove('is-active') trigger.classList.remove('is-active')