✨ Added a new button to delete a post
This commit is contained in:
parent
85a26a5c5b
commit
e00ab63b50
@ -43,6 +43,9 @@ component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
|||||||
Icon("pencil")
|
Icon("pencil")
|
||||||
|
|
||||||
if post.Type() != "Thread"
|
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")
|
a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink")
|
||||||
Icon("link")
|
Icon("link")
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AnimeNotifier } from "../AnimeNotifier"
|
import {AnimeNotifier} from "../AnimeNotifier"
|
||||||
|
|
||||||
// Edit post
|
// Edit post
|
||||||
export function editPost(arn: AnimeNotifier, element: HTMLElement) {
|
export function editPost(arn: AnimeNotifier, element: HTMLElement) {
|
||||||
@ -43,6 +43,20 @@ export function savePost(arn: AnimeNotifier, element: HTMLElement) {
|
|||||||
.catch(err => arn.statusMessage.showError(err))
|
.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
|
// Forum reply
|
||||||
export function forumReply(arn: AnimeNotifier) {
|
export function forumReply(arn: AnimeNotifier) {
|
||||||
let textarea = arn.app.find("new-reply") as HTMLTextAreaElement
|
let textarea = arn.app.find("new-reply") as HTMLTextAreaElement
|
||||||
|
@ -107,6 +107,9 @@ post-content-padding-y = 0.75rem
|
|||||||
.post-unlike
|
.post-unlike
|
||||||
color post-unlike-color
|
color post-unlike-color
|
||||||
|
|
||||||
|
.post-delete
|
||||||
|
color post-delete-color
|
||||||
|
|
||||||
.post-save
|
.post-save
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ nav-link-hover-slide-color = main-color
|
|||||||
// Forum
|
// Forum
|
||||||
post-like-color = green !important
|
post-like-color = green !important
|
||||||
post-unlike-color = rgb(255, 32, 12) !important
|
post-unlike-color = rgb(255, 32, 12) !important
|
||||||
|
post-delete-color = post-unlike-color !important
|
||||||
post-permalink-color = blue !important
|
post-permalink-color = blue !important
|
||||||
|
|
||||||
table-row-hover-background = hsla(0, 0%, 0%, 0.01)
|
table-row-hover-background = hsla(0, 0%, 0%, 0.01)
|
||||||
|
Loading…
Reference in New Issue
Block a user