Scott 246a980a23 Added a delete action button next to the reply button on a thread
This button is accessible only to connected users and members of the staff.
As for the post deletion, this action requires validating the choice of deleting
a thread to avoid deleting a thread by mistake.

After deleting a thread the user is redirected to the forum.
2017-11-25 17:44:36 +01:00

28 lines
862 B
Plaintext

component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User)
h1.thread-title= thread.Title
#thread.thread(data-id=thread.ID)
.posts
Postable(thread.ToPostable(), user, thread.Author().ID)
each post in posts
Postable(post.ToPostable(), user, thread.Author().ID)
// Reply
if user != nil
.post.mountable
.post-author
Avatar(user)
.post-content
textarea#new-reply(placeholder="Reply...", aria-label="Reply")
.buttons
button.action(data-action="forumReply", data-trigger="click")
Icon("mail-reply")
span Reply
if user.Role == "admin" || user.Role == "editor"
button.action(data-action="deleteObject", data-trigger="click", data-return-path="/forum", data-confirm-type="thread", data-api="/api/thread/" + thread.ID)
Icon("trash")
span Delete