Seed from go-template-repo, renamed to simplexcalc
The template's files at a77fd30, without its history or LICENSE, after script/rename simplexcalc. Model: opus-5-5
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
{{define "base"}}<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{{template "title" .}} — {{.AppName}}</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
{{template "navbar" .}}
|
||||
<main>{{template "content" .}}</main>
|
||||
{{template "footer" .}}
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
@@ -0,0 +1,7 @@
|
||||
{{define "title"}}{{.Status}}{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<h1>{{.Status}}</h1>
|
||||
<p>{{.Message}}</p>
|
||||
<p><a href="/">back</a></p>
|
||||
{{end}}
|
||||
@@ -0,0 +1,49 @@
|
||||
{{define "title"}}widgets{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<h1>{{.AppName}}</h1>
|
||||
|
||||
<p>
|
||||
This page is rendered from an embedded template. The stylesheet, the
|
||||
partials in the navigation and footer, and the schema behind the
|
||||
table below all ship inside the binary.
|
||||
</p>
|
||||
|
||||
<h2>widgets ({{.WidgetCount}})</h2>
|
||||
|
||||
<form method="POST" action="/widgets">
|
||||
{{.CSRFField}}
|
||||
<label>
|
||||
name
|
||||
<input type="text" name="name" required maxlength="200" />
|
||||
</label>
|
||||
<label>
|
||||
size
|
||||
<input type="text" name="size" placeholder="4KiB" />
|
||||
</label>
|
||||
<button type="submit">create</button>
|
||||
</form>
|
||||
|
||||
{{if .Widgets}}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>size</th>
|
||||
<th>created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Widgets}}
|
||||
<tr>
|
||||
<td>{{.Name}}</td>
|
||||
<td>{{bytes .SizeBytes}}</td>
|
||||
<td>{{since .CreatedAt}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<p class="empty">No widgets yet.</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{define "footer"}}
|
||||
<footer>
|
||||
<span>{{.AppName}} {{.Version}} ({{.Buildarch}})</span>
|
||||
<span>up {{.Uptime}}</span>
|
||||
</footer>
|
||||
{{end}}
|
||||
@@ -0,0 +1,7 @@
|
||||
{{define "navbar"}}
|
||||
<nav>
|
||||
<a class="brand" href="/">{{.AppName}}</a>
|
||||
<a href="/">home</a>
|
||||
<a href="/.well-known/healthcheck.json">health</a>
|
||||
</nav>
|
||||
{{end}}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Package templates carries the HTML templates and partials into the
|
||||
// binary. It holds no logic: internal/render owns parsing and
|
||||
// execution, and this exists only so the embed directive sits next to
|
||||
// the files it embeds.
|
||||
package templates
|
||||
|
||||
import "embed"
|
||||
|
||||
// FS holds every page template and partial.
|
||||
//
|
||||
// A file that is not matched here does not exist at runtime, and the
|
||||
// failure is a 500 at request time rather than a build error — so the
|
||||
// patterns are deliberately whole-directory, and internal/render parses
|
||||
// all of them at startup so that a broken template fails the process
|
||||
// instead of one request.
|
||||
//
|
||||
//go:embed *.html partials/*.html
|
||||
var FS embed.FS
|
||||
Reference in New Issue
Block a user