diff options
Diffstat (limited to 'src/http/tpl/draft-posts-manage.html')
-rw-r--r-- | src/http/tpl/draft-posts-manage.html | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/http/tpl/draft-posts-manage.html b/src/http/tpl/draft-posts-manage.html index 5454f24..b1b4362 100644 --- a/src/http/tpl/draft-posts-manage.html +++ b/src/http/tpl/draft-posts-manage.html @@ -1,5 +1,15 @@ {{ define "body" }} + {{ $page := .GetQueryIntValue "p" 0 -}} + {{ $getPostsRes := .GetDraftPosts $page 20 -}} + + <script> + function confirmDelete(event) { + if (!confirm("Are you sure you want to delete this draft?")) + event.preventDefault(); + } + </script> + <p> <a href="{{ BlogURL "admin" }}">Back to Admin</a> </p> @@ -10,15 +20,15 @@ <a href="{{ BlogURL "drafts" }}?method=edit">New Draft</a> </p> - {{ if ge .Payload.PrevPage 0 }} + {{ if gt $page 0 }} <p> - <a href="?method=manage&p={{ .Payload.PrevPage}}">< < Previous Page</a> + <a href="?method=manage&p={{ .Add $page -1 }}">< < Previous Page</a> </p> {{ end }} <table> - {{ range .Payload.Posts }} + {{ range $getPostsRes.Posts }} <tr> <td>{{ .Title }}</td> <td> @@ -31,7 +41,11 @@ action="{{ DraftURL .ID }}?method=delete" method="POST" > - <input type="submit" value="Delete" /> + <input + type="submit" + value="Delete" + onclick="confirmDelete(event)" + /> </form> </td> </tr> @@ -39,9 +53,9 @@ </table> - {{ if ge .Payload.NextPage 0 }} + {{ if $getPostsRes.HasMore }} <p> - <a href="?method=manage&p={{ .Payload.NextPage}}">Next Page > ></a> + <a href="?method=manage&p={{ .Add $page 1 }}">Next Page > ></a> </p> {{ end }} |