Hide cancel button in the thread view

This commit is contained in:
Eduard Urbach 2018-11-05 21:04:47 +09:00
parent 960b1e4b92
commit 1f8ad4fbe1
4 changed files with 8 additions and 7 deletions

View File

@ -6,12 +6,13 @@ component NewPostArea(user *arn.User, placeholder string)
textarea#new-post-text.post-content(placeholder=placeholder + "...", aria-label=placeholder)
component NewPostActions(parentType string, parentID string)
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)
Icon("mail-reply")
span Reply
if cancelButton
button#reply-cancel-button.mountable.action(data-action="cancelReply", data-trigger="click")
Icon("close")
span Cancel

View File

@ -19,5 +19,5 @@ func ReplyUI(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Post not found", err)
}
return ctx.HTML(components.NewPostArea(user, "Reply") + components.NewPostActions(post.Type(), post.ID))
return ctx.HTML(components.NewPostArea(user, "Reply") + components.NewPostActions(post.Type(), post.ID, true))
}

View File

@ -19,5 +19,5 @@ func ReplyUI(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Thread not found", err)
}
return ctx.HTML(components.NewPostArea(user, "Reply") + components.NewPostActions(thread.Type(), thread.ID))
return ctx.HTML(components.NewPostArea(user, "Reply") + components.NewPostActions(thread.Type(), thread.ID, true))
}

View File

@ -15,7 +15,7 @@ component Thread(thread *arn.Thread, user *arn.User)
.buttons
if !thread.Locked
NewPostActions("Thread", thread.ID)
NewPostActions("Thread", thread.ID, false)
if user.Role == "admin" || user.Role == "editor"
if thread.Locked