Add ActionSuccessView

ActionSuccessView is a a generic view that indicates that something was
successful, e.g. deleting a post or banning a user. This hopefully
reduces the amount of boilerplate code used for creating success pages
since most of them can derive from this generic view.

The report and delete success views are updated to use this directly.

The ban and modify success views are updated to derive from this class,
with special permissions required.

The post success view is updated to derive from this class, using a
different template.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-07-17 15:08:33 -07:00
parent bfd3dedb09
commit e686c3b235
9 changed files with 78 additions and 112 deletions

View File

@@ -39,5 +39,8 @@ function openBanWindow(banUrl) {
window.innerHeight / 2,
"RIGHT_CENTER"
);
$(banWindow.iframe, "iframe").on("load", () => {
banWindow.iframe.contentWindow.thisWindow = banWindow;
});
banWindow.show();
}

View File

@@ -34,6 +34,7 @@ function openModifyWindow(modifyUrl) {
$(modifyWindow.iframe, "iframe").on("load", () => {
fitWindowToContent(modifyWindow);
modifyWindow.setResizable(false);
modifyWindow.iframe.contentWindow.thisWindow = modifyWindow;
});
modifyWindow.show();
}

View File

@@ -121,6 +121,7 @@ function openReplyWindow(replyUrl) {
if (textarea) {
textarea.focus();
}
replyWindow.iframe.contentWindow.thisWindow = replyWindow;
});
replyWindow.show();
return replyWindow;
@@ -171,7 +172,11 @@ function openPostWindow(postUrl) {
});
$(postWindow.iframe, "iframe").on("load", () => {
fitWindowToContent(postWindow);
postWindow.$("#id_text").focus();
let textbox = postWindow.$("#id_text");
if (textbox) {
textbox.focus();
}
postWindow.iframe.contentWindow.thisWindow = postWindow;
});
postWindow.show();
}
@@ -201,6 +206,7 @@ function openReportWindow(reportUrl) {
});
$(reportWindow.iframe, "iframe").on("load", () => {
fitWindowToContent(reportWindow);
reportWindow.iframe.contentWindow.thisWindow = reportWindow;
});
reportWindow.show();
}
@@ -226,6 +232,7 @@ function openDeleteWindow(deleteUrl) {
$(deleteWindow.iframe, "iframe").on("load", () => {
fitWindowToContent(deleteWindow);
deleteWindow.setResizable(false);
deleteWindow.iframe.contentWindow.thisWindow = deleteWindow;
});
deleteWindow.show();
}