Pilot module for the shared design used by yasta, yasl, yaiam, yakwui, and yamase-web: server-rendered Bootstrap dashboard chrome, imported as a Go module instead of copy-pasted per project.
2.5 KiB
yetano-webui-template
Shared server-rendered web UI chrome (base layout, navbar, sidebar,
footer) for the Yetano/Yak/Yamase family of ops-tool admin dashboards.
This is a real Go module (teruna.dev/yetano/yetano-webui-template,
package layout), imported by each dashboard rather than copy-pasted —
see layout.go for the API (PageHeader, NavItem, NewRenderer,
StaticHandler).
Source of truth
This repo is the source of truth for the shared layout. It is mirrored
into the other two meta-repos as yak-webui-template and
yamase-webui-template, each of which pulls this repo in via git subtree so layout/CSS changes can be synchronized without duplicating
design work. Make layout changes here first, then push them out — never
edit the mirrored copies directly.
Pushing a change out to the mirrors
From inside yak or yamase (which already have this repo added as a
subtree remote — see below):
git subtree pull --prefix=yak-webui-template webui-template-origin main --squash
# resolve/verify, then:
git push origin main
One-time subtree setup (already done for yak/yamase, kept here for
reference/re-setup)
git remote add webui-template-origin https://teruna.dev/yetano/yetano-webui-template.git
git subtree add --prefix=yak-webui-template webui-template-origin main --squash
What's shared vs. what stays per-project
Shared here: the base HTML skeleton, navbar, sidebar (generic nav-item
list), footer, and the CSS rules that style exactly those elements
(static/style.css — theme root variables, navbar, .sidebar .nav-link
incl. the #0b82b8 inactive-link color, footer, flash-banner alerts).
Stays in each consuming project: page-specific templates
(templates/pages/*.html.tmpl), page-content CSS (cards, tables, badges,
forms, buttons, markdown, ...), and anything else specific to that tool.
Consuming this module
type pageHeader = layout.PageHeader // embed this in your own page data structs
r, err := layout.NewRenderer(pagesFS, "templates/pages", pageNames, ".html.tmpl", template.FuncMap{
"buildInfo": func() string { return version.Get().Compact() },
})
...
mux.Handle("/webui-static/", layout.StaticHandler("/webui-static/"))
See yetano/yasta for a full worked example (the pilot migration of this
module).
Migration status
| Project | Meta-repo | Status |
|---|---|---|
yasta |
yetano | migrated (pilot) |
yasl |
yetano | not yet migrated |
yaiam |
yetano | not yet migrated |
yakwui |
yak | not yet migrated |
yamase-web |
yamase | not yet migrated |