Delete post #43
This commit is contained in:
Eduard Urbach 2017-11-25 14:18:28 +01:00 committed by GitHub
commit df43cab6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View File

@ -43,6 +43,9 @@ component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
Icon("pencil")
if post.Type() != "Thread"
if user.Role == "admin" || user.Role == "editor"
a.post-tool.post-delete.action(data-action="deletePost", data-trigger="click", data-id=post.ID(), title="Delete")
Icon("trash")
a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink")
Icon("link")

View File

@ -43,6 +43,20 @@ export function savePost(arn: AnimeNotifier, element: HTMLElement) {
.catch(err => arn.statusMessage.showError(err))
}
// Create thread
export function deletePost(arn: AnimeNotifier, element: HTMLElement) {
if (!confirm(`Are you sure you want to delete this Post?`)) {
return
}
let endpoint = arn.findAPIEndpoint(element)
arn.post(endpoint + "/delete", "")
.then(() => arn.reloadContent())
.catch(err => arn.statusMessage.showError(err))
}
// Forum reply
export function forumReply(arn: AnimeNotifier) {
let textarea = arn.app.find("new-reply") as HTMLTextAreaElement

View File

@ -13,7 +13,7 @@ post-content-padding-y = 0.75rem
> 330px
.thread-link
horizontal
.post-author
margin-bottom 0
@ -37,11 +37,11 @@ post-content-padding-y = 0.75rem
h3
font-size 1.1rem
:hover
.post-toolbar
opacity 1
.post-date
opacity 0.25
@ -107,6 +107,9 @@ post-content-padding-y = 0.75rem
.post-unlike
color post-unlike-color
.post-delete
color post-delete-color
.post-save
//
@ -246,7 +249,7 @@ post-content-padding-y = 0.75rem
// .thread-title
// width auto
// .posts
// width 100%
// max-width 830px

View File

@ -60,6 +60,7 @@ nav-link-hover-slide-color = main-color
// Forum
post-like-color = green !important
post-unlike-color = rgb(255, 32, 12) !important
post-delete-color = post-unlike-color !important
post-permalink-color = blue !important
table-row-hover-background = hsla(0, 0%, 0%, 0.01)