feat: SSR 帖运营标记与回收站

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-29 18:20:47 +08:00
parent 83994e2707
commit 2d09729976
11 changed files with 415 additions and 16 deletions

View File

@@ -4,6 +4,7 @@
<a href="/admin/boards"{{if eq .NavActive "boards"}} class="is-active"{{end}}>板块</a>
<a href="/admin/moderation"{{if eq .NavActive "moderation"}} class="is-active"{{end}}>审核</a>
<a href="/admin/reports"{{if eq .NavActive "reports"}} class="is-active"{{end}}>举报</a>
<a href="/admin/trash"{{if eq .NavActive "trash"}} class="is-active"{{end}}>回收站</a>
<a href="/admin/friend-links"{{if eq .NavActive "friend-links"}} class="is-active"{{end}}>友链</a>
<a href="/admin/pages"{{if eq .NavActive "pages"}} class="is-active"{{end}}>单页</a>
<a href="/admin/settings"{{if eq .NavActive "settings"}} class="is-active"{{end}}>设置</a>

View File

@@ -0,0 +1,52 @@
{{define "admin/trash"}}
{{template "base/head" .}}
{{template "base/navbar" .}}
<main class="j13-main j13-admin">
<h1>回收站</h1>
{{template "admin/nav" .}}
{{template "base/alert" .}}
<form method="get" action="/admin/trash" class="j13-form j13-admin-form j13-inline-form">
<label>关键词 <input name="keyword" value="{{.Keyword}}" placeholder="标题"/></label>
<button type="submit">搜索</button>
</form>
{{if .Items}}
<table class="j13-admin-table">
<thead>
<tr><th>标题</th><th>作者</th><th>板块</th><th>删除时间</th><th>操作</th></tr>
</thead>
<tbody>
{{range .Items}}
<tr>
<td>{{.Title}}</td>
<td>{{.AuthorName}}</td>
<td>{{if .BoardName}}{{.BoardName}}{{else}}—{{end}}</td>
<td>{{.DeletedLabel}}</td>
<td>
<form method="post" action="/admin/trash/{{.ID}}/restore" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
<button type="submit" class="j13-linkbtn">恢复</button>
</form>
<form method="post" action="/admin/trash/{{.ID}}/purge" class="j13-inline-form" onsubmit="return confirm('确认彻底删除?不可恢复');">
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
<button type="submit" class="j13-linkbtn">彻底删除</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{if or .HasPrev .HasMore}}
<nav class="j13-pager">
{{if .HasPrev}}<a href="/admin/trash?page={{.PrevPage}}{{if $.Keyword}}&amp;keyword={{queryEscape $.Keyword}}{{end}}">上一页</a>{{end}}
<span>第 {{.Page}} 页</span>
{{if .HasMore}}<a href="/admin/trash?page={{.NextPage}}{{if $.Keyword}}&amp;keyword={{queryEscape $.Keyword}}{{end}}">下一页</a>{{end}}
</nav>
{{end}}
{{else}}
<p class="j13-empty">回收站为空。</p>
{{end}}
</main>
{{template "base/footer" .}}
{{end}}

View File

@@ -5,6 +5,8 @@
<div class="j13-post__meta">
{{if .Pinned}}<span class="j13-tag j13-tag--pin">置顶</span>{{end}}
{{if .Featured}}<span class="j13-tag j13-tag--feat">精华</span>{{end}}
{{if .EditLocked}}<span class="j13-tag">禁编</span>{{end}}
{{if .CommentsLocked}}<span class="j13-tag">已结贴</span>{{end}}
{{if .PostTypeLabel}}<span class="j13-tag">{{.PostTypeLabel}}</span>{{end}}
{{if .BoardName}}<a class="j13-tag" href="/board/{{.BoardID}}">{{.BoardName}}</a>{{end}}
{{if .AuthorID}}<a href="/user/{{.AuthorID}}">{{.AuthorName}}</a>{{else}}<span>{{.AuthorName}}</span>{{end}}
@@ -46,6 +48,39 @@
{{end}}
</div>
{{end}}
{{if .IsAdmin}}
<div class="j13-post__admin" role="group" aria-label="管理操作">
<form method="post" action="/post/{{.PostID}}/admin/pin" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<input type="hidden" name="enable" value="{{if .GlobalPinned}}0{{else}}1{{end}}"/>
<button type="submit" class="j13-linkbtn">{{if .GlobalPinned}}取消全局置顶{{else}}全局置顶{{end}}</button>
</form>
<form method="post" action="/post/{{.PostID}}/admin/board-pin" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<input type="hidden" name="enable" value="{{if .BoardPinned}}0{{else}}1{{end}}"/>
<button type="submit" class="j13-linkbtn">{{if .BoardPinned}}取消版内置顶{{else}}版内置顶{{end}}</button>
</form>
<form method="post" action="/post/{{.PostID}}/admin/feature" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<input type="hidden" name="enable" value="{{if .Featured}}0{{else}}1{{end}}"/>
<button type="submit" class="j13-linkbtn">{{if .Featured}}取消精华{{else}}设为精华{{end}}</button>
</form>
<form method="post" action="/post/{{.PostID}}/admin/edit-lock" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<input type="hidden" name="enable" value="{{if .EditLocked}}0{{else}}1{{end}}"/>
<button type="submit" class="j13-linkbtn">{{if .EditLocked}}允许编辑{{else}}禁止编辑{{end}}</button>
</form>
<form method="post" action="/post/{{.PostID}}/admin/comments-lock" class="j13-inline-form">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<input type="hidden" name="enable" value="{{if .CommentsLocked}}0{{else}}1{{end}}"/>
<button type="submit" class="j13-linkbtn">{{if .CommentsLocked}}解锁评论{{else}}锁定评论{{end}}</button>
</form>
<form method="post" action="/post/{{.PostID}}/admin/delete" class="j13-inline-form" onsubmit="return confirm('确认移入回收站?');">
<input type="hidden" name="_csrf" value="{{.CSRF}}"/>
<button type="submit" class="j13-linkbtn">移入回收站</button>
</form>
</div>
{{end}}
</header>
<div class="j13-post__content post-detail-content">{{safeHTML .BodyHTML}}</div>
</article>