New user profile

This commit is contained in:
2018-11-15 20:19:40 +09:00
parent a1c11a2eae
commit d5dff615c1
29 changed files with 271 additions and 141 deletions

View File

@ -1,19 +1,15 @@
component Comments(parent arn.PostParent, user *arn.User)
.thread
.posts
if user == nil && parent.CountPosts() == 0
p.no-data.mountable No comments have been written yet.
else
each post in parent.Posts()
Postable(post, user, true, "", "")
if user != nil
if arn.IsLocked(parent)
footer.footer.mountable
p.text-center= "This " + strings.ToLower(reflect.TypeOf(parent).Elem().Name()) + " is locked."
else
NewPostArea(user, "Comment")
.buttons
if !arn.IsLocked(parent)
NewPostActions(reflect.TypeOf(parent).Elem().Name(), parent.GetID(), false)
NewPostArea(parent, user, "Comment")
if user == nil && parent.CountPosts() == 0
p.no-data.mountable No comments have been written yet.
else
each post in parent.PostsRelevantFirst(5)
Postable(post, user, true, "", "")

View File

@ -1,4 +1,4 @@
component NewPostArea(user *arn.User, placeholder string)
component NewPostArea(parent arn.PostParent, user *arn.User, placeholder string)
#new-post.post.mountable
.post-parent
.post-author
@ -6,11 +6,18 @@ component NewPostArea(user *arn.User, placeholder string)
textarea#new-post-text.post-content(placeholder=placeholder + "...", aria-label=placeholder)
component NewPostActions(parentType string, parentID string, cancelButton bool)
#new-post-actions.buttons
button#reply-button.mountable.action(data-action="createPost", data-trigger="click", data-parent-type=parentType, data-parent-id=parentID)
if !arn.IsLocked(parent)
NewPostActions(parent, false)
component NewPostActions(parent arn.PostParent, cancelButton bool)
.buttons.new-post-actions
button#reply-button.mountable.action(data-action="createPost", data-trigger="click", data-parent-type=parent.TypeName(), data-parent-id=parent.GetID())
Icon("mail-reply")
span Reply
if parent.TypeName() == "Post" || parent.TypeName() == "Thread"
span= "Reply to " + parent.Creator().Nick
else
span Submit
if cancelButton
button#reply-cancel-button.mountable.action(data-action="cancelReply", data-trigger="click")

View File

@ -1,5 +1,5 @@
component Postable(post arn.Postable, user *arn.User, includeReplies bool, headerContent string, highlightAuthorID string)
.post.mountable(id=strings.ToLower(post.Type()) + "-" + fmt.Sprint(post.GetID()), data-pro=post.Creator().IsPro(), data-api="/api/" + strings.ToLower(post.Type()) + "/" + post.GetID())
.post.mountable(id=strings.ToLower(post.TypeName()) + "-" + fmt.Sprint(post.GetID()), data-pro=post.Creator().IsPro(), data-api="/api/" + strings.ToLower(post.TypeName()) + "/" + post.GetID())
.post-parent
.post-author
Avatar(post.Creator())
@ -12,7 +12,7 @@ component Postable(post arn.Postable, user *arn.User, includeReplies bool, heade
if user != nil && user.ID == post.Creator().ID
.post-edit-interface
if post.Type() == "Thread"
if post.TypeName() == "Thread"
input.post-title-input.hidden(id="title-" + post.GetID(), value=post.TitleByUser(user), type="text", placeholder="Thread title")
textarea.post-text-input.hidden(id="source-" + post.GetID())= post.GetText()
@ -48,7 +48,7 @@ component Postable(post arn.Postable, user *arn.User, includeReplies bool, heade
a.post-tool.post-edit.tip.action(data-action="editPost", data-trigger="click", data-id=post.GetID(), aria-label="Edit")
Icon("pencil")
if post.Type() != "Thread"
if post.TypeName() != "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.GetID(), aria-label="Delete")
Icon("trash")