summaryrefslogtreecommitdiffstats
path: root/templates/admin/list.html
diff options
context:
space:
mode:
authorivar <i@oiee.no>2026-04-07 00:23:24 +0200
committerivar <i@oiee.no>2026-04-07 00:23:24 +0200
commit85920b8c7a2696115d1f77c046f48f6f00d639f1 (patch)
tree14ed2043796eadd6ed5b0a95c55e38e48713d638 /templates/admin/list.html
downloadiblog-85920b8c7a2696115d1f77c046f48f6f00d639f1.tar.xz
iblog-85920b8c7a2696115d1f77c046f48f6f00d639f1.zip
Init
Diffstat (limited to 'templates/admin/list.html')
-rw-r--r--templates/admin/list.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/templates/admin/list.html b/templates/admin/list.html
new file mode 100644
index 0000000..8e488b6
--- /dev/null
+++ b/templates/admin/list.html
@@ -0,0 +1,50 @@
+{{define "list-content"}}
+{{if .Posts}}
+<table>
+ <thead>
+ <tr>
+ <th>Tittel</th>
+ <th>Dato</th>
+ <th>Emne</th>
+ <th>Status</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{range .Posts}}
+ <tr>
+ <td>{{.Title}}</td>
+ <td>{{.Date}}</td>
+ <td>
+ {{if .Tags}}
+ <div>
+ {{range .Tags}}<span class="tag">{{.}} </span>{{end}}
+ </div>
+ {{end}}
+ </td>
+ <td>
+ {{if .Draft}}<span>Ikke publisert</span>{{else}}<span>Publisert</span>{{end}}
+ </td>
+ <td>
+ <div>
+ <a href="/admin/{{.Slug}}">Rediger</a>
+ <button onclick=" deletePost('{{.Slug}}', '{{.Title}}' )">Slett</button>
+ </div>
+ </td>
+ </tr>
+ {{end}}
+ </tbody>
+</table>
+{{else}}
+<div>Ingen innlegg</div>
+{{end}}
+
+<script>
+ function deletePost(slug, title) {
+ if (!confirm('Slett "' + title + '"?')) return;
+ fetch('/admin/' + slug, { method: 'DELETE' })
+ .then(() => window.location.href = '/admin/')
+ .catch(err => alert('Kunne ikke slette: ' + err));
+ }
+</script>
+{{end}} \ No newline at end of file