portico-header: Fix navbar user dropdown not working.

As part of #24678, this code was accidentally removed. We just
add it back to fix the broken user profile dropdown in the navbar
of non corporate pages.
This commit is contained in:
Aman Agrawal 2023-04-18 10:47:17 +00:00 committed by Tim Abbott
parent c27ff12b8c
commit 2553858c91
1 changed files with 17 additions and 0 deletions

View File

@ -80,4 +80,21 @@ $(() => {
document.body.classList.remove("_full-height-no-scroll"); document.body.classList.remove("_full-height-no-scroll");
} }
}); });
/* Used by navbar of non-corporate URLs. */
$(".portico-header li.logout").on("click", () => {
$("#logout_form").trigger("submit");
return false;
});
$(".dropdown").on("click", (e) => {
const $this = $(e.target);
const dropdown_is_shown = $this.closest(".dropdown").hasClass("show");
if (!dropdown_is_shown) {
$this.closest(".dropdown").addClass("show");
} else if (dropdown_is_shown) {
$this.closest(".dropdown").removeClass("show");
}
});
}); });