diff options
| author | grm <grm@eyesin.space> | 2026-09-12 12:33:57 +0300 |
|---|---|---|
| committer | grm <grm@eyesin.space> | 2026-09-12 12:33:57 +0300 |
| commit | dd13e4b73a105ee416b6cfd8eb19b217622c0031 (patch) | |
| tree | 93ce503a09b99115efeeee6cd1a85781c1674b02 /internal/web/templates/dashboard/sections.html | |
| parent | 2b450b66fee4906e746f6e04a6d07a72ff2faf64 (diff) | |
| download | blogspace-dd13e4b73a105ee416b6cfd8eb19b217622c0031.tar.gz blogspace-dd13e4b73a105ee416b6cfd8eb19b217622c0031.tar.bz2 blogspace-dd13e4b73a105ee416b6cfd8eb19b217622c0031.zip | |
Add announcements: blog-wide notices on every page and post
A blog can have any number of announcements ("sections" in the schema):
a book club's next meeting, this month's pick, a holiday closure. Each
has a placement (above or below the posts, or under the menu when the
menu is a left sidebar), a look (highlighted, warning, plain), an order,
and an on/off switch so recurring notices can be kept around while hidden.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A
Diffstat (limited to 'internal/web/templates/dashboard/sections.html')
| -rw-r--r-- | internal/web/templates/dashboard/sections.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/web/templates/dashboard/sections.html b/internal/web/templates/dashboard/sections.html new file mode 100644 index 0000000..d2fade7 --- /dev/null +++ b/internal/web/templates/dashboard/sections.html @@ -0,0 +1,29 @@ +{{define "title"}}Announcements · {{.Blog.Title}}{{end}} +{{define "content"}} +{{$u := print "/b/" .Blog.Subdomain "/announcements"}} +<div class="pagehead"> + <h1>Announcements</h1> + <div class="actions"><a class="btn" href="{{$u}}/new">+ New announcement</a></div> + <p class="lead muted">Notices shown on every page and post of your blog — the next meeting, this month's book, a holiday closure. Hide one instead of deleting it if you will need it again.</p> +</div> +<div class="card"> +{{if .Data.sections}} +<table> + <tr><th>Order</th><th>Announcement</th><th>Where</th><th>Look</th><th></th></tr> + {{range .Data.sections}}<tr{{if not .Enabled}} class="disabled"{{end}}> + <td class="nowrap"> + <form method="post" action="{{$u}}/{{.ID}}/move" class="inline"><input type="hidden" name="_csrf" value="{{$.CSRF}}"><input type="hidden" name="dir" value="up"><button class="mini" title="Move up">▲</button></form> + <form method="post" action="{{$u}}/{{.ID}}/move" class="inline"><input type="hidden" name="_csrf" value="{{$.CSRF}}"><input type="hidden" name="dir" value="down"><button class="mini" title="Move down">▼</button></form> + </td> + <td><a href="{{$u}}/{{.ID}}/edit">{{if .Title}}{{.Title}}{{else}}(untitled){{end}}</a>{{if not .Enabled}}<span class="tag off">hidden</span>{{end}}</td> + <td>{{if eq .Placement "above"}}Above the posts{{else if eq .Placement "below"}}Below the posts{{else}}Sidebar{{end}}</td> + <td>{{if eq .Style "note"}}Highlighted{{else if eq .Style "warning"}}Warning{{else}}Plain{{end}}</td> + <td class="nowrap"> + <form method="post" action="{{$u}}/{{.ID}}/toggle" class="inline"><input type="hidden" name="_csrf" value="{{$.CSRF}}"><button class="mini">{{if .Enabled}}Hide{{else}}Show{{end}}</button></form> + <a class="danger" href="{{$u}}/{{.ID}}/delete">delete</a> + </td> + </tr>{{end}} +</table> +{{else}}<p class="muted">No announcements yet. <a href="{{$u}}/new">Write the first one.</a></p>{{end}} +</div> +{{end}} |
