134 lines
3.9 KiB
Plaintext
134 lines
3.9 KiB
Plaintext
{{ define "title" }}Update Blog{{ end }}
|
|
{{ define "content" }}
|
|
<h1>Update Blog</h1>
|
|
|
|
{{ if .V.preview }}
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
Preview
|
|
</div>
|
|
<div class="card-body">
|
|
{{ .V.preview }}
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
|
|
{{ $Post := .V.post }}
|
|
|
|
<form method="POST" action="/blog/edit">
|
|
{{ CSRF }}
|
|
<input type="hidden" name="id" value="{{ $Post.ID }}">
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<div class="form-group">
|
|
<label for="title">Title</label>
|
|
<input type="text" class="form-control"
|
|
name="title" id="title"
|
|
value="{{ $Post.Title }}"
|
|
placeholder="Subject">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="fragment">URL Fragment</label>
|
|
<input type="text" class="form-control"
|
|
name="fragment" id="fragment"
|
|
aria-describedby="fragment-help"
|
|
value="{{ $Post.Fragment }}"
|
|
placeholder="url-fragment-for-blog-entry">
|
|
<small id="fragment-help" class="form-text text-muted">
|
|
You can leave this blank if writing a new post; it will automatically
|
|
get a unique fragment based on the post title.
|
|
</small>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<div class="float-right">
|
|
<label>
|
|
<input type="radio" name="content-type" value="markdown"{{ if ne $Post.ContentType "html" }} checked{{ end }}>
|
|
Markdown
|
|
</label>
|
|
|
|
<label>
|
|
<input type="radio" name="content-type" value="html"{{ if eq $Post.ContentType "html" }} checked{{ end }}>
|
|
HTML
|
|
</label>
|
|
</div>
|
|
<label for="body">Body</label>
|
|
<textarea class="form-control" cols="40" rows="12" name="body">{{ $Post.Body }}</textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="tags">Tags</label>
|
|
<input type="text" class="form-control"
|
|
name="tags" id="tags"
|
|
value="{{ $Post.TagsString }}"
|
|
placeholder="comma, separated, list">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="privacy">Privacy</label>
|
|
<select class="form-control"
|
|
name="privacy" id="privacy">
|
|
<option value="public"{{ if eq $Post.Privacy "public" }} selected{{ end }}>
|
|
Public: everyone can see this post</option>
|
|
<option value="private"{{ if eq $Post.Privacy "private" }} selected{{ end }}>
|
|
Private: only logged-in users can see this post</option>
|
|
<option value="unlisted"{{ if eq $Post.Privacy "unlisted" }} selected{{ end }}>
|
|
Unlisted: only logged-in users and those with the direct link can see this post</option>
|
|
<option value="draft"{{ if eq $Post.Privacy "draft" }} selected{{ end }}>
|
|
Draft: only you can see this post</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Options</label>
|
|
</div>
|
|
|
|
<div class="form-check">
|
|
<input type="checkbox" class="form-input-check"
|
|
name="sticky" id="sticky"
|
|
value="true"
|
|
{{ if $Post.Sticky }} checked{{ end }}>
|
|
<label class="check-form-label" for="sticky">
|
|
Make this post sticky (always on top)
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-check">
|
|
<input type="checkbox" class="form-input-check"
|
|
name="enable-comments" id="enable-comments"
|
|
value="true"
|
|
{{ if $Post.EnableComments }} checked{{ end }}>
|
|
<label class="check-form-label" for="enable-comments">
|
|
Enable comments on this post
|
|
</label>
|
|
</div>
|
|
|
|
{{ if not .V.isNew }}
|
|
<div class="form-check">
|
|
<input type="checkbox" class="form-input-check"
|
|
name="no-update" id="no-update"
|
|
value="true"
|
|
{{ if eq (FormValue "no-update") "true" }} checked{{ end }}>
|
|
<label class="check-form-label" for="no-update">
|
|
<strong>Editing:</strong> do not update the "modified time" of this post.
|
|
</label>
|
|
</div>
|
|
{{ end }}
|
|
|
|
<div class="form-group">
|
|
<button type="submit" class="btn btn-success"
|
|
name="submit" value="preview">
|
|
Preview
|
|
</button>
|
|
|
|
<button type="submit" class="btn btn-primary"
|
|
name="submit" value="post">
|
|
Publish
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{ end }}
|