Add post modify view
This allows moderators to modify posts (add sticky, etc). Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -4,6 +4,18 @@ if (typeof window.banWindowName === "undefined") {
|
||||
window.banWindowName = "ban-window";
|
||||
}
|
||||
|
||||
if (typeof window.menuItemFactories !== "undefined") {
|
||||
window.menuItemFactories.push(
|
||||
(postElement) => $("<a>")
|
||||
.text("Ban")
|
||||
.attr("href", "#")
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
openBanWindow($(postElement).attr("data-ban-url"));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function getBanWindow() {
|
||||
return window.top.jsFrame.getWindowByName(banWindowName);
|
||||
}
|
||||
@@ -20,4 +32,4 @@ function openBanWindow(banUrl) {
|
||||
url: banUrl,
|
||||
});
|
||||
banWindow.show();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
if (typeof window.menuItemFactories !== "undefined") {
|
||||
window.menuItemFactories.push(
|
||||
(postElement) => $("<a>")
|
||||
.text("Ban")
|
||||
.attr("href", "#")
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
openBanWindow($(postElement).attr("data-ban-url"));
|
||||
})
|
||||
)
|
||||
}
|
||||
36
board/static/board/modify.js
Normal file
36
board/static/board/modify.js
Normal file
@@ -0,0 +1,36 @@
|
||||
if (typeof window.menuItemFactories !== "undefined") {
|
||||
window.menuItemFactories.push(
|
||||
(postElement) => $("<a>")
|
||||
.text("Modify post")
|
||||
.attr("href", "#")
|
||||
.on("click", (e) => {
|
||||
e.preventDefault();
|
||||
openModifyWindow($(postElement).attr("data-modify-url"));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// HACK: this should be a const, but it will cause an error if included twice in
|
||||
// the same page (like an iframe).
|
||||
if (typeof window.modifyWindowName === "undefined") {
|
||||
window.modifyWindowName = "modify-window";
|
||||
}
|
||||
|
||||
function getModifyWindow() {
|
||||
return window.top.jsFrame.getWindowByName(modifyWindowName);
|
||||
}
|
||||
|
||||
function openModifyWindow(modifyUrl) {
|
||||
if (window.top.jsFrame.containsWindowName(modifyWindowName)) {
|
||||
getModifyWindow().closeFrame();
|
||||
}
|
||||
|
||||
let modifyWindow = window.top.jsFrame.create({
|
||||
title: "Modifying post",
|
||||
name: modifyWindowName,
|
||||
width: 475,
|
||||
height: 475,
|
||||
url: modifyUrl,
|
||||
});
|
||||
modifyWindow.show();
|
||||
}
|
||||
@@ -85,6 +85,10 @@ th {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.post_sticky {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.post_id {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user