Files
jiang13-forum/embed_static/templates/post_new.html
freefire e1c1708715 初始提交:姜十三论坛 Jiang13 Forum
轻量自用论坛,Go 单二进制 + React SPA 内嵌 + SQLite。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-15 21:08:52 +08:00

38 lines
1.3 KiB
HTML

{{define "post_new.html"}}{{template "layout" .}}{{end}}
{{define "content"}}
<h3>发布新帖</h3>
<form id="postForm">
<div class="mb-3">
<label class="form-label">选择板块</label>
<select name="board_id" class="form-select" required>
{{range .Boards}}<option value="{{.ID}}">{{.Name}}</option>{{end}}
</select>
</div>
<div class="mb-3">
<label class="form-label">标题</label>
<input type="text" name="title" class="form-control" required maxlength="256">
</div>
<div class="mb-3">
<label class="form-label">标签(逗号分隔)</label>
<input type="text" name="tags" class="form-control" placeholder="Go,技术,交流">
</div>
<div class="mb-3">
<label class="form-label">内容(支持 HTML 富文本)</label>
<textarea name="content" class="form-control" rows="12" required></textarea>
<div class="form-text">可使用 &lt;b&gt;&lt;i&gt;&lt;a&gt;&lt;img&gt; 等 HTML 标签</div>
</div>
<button type="submit" class="btn btn-success">发布</button>
</form>
{{end}}
{{define "scripts"}}
<script>
document.getElementById('postForm').addEventListener('submit',function(e){
e.preventDefault();
apiPost('/api/posts',this,true).then(d=>{
if(d.error){showToast(d.error,'danger');return;}
location.href='/post/'+d.post_id;
});
});
</script>
{{end}}