Have got soft and hard deleting
This commit is contained in:
parent
aef3bb6a1e
commit
3ea5823ca0
27 changed files with 588 additions and 55 deletions
8
views/_common/toast.html
Normal file
8
views/_common/toast.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<div class="toast position-fixed bottom-0 end-0" role="alert" aria-live="assertive" aria-atomic="true"
|
||||
data-controller="toast" data-action="weiroToast@window->toast#showToast">
|
||||
<div class="toast-header">
|
||||
<strong class="me-auto" data-toast-target="title">Title</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="toast-body" data-toast-target="body">Body</div>
|
||||
</div>
|
||||
|
|
@ -5,10 +5,13 @@
|
|||
<title>Title</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/static/assets/main.css">
|
||||
<script src="/static/assets/main.js" type="module"></script>
|
||||
</head>
|
||||
<body class="min-vh-100 d-flex flex-column">
|
||||
{{ template "_common/nav" . }}
|
||||
|
||||
{{ embed }}
|
||||
|
||||
{{ template "_common/toast" . }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,17 +1,47 @@
|
|||
{{ $showingTrash := eq .req.Filter "deleted" }}
|
||||
<main class="container">
|
||||
<div class="my-4">
|
||||
<div class="my-4 d-flex justify-content-between align-items-baseline">
|
||||
<a href="/sites/{{ .site.ID }}/posts/new" class="btn btn-success">New Post</a>
|
||||
|
||||
<div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
{{ if $showingTrash }}
|
||||
<a href="/sites/{{ .site.ID }}/posts" type="button" class="btn btn-secondary" title="Trash">🗑️</a>
|
||||
{{ else }}
|
||||
<a href="/sites/{{ .site.ID }}/posts?filter=deleted" type="button" class="btn btn-outline-secondary" title="Trash">🗑️</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ range $i, $p := .posts }}
|
||||
{{ if gt $i 0 }}<hr>{{ end }}
|
||||
<div class="my-4">
|
||||
{{ if $p.Title }}<h4 class="mb-3">{{ $p.Title }}</h4>{{ end }}
|
||||
{{ $p.Body | markdown }}
|
||||
<div class="mb-3">
|
||||
<a href="/sites/{{ $.site.ID }}/posts/{{ $p.ID }}/edit"
|
||||
class="link-secondary link-offset-2 link-underline link-underline-opacity-0 link-underline-opacity-75-hover">Edit</a>
|
||||
<div data-controller="postlist"
|
||||
data-postlist-site-id-value="{{ $p.SiteID }}"
|
||||
data-postlist-post-id-value="{{ $p.ID }}"
|
||||
data-postlist-nano-summary-value="{{ $p.NanoSummary }}">
|
||||
<div class="my-4">
|
||||
{{ 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 }}/edit"
|
||||
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">Delete</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if lt $i (sub (len $.posts) 1) }}<hr>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</main>
|
||||
Loading…
Add table
Add a link
Reference in a new issue