Added forum post editing
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
component Postable(post arn.Postable, highlightAuthorID string)
|
||||
.post.mountable(id=post.ID(), data-highlight=post.Author().ID == highlightAuthorID)
|
||||
component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
||||
.post.mountable(id=strings.ToLower(post.Type()) + "-" + toString(post.ID()), data-highlight=post.Author().ID == highlightAuthorID, data-api="/api/" + strings.ToLower(post.Type()) + "/" + post.ID())
|
||||
.post-author
|
||||
Avatar(post.Author())
|
||||
|
||||
@ -9,34 +9,38 @@ component Postable(post arn.Postable, highlightAuthorID string)
|
||||
.post-content
|
||||
div(id="render-" + post.ID())!= post.HTML()
|
||||
|
||||
//- if user && user.ID === post.authorId
|
||||
//- textarea.post-input.hidden(id="source-" + post.ID)= post.text
|
||||
//- a.post-save.hidden(id="save-" + post.ID, onclick=`$.saveEdit("${type.toLowerCase()}", "${post.ID}")`)
|
||||
//- i.fa.fa-save
|
||||
//- span Save
|
||||
if user != nil && user.ID == post.Author().ID
|
||||
textarea.post-input.hidden(id="source-" + post.ID())= post.Text()
|
||||
.buttons.hidden(id="edit-toolbar-" + post.ID())
|
||||
a.button.post-save.action(data-action="savePost", data-trigger="click", data-id=post.ID())
|
||||
Icon("save")
|
||||
span Save
|
||||
|
||||
a.button.post-cancel-edit.action(data-action="editPost", data-trigger="click", data-id=post.ID())
|
||||
Icon("close")
|
||||
span Cancel
|
||||
|
||||
.post-toolbar(id="toolbar-" + post.ID())
|
||||
.spacer
|
||||
.post-likes(id="likes-" + post.ID(), title="Likes")= len(post.Likes())
|
||||
|
||||
//- if user != nil
|
||||
//- if user.ID !== post.authorId
|
||||
//- - var liked = post.likes && post.likes.indexOf(user.ID) !== -1
|
||||
if user != nil
|
||||
//- if user.ID !== post.authorId
|
||||
//- - var liked = post.likes && post.likes.indexOf(user.ID) !== -1
|
||||
|
||||
//- a.post-tool.post-like(id="like-" + post.ID, onclick=`$.like("${type.toLowerCase()}", "${post.ID}")`, title="Like", class=liked ? "hidden" : ")
|
||||
//- i.fa.fa-thumbs-up.fa-fw
|
||||
//- a.post-tool.post-like(id="like-" + post.ID, onclick=`$.like("${type.toLowerCase()}", "${post.ID}")`, title="Like", class=liked ? "hidden" : ")
|
||||
//- i.fa.fa-thumbs-up.fa-fw
|
||||
|
||||
//- a.post-tool.post-unlike(id="unlike-" + post.ID, onclick=`$.unlike("${type.toLowerCase()}", "${post.ID}")`, title="Unlike", class=!liked ? "hidden" : ")
|
||||
//- i.fa.fa-thumbs-down.fa-fw
|
||||
//- a.post-tool.post-unlike(id="unlike-" + post.ID, onclick=`$.unlike("${type.toLowerCase()}", "${post.ID}")`, title="Unlike", class=!liked ? "hidden" : ")
|
||||
//- i.fa.fa-thumbs-down.fa-fw
|
||||
|
||||
//- if type === "Posts" || type === "Threads"
|
||||
//- if user.ID === post.authorId
|
||||
//- a.post-tool.post-edit(onclick=`$.edit("${post.ID}")`, title="Edit")
|
||||
//- i.fa.fa-pencil.fa-fw
|
||||
if user.ID == post.Author().ID
|
||||
a.post-tool.post-edit.action(data-action="editPost", data-trigger="click", data-id=post.ID(), title="Edit")
|
||||
RawIcon("pencil")
|
||||
|
||||
if post.Type() != "Thread"
|
||||
a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink")
|
||||
Icon("link")
|
||||
RawIcon("link")
|
||||
|
||||
//- if type === "Messages" && user && (user.ID === post.authorId || user.ID === post.recipientId)
|
||||
//- a.post-tool.post-delete(onclick=`if(confirm("Do you really want to delete this ${typeSingular.toLowerCase()} from ${post.author.nick}?")) $.delete${typeSingular}("${post.ID}")`, title="Delete")
|
||||
|
Reference in New Issue
Block a user