The contextpath parameter in converge.go is temporary and should be removed later. What is needed is autodetectio of the context path for the usage page and passing on the context for rendering.
93 lines
3.0 KiB
Plaintext
93 lines
3.0 KiB
Plaintext
package templates
|
|
|
|
|
|
func active(actual int, active int) string {
|
|
res := "nav-item nav-link"
|
|
if actual == active {
|
|
return res + " active"
|
|
}
|
|
return res
|
|
}
|
|
|
|
templ BasePage(tab int) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<link rel="stylesheet" href="../static/css/bootstrap.min.css"
|
|
crossorigin="anonymous">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<script src="../static/js/htmx.1.9.12.js"></script>
|
|
<script src="../static/js/htmx.ws.1.9.12.js"></script>
|
|
|
|
<title>Converge</title>
|
|
</head>
|
|
<body>
|
|
<!-- script>
|
|
htmx.logAll();
|
|
</script -->
|
|
<script>
|
|
function getTimezone() {
|
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
}
|
|
if (!window.originalWebSocket) {
|
|
console.log("timezone override for websockets")
|
|
window.originalWebSocket = htmx.createWebSocket
|
|
htmx.createWebSocket = function(url) {
|
|
url = new URL(url, window.location.href).href
|
|
url = url.replace(/^http/, 'ws');
|
|
let modifiedUrl = url + "?timezone=" + getTimezone()
|
|
return window.originalWebSocket(modifiedUrl)
|
|
}
|
|
}
|
|
|
|
document.body.addEventListener(
|
|
"htmx:configRequest",
|
|
function(evt) {
|
|
console.log("Adding timezone to htmx request headers and making URL absolute");
|
|
evt.detail.headers["X-Timezone"] = getTimezone();
|
|
}
|
|
);
|
|
</script>
|
|
|
|
|
|
<script src="../static/js/bootstrap.bundle.min.js"
|
|
crossorigin="anonymous"></script>
|
|
|
|
<div class="container-fluid" hx-boost="true">
|
|
<div class="row">
|
|
<div class="col">
|
|
<nav class="navbar navbar-expand-sm navbar-light bg-light">
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
|
data-bs-target="#navbarNavAltMarkup"
|
|
aria-controls="navbarNav" aria-expanded="false"
|
|
aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
|
<div class="nav nav-pills">
|
|
|
|
<a class={active(1,tab)} href="index.html">overview</a>
|
|
|
|
<a class={active(2,tab)} href="usage.html">usage</a>
|
|
|
|
<a class={active(3,tab)} href="downloads.html">downloads</a>
|
|
|
|
<a class={active(4,tab)} href="sessions.html">sessions</a>
|
|
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col">
|
|
{ children... }
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|
|
} |