feat: add category selection to post edit form and badges to post list
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ffa86b12e9
commit
4c2ce7272d
6 changed files with 112 additions and 30 deletions
|
|
@ -4,20 +4,41 @@
|
|||
data-controller="postedit"
|
||||
data-action="keydown.meta+s->postedit#save keydown.meta+enter->postedit#publish"
|
||||
data-postedit-save-action-value="{{ if $isPublished }}Update{{ else }}Save Draft{{ end }}">
|
||||
<input type="hidden" name="guid" value="{{ .post.GUID }}">
|
||||
<div class="mb-2">
|
||||
<input type="text" name="title" class="form-control" placeholder="Title" value="{{ .post.Title }}">
|
||||
</div>
|
||||
<div>
|
||||
<textarea data-postedit-target="bodyTextEdit" name="body" class="form-control" rows="3">{{.post.Body}}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
{{ if $isPublished }}
|
||||
<input type="submit" name="action" class="btn btn-primary mt-2" value="Update">
|
||||
{{ else }}
|
||||
<input type="submit" name="action" class="btn btn-primary mt-2" value="Publish">
|
||||
<input type="submit" name="action" class="btn btn-secondary mt-2" value="Save Draft">
|
||||
{{ end }}
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<input type="hidden" name="guid" value="{{ .post.GUID }}">
|
||||
<div class="mb-2">
|
||||
<input type="text" name="title" class="form-control" placeholder="Title" value="{{ .post.Title }}">
|
||||
</div>
|
||||
<div>
|
||||
<textarea data-postedit-target="bodyTextEdit" name="body" class="form-control" rows="3">{{.post.Body}}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
{{ if $isPublished }}
|
||||
<input type="submit" name="action" class="btn btn-primary mt-2" value="Update">
|
||||
{{ else }}
|
||||
<input type="submit" name="action" class="btn btn-primary mt-2" value="Publish">
|
||||
<input type="submit" name="action" class="btn btn-secondary mt-2" value="Save Draft">
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card">
|
||||
<div class="card-header">Categories</div>
|
||||
<div class="card-body">
|
||||
{{ range .categories }}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="category_ids"
|
||||
value="{{ .ID }}" id="cat-{{ .ID }}"
|
||||
{{ if index $.selectedCategories .ID }}checked{{ end }}>
|
||||
<label class="form-check-label" for="cat-{{ .ID }}">{{ .Name }}</label>
|
||||
</div>
|
||||
{{ else }}
|
||||
<span class="text-muted">No categories yet.</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</main>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue