Preserve Dock navigation and align account screens
This commit is contained in:
1 parent
17011ebd4d
commit
ef98c2835b
28 files changed
+132
-14
No files matched your search
+16
-8
@@ -252,9 +252,6 @@ function navigationPages() {
|
||||
function dockAccount() {
|
||||
return `<div class="dock-account-area"><div id="account-menu" class="account-menu" popover="auto" aria-label="${t("Меню аккаунта", "Account menu")}">
|
||||
<button autofocus data-page="profile">${icon("users")}<span>${t("Аккаунт", "Account")}</span></button>
|
||||
<button data-page="security">${icon("settings")}<span>${t("Настройки", "Settings")}</span></button>
|
||||
<button data-page="applications">${icon("applications")}<span>${t("Приложения", "Applications")}</span></button>
|
||||
<button data-action="shares">${icon("components")}<span>${t("Мои общие ресурсы", "My shares")}</span></button>
|
||||
${currentIdentity()?.roles.some((r) => ["Master Admin", "SSO Admin"].includes(r)) ? `<button data-page="dashboard">${icon("dashboard")}<span>${t("Панель управления", "Control panel")}</span></button>` : ""}
|
||||
<button class="account-separator" data-identity="switch">${icon("users")}<span>${t("Сменить аккаунт", "Switch account")}</span></button>
|
||||
<button class="account-separator" data-identity="logout"><svg class="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M9 4H4v16h5M13 7l5 5-5 5M8 12h11"/></svg><span>${t("Выйти из SSO", "Sign out of SSO")}</span></button></div>
|
||||
@@ -342,7 +339,11 @@ function savePreferences() {
|
||||
} catch {}
|
||||
}
|
||||
let initialRender = true;
|
||||
function render() {
|
||||
function render({ preserveDock = false } = {}) {
|
||||
const dockWasOpen =
|
||||
preserveDock &&
|
||||
document.body.classList.contains("dock-open") &&
|
||||
page !== "auth";
|
||||
const route = new URL(location.href);
|
||||
route.searchParams.delete("concept");
|
||||
route.searchParams.set("page", page);
|
||||
@@ -358,9 +359,11 @@ function render() {
|
||||
]({}, "", route);
|
||||
}
|
||||
initialRender = false;
|
||||
dockHoverOpened = false;
|
||||
clearTimeout(dockCloseTimer);
|
||||
document.body.classList.remove("dock-open");
|
||||
if (!dockWasOpen) {
|
||||
dockHoverOpened = false;
|
||||
document.body.classList.remove("dock-open");
|
||||
}
|
||||
document.title = `Anidev / ${concept.name} / ${pageNames[page]}`;
|
||||
const content = accountPageIds.includes(page)
|
||||
? accountUI.renderPage(page)
|
||||
@@ -386,6 +389,7 @@ function render() {
|
||||
bindForms();
|
||||
accountUI.bind(page);
|
||||
bindDockHover();
|
||||
if (dockWasOpen) setDockOpen(true, false);
|
||||
bindCharts();
|
||||
if (page === "users" && $("#user-search")) bindUsers();
|
||||
}
|
||||
@@ -817,10 +821,14 @@ document.addEventListener("click", async (e) => {
|
||||
if (await accountUI.handleClick(e)) return;
|
||||
const pageButton = e.target.closest("[data-page]");
|
||||
if (pageButton) {
|
||||
const fromDock = Boolean(pageButton.closest(".navigation"));
|
||||
if (fromDock && page === pageButton.dataset.page) return;
|
||||
page = pageButton.dataset.page;
|
||||
$("#dialog").close();
|
||||
render();
|
||||
$("#content")?.focus();
|
||||
render({ preserveDock: fromDock });
|
||||
if (fromDock && document.body.classList.contains("dock-open")) {
|
||||
$(".nav-links [aria-current=page]")?.focus({ preventScroll: true });
|
||||
} else $("#content")?.focus();
|
||||
return;
|
||||
}
|
||||
const sorter = e.target.closest("[data-sort]");
|
||||
|
||||
Reference in new issue
Block a user