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:
@@ -62,6 +62,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="/profile" style="display: none;">
|
||||
<i class="fa-solid fa-user me-1"></i><span id="cl-username-text"></span>
|
||||
</a>
|
||||
@@ -102,6 +105,21 @@
|
||||
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/render.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 = {
|
||||
'/hosts': 'installation',
|
||||
'/dns': 'installation',
|
||||
'/users': 'architecture',
|
||||
'/permissions': 'architecture',
|
||||
'/groups': 'architecture',
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// Set the correct link to active in the top nav bar
|
||||
@@ -113,6 +131,9 @@
|
||||
}
|
||||
})
|
||||
|
||||
let helpSlug = HELP_DOCS_BY_PATH[window.location.pathname.toLocaleLowerCase()];
|
||||
if(helpSlug) $('#cl-help').attr('href', '/docs/' + helpSlug);
|
||||
|
||||
// Set the correct login/logout button, and reveal admin-only nav
|
||||
// items for global admins.
|
||||
app.auth.isLoggedIn(function(error, data){
|
||||
|
||||
Reference in New Issue
Block a user