- New /codes dashboard page (behind the session login, linked in the top bar):
lists every mapping by kind with Add, inline Edit+Save and Delete. Sam can put
real teacher surnames in without a rebuild (FR-17).
- Decode timetable EVENTS through the same map as periods, so an ensemble reads
'JAZZ ENSEMBLE - Ensemble Room - Mr KWO' instead of raw codes.
- teacherName splits comma- or space-separated codes ('HHL, OFG').
- SeedCodes is a one-time bootstrap while the table is empty, so a correction or
a delete is never overwritten or restored.
- Tests: decode Label/Event, the /codes page (save, refuse, csrf, delete, auth),
store re-seed behaviour. go test ./internal/... passes.
89 lines
3.6 KiB
HTML
89 lines
3.6 KiB
HTML
{{define "codes.html"}}<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="color-scheme" content="light dark">
|
|
<title>{{.Title}} — Compass / Teams</title>
|
|
<link rel="stylesheet" href="/static/tokens.css">
|
|
<link rel="stylesheet" href="/static/app.css">
|
|
<script src="/static/theme.js" defer></script>
|
|
</head>
|
|
<body class="app">
|
|
<nav class="nav-bar">
|
|
<a class="nav-bar__brand" href="/">
|
|
<span class="nav-bar__mark" aria-hidden="true"></span>
|
|
Compass / Teams
|
|
</a>
|
|
<div class="nav-bar__right">
|
|
<a class="button-utility" href="/">What is due</a>
|
|
<button class="button-utility" type="button" data-theme-toggle>Dark</button>
|
|
<span class="nav-bar__user">{{.Username}}</span>
|
|
<form method="post" action="/logout" class="nav-bar__logout">
|
|
<input type="hidden" name="csrf" value="{{.CSRF}}">
|
|
<button class="button-utility" type="submit">Sign out</button>
|
|
</form>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container">
|
|
<header class="page-head">
|
|
<h1 class="heading-1">Codes</h1>
|
|
<p class="page-head__sub">Plain-English names for the Compass codes in the briefs.
|
|
A code that is not here renders as the raw code — never blank.</p>
|
|
</header>
|
|
|
|
{{if .ErrMsg}}<p class="flash flash--error" role="alert">{{.ErrMsg}}</p>{{end}}
|
|
{{if .Flash}}<p class="flash flash--{{.FlashLevel}}" role="status">{{.Flash}}</p>{{end}}
|
|
|
|
{{range .Groups}}
|
|
<section class="section" aria-labelledby="codes-{{.Kind}}-title">
|
|
<div class="section__head">
|
|
<h2 id="codes-{{.Kind}}-title" class="heading-2">{{.Label}}</h2>
|
|
<span class="category-pill">{{len .Codes}}</span>
|
|
</div>
|
|
<p class="page-head__sub">{{.Hint}}</p>
|
|
|
|
<form method="post" action="/codes" class="inline-form">
|
|
<input type="hidden" name="csrf" value="{{$.CSRF}}">
|
|
<input type="hidden" name="kind" value="{{.Kind}}">
|
|
<input class="text-input" type="text" name="code" placeholder="code" required>
|
|
<input class="text-input" type="text" name="name" placeholder="plain English" required>
|
|
<button class="button-primary" type="submit">Add</button>
|
|
</form>
|
|
|
|
{{if .Codes}}
|
|
<ul class="item-list">
|
|
{{range .Codes}}
|
|
<li class="item">
|
|
<div class="item__body">
|
|
<form method="post" action="/codes" class="inline-form">
|
|
<input type="hidden" name="csrf" value="{{$.CSRF}}">
|
|
<input type="hidden" name="kind" value="{{.Kind}}">
|
|
<input type="hidden" name="code" value="{{.Code}}">
|
|
<code class="item__subject">{{.Code}}</code>
|
|
<input class="text-input" type="text" name="name" value="{{.Name}}" required>
|
|
<button class="button-primary" type="submit">Save</button>
|
|
</form>
|
|
</div>
|
|
<form class="item__actions" method="post" action="/codes/delete"
|
|
onsubmit="return confirm('Remove this mapping? The code renders raw again.');">
|
|
<input type="hidden" name="csrf" value="{{$.CSRF}}">
|
|
<input type="hidden" name="kind" value="{{.Kind}}">
|
|
<input type="hidden" name="code" value="{{.Code}}">
|
|
<button class="button-utility button-utility--danger" type="submit">Delete</button>
|
|
</form>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p class="section__empty">No codes yet. Add one above.</p>
|
|
{{end}}
|
|
</section>
|
|
{{end}}
|
|
</main>
|
|
|
|
<footer class="app-foot">Family Home Lab · Compass / Teams</footer>
|
|
</body>
|
|
</html>{{end}}
|