summaryrefslogtreecommitdiffstats
path: root/templates/admin/base.html
diff options
context:
space:
mode:
authorivar <i@oiee.no>2026-04-03 14:22:23 +0200
committerivar <i@oiee.no>2026-04-03 14:22:23 +0200
commit33310be68544d3381ac6e9899790f4a106e17e8f (patch)
tree385102a7216ffba17d054f11032dae4447371d52 /templates/admin/base.html
parenta8914a8f18c345e934bce93b37845a9dfe0ad73e (diff)
downloadnebbet.no-33310be68544d3381ac6e9899790f4a106e17e8f.tar.xz
nebbet.no-33310be68544d3381ac6e9899790f4a106e17e8f.zip
refactor: convert admin handlers to Gin context-based signatures
- Remove old ServeHTTP method (no longer needed with Gin routing) - Update all 6 handler methods to use *gin.Context instead of http.ResponseWriter, *http.Request - Convert handler signatures: handleList, handleNew, handleNewPost, handleEdit, handleDelete - Remove render() helper (use c.HTML() directly) - Update renderError() to accept gin.Context instead of http.ResponseWriter - Update postFromForm() to extract form data from gin.Context using c.PostForm() - Update main.go to use adminSrv.NewServer() and adminSrv.Engine() - All handlers now use Gin methods: c.HTML(), c.PostForm(), c.Param(), c.Redirect() - Path parameters now extracted via c.Param("slug") instead of function arguments - HTTP status codes and error handling fully migrated to Gin patterns Build verified: go build ./cmd/nebbet succeeds Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'templates/admin/base.html')
-rw-r--r--templates/admin/base.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/templates/admin/base.html b/templates/admin/base.html
new file mode 100644
index 0000000..f88bba6
--- /dev/null
+++ b/templates/admin/base.html
@@ -0,0 +1,34 @@
+{{define "base"}}
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Admin — {{.Title}}</title>
+ <link rel="stylesheet" href="/styles/admin.css">
+ <link rel="stylesheet" href="/lib/milkdown-crepe/style.css">
+ <script type="importmap">
+ {
+ "imports": {
+ "@milkdown/crepe": "/lib/node_modules/@milkdown/crepe"
+ }
+ }
+ </script>
+</head>
+
+<body>
+ <nav>
+ <span class="brand">Admin</span>
+ <a href="/admin/">Posts</a>
+ <a href="/admin/new">New Post</a>
+ </nav>
+ <main>
+ {{if eq .ContentTemplate "list-content"}}{{template "list-content" .}}{{end}}
+ {{if eq .ContentTemplate "form-content"}}{{template "form-content" .}}{{end}}
+ {{if eq .ContentTemplate "error-content"}}{{template "error-content" .}}{{end}}
+ </main>
+</body>
+
+</html>
+{{end}} \ No newline at end of file