Add header help icon and in-app docs search
- A ? icon in the top-right header deep-links to the doc most relevant to the current page (client-side path mapping, same pattern already used for top-nav active-link highlighting -- no server-side "current section" local exists to key off of instead). Falls back to the docs index. - GET /docs/search does a plain line-substring search over the existing allowlisted doc set. No new dependency, stays usable with no internet access. Bumps to v1.1.10. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KDEx8ghuZR61pqPXc6da9C
This commit is contained in:
@@ -64,6 +64,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div class="form-inline mt-2 mt-md-0">
|
||||
<a id="cl-help" class="nav-link text-light me-3" href="/docs" title="Help">
|
||||
<i class="fa-solid fa-circle-question"></i>
|
||||
</a>
|
||||
<a id="cl-username" class="navbar-text text-light me-3" href="/" style="display: none;">
|
||||
<i class="fa-solid fa-user me-1"></i><span id="cl-username-text"></span>
|
||||
</a>
|
||||
@@ -98,6 +101,19 @@
|
||||
sessionStorage.setItem('update-banner-dismissed', '1');
|
||||
}
|
||||
|
||||
// Deep-link the header help icon to whichever doc is most relevant to
|
||||
// the current page. No server-side "current section" local exists (every
|
||||
// res.render() call shares one values object, see routes/index.js), so
|
||||
// this follows the same client-side path-matching convention already
|
||||
// used for the top-nav active-link highlighting just below. Unmapped
|
||||
// pages fall back to the docs index (already /docs, the anchor's default).
|
||||
var HELP_DOCS_BY_PATH = {
|
||||
'/users': 'ldap',
|
||||
'/groups': 'ldap',
|
||||
'/integrations': 'ldap',
|
||||
'/oauth/authorize': 'oauth',
|
||||
};
|
||||
|
||||
$(document).ready(async function(){
|
||||
|
||||
// Set the correct link to active in the top nav bar
|
||||
@@ -109,6 +125,12 @@
|
||||
}
|
||||
})
|
||||
|
||||
// /users/:uid (profile pages) should still map like /users.
|
||||
var path = window.location.pathname.toLocaleLowerCase();
|
||||
var helpSlug = HELP_DOCS_BY_PATH[path] ||
|
||||
(path.indexOf('/users/') === 0 ? HELP_DOCS_BY_PATH['/users'] : null);
|
||||
if(helpSlug) $('#cl-help').attr('href', '/docs/' + helpSlug);
|
||||
|
||||
// Set the correct login/logout button, and reveal the current user's
|
||||
// name (linking to their profile) once we know who they are.
|
||||
var me = await app.auth.isLoggedIn();
|
||||
|
||||
Reference in New Issue
Block a user