Add PageHeader.BodyAttrs/SidebarAttrs escape hatches
Needed by yakwui's Alpine.js-based collapsible sidebar (x-data on <body>, :class binding on the sidebar <nav>) -- the shared markup has no generic opinion about a consumer's own client-side framework state.
This commit is contained in:
1 parent
671d9bd92d
commit
c99b000b1d
2 files changed
+10
-2
No files matched your search
@@ -58,6 +58,14 @@ type PageHeader struct {
|
|||||||
NavbarRightExtra template.HTML // extra markup rendered after Username/Logout in the navbar's right group
|
NavbarRightExtra template.HTML // extra markup rendered after Username/Logout in the navbar's right group
|
||||||
ExtraHeadHTML template.HTML // extra <link>/<script> tags appended to <head>
|
ExtraHeadHTML template.HTML // extra <link>/<script> tags appended to <head>
|
||||||
ExtraBodyHTML template.HTML // extra <script> tags appended before </body>
|
ExtraBodyHTML template.HTML // extra <script> tags appended before </body>
|
||||||
|
// BodyAttrs/SidebarAttrs are raw extra attributes (include their own
|
||||||
|
// leading space, e.g. ` x-data="{ open: true }"`) spliced into
|
||||||
|
// <body...> and the sidebar's <nav...> tag -- an escape hatch for a
|
||||||
|
// consuming project's own client-side framework state (e.g. yakwui's
|
||||||
|
// Alpine.js collapsible sidebar), which the shared markup has no
|
||||||
|
// generic opinion about.
|
||||||
|
BodyAttrs template.HTML
|
||||||
|
SidebarAttrs template.HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renderer holds one independently parsed *template.Template per page:
|
// Renderer holds one independently parsed *template.Template per page:
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
<script src="{{.BasePath}}/webui-static/bootstrap.bundle.min.js" defer></script>
|
<script src="{{.BasePath}}/webui-static/bootstrap.bundle.min.js" defer></script>
|
||||||
{{.ExtraHeadHTML}}
|
{{.ExtraHeadHTML}}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body{{.BodyAttrs}}>
|
||||||
{{template "navbar" .}}
|
{{template "navbar" .}}
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<nav class="col-md-2 col-lg-2 sidebar d-md-block">
|
<nav class="col-md-2 col-lg-2 sidebar d-md-block"{{.SidebarAttrs}}>
|
||||||
{{template "sidebar" .}}
|
{{template "sidebar" .}}
|
||||||
</nav>
|
</nav>
|
||||||
<main class="col-md-10 col-lg-10 ms-sm-auto px-md-4 py-3">
|
<main class="col-md-10 col-lg-10 ms-sm-auto px-md-4 py-3">
|
||||||
|
|||||||
Reference in new issue
Block a user