Added keyboard shortcuts for post editing.

This commit is contained in:
Leon Mika 2026-02-24 22:21:26 +11:00
parent 4f7058bf36
commit 44d35c6ccb
13 changed files with 215 additions and 28 deletions

View file

@ -23,25 +23,40 @@
{{ if $p.Title }}<h4 class="mb-3">{{ $p.Title }}</h4>{{ end }}
{{ $p.Body | markdown }}
{{ if $showingTrash }}
<div class="mb-3">
<a href="#" data-action="click->postlist#restorePost"
class="link-secondary link-offset-2 link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Restore</a>
-
<a href="#" data-action="click->postlist#deletePost" data-postlist-hard-delete-param="true"
class="link-secondary link-offset-2 link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Delete</a>
</div>
{{ else }}
<div class="mb-3">
<a href="/sites/{{ $.site.ID }}/posts/{{ $p.ID }}/"
class="link-secondary link-offset-2 link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Edit</a>
-
<a href="#" data-action="click->postlist#deletePost"
class="link-secondary link-offset-2 link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Trash</a>
</div>
{{ end }}
<div class="mb-3 d-flex align-items-center">
{{ if eq .State 1 }}
<span class="text-muted">{{ $.user.FormatTime .UpdatedAt }}</span> <span class="ms-3 badge text-primary-emphasis bg-primary-subtle border border-primary-subtle">Draft</span>
{{ else }}
<span class="text-muted">{{ $.user.FormatTime .PublishedAt }}</span>
{{ end }}
</div>
<div class="mb-3 d-flex align-items-center">
{{ if $showingTrash }}
<span>
<a href="#" data-action="click->postlist#restorePost" class="btn btn-outline-secondary btn-sm">Restore</a>
<a href="#" data-action="click->postlist#deletePost" data-postlist-hard-delete-param="true"
class="btn btn-outline-danger btn-sm">Delete</a>
</span>
{{ else }}
<span>
<a href="/sites/{{ $.site.ID }}/posts/{{ $p.ID }}/"
class="btn btn-outline-secondary btn-sm">Edit</a>
<a href="#" data-action="click->postlist#deletePost"
class="btn btn-outline-secondary btn-sm">Trash</a>
</span>
{{ end }}
</div>
</div>
{{ if lt $i (sub (len $.posts) 1) }}<hr>{{ end }}
</div>
{{ else }}
<div class="h4 m-3 text-center">
{{ if $showingTrash }}
<div class="position-absolute top-50 start-50 translate-middle">🗑️<br>Trash is empty.</div>
{{ else }}
<div class="position-absolute top-50 start-50 translate-middle">🌱<br>No posts yet. Better get writing!</div>
{{ end }}
</div>
{{ end }}
</main>