From: Justin Wind Date: Sat, 16 Mar 2024 00:47:04 +0000 (-0700) Subject: rearrange navLinks, update readme X-Git-Tag: v1.5.3~2 X-Git-Url: http://git.squeep.com/?p=squeep-html-template-helper;a=commitdiff_plain;h=eb018a6fe29fc8c13841c94e894e5aff192ea73f rearrange navLinks, update readme --- diff --git a/README.md b/README.md index 205bbc5..32f2673 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ The context is referenced for authenticated user information, as well as messagi - `ctx.session.authenticatedIdentifier` - `ctx.session.authenticatedProfile` -If either of these are present, a navigation link is added to the page header allowing the user to log out. -The link will point relatively to `/admin/logout`. +If either of these are present, navigation links are added to the page header allowing the user to manage their account or log out. +The links will point relatively to `/admin/settings` and `/admin/logout`, respectively. - `ctx.url` diff --git a/lib/template-helper.js b/lib/template-helper.js index 747c525..e48cdb4 100644 --- a/lib/template-helper.js +++ b/lib/template-helper.js @@ -390,11 +390,11 @@ function htmlPage(pagePathLevel, ctx, options, main = []) { const logoutRedirect = ctx?.url ? `?r=${encodeURIComponent(ctx.url)}` : ''; const adminPath = (pagePathLevel > 0) ? `${'../'.repeat(pagePathLevel - 1)}` : 'admin/'; options.navLinks.push({ + text: 'Account', + href: `${adminPath}settings`, + }, { text: `Logout (${user})`, href: `${adminPath}logout${logoutRedirect}`, - }, { - text: 'Settings', - href: `${adminPath}settings`, }); }