56 lines
2.8 KiB
Plaintext
56 lines
2.8 KiB
Plaintext
component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
|
.post.mountable(id=strings.ToLower(post.Type()) + "-" + fmt.Sprint(post.ID()), data-highlight=post.Creator().ID == highlightAuthorID, data-pro=post.Creator().IsPro(), data-api="/api/" + strings.ToLower(post.Type()) + "/" + post.ID())
|
|
.post-author
|
|
Avatar(post.Creator())
|
|
|
|
//- if post.recipient && post.recipient.ID !== post.author.ID
|
|
//- a.user.post-recipient(href="/+" + post.recipient.nick, title=post.recipient.nick)
|
|
//- img.user-image(src=post.recipient.avatar ? (post.recipient.avatar + "?s=100&r=x&d=mm") : "/images/elements/no-gravatar.svg", alt=post.recipient.nick)
|
|
.post-content
|
|
div(id="render-" + post.ID())!= post.HTML()
|
|
|
|
if user != nil && user.ID == post.Creator().ID
|
|
.post-edit-interface
|
|
if post.Type() == "Thread"
|
|
input.post-title-input.hidden(id="title-" + post.ID(), value=post.Title(), type="text", placeholder="Thread title")
|
|
textarea.post-text-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-date.utc-date.no-tip(data-date=post.Created())
|
|
|
|
.post-toolbar(id="toolbar-" + post.ID())
|
|
.spacer
|
|
.post-likes.tip(id="likes-" + post.ID(), aria-label=stringutils.Plural(len(post.Likes()), "like"))= "+" + strconv.Itoa(len(post.Likes()))
|
|
|
|
if user != nil
|
|
if user.ID != post.Creator().ID
|
|
if post.LikedBy(user.ID)
|
|
a.post-tool.post-unlike.tip.action(id="unlike-" + post.ID(), aria-label="Unlike", data-action="unlike", data-trigger="click")
|
|
Icon("thumbs-down")
|
|
else
|
|
a.post-tool.post-like.tip.action(id="like-" + post.ID(), aria-label="Like", data-action="like", data-trigger="click")
|
|
Icon("thumbs-up")
|
|
|
|
if user.ID == post.Creator().ID
|
|
a.post-tool.post-edit.tip.action(data-action="editPost", data-trigger="click", data-id=post.ID(), aria-label="Edit")
|
|
Icon("pencil")
|
|
|
|
if post.Type() != "Thread"
|
|
if user != nil && (user.Role == "admin" || user.Role == "editor")
|
|
a.post-tool.post-delete.tip.action(data-action="deletePost", data-trigger="click", data-id=post.ID(), aria-label="Delete")
|
|
Icon("trash")
|
|
|
|
a.post-tool.post-permalink.tip(href=post.Link(), aria-label="Link")
|
|
Icon("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")
|
|
//- i.fa.fa-trash.fa-fw
|