forked from rDrama/rDrama
persist ppl's edit text on failure
parent
dce3dde6d7
commit
a139197371
|
@ -327,6 +327,14 @@ function sendFormXHRSwitch(form) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendFormXHRReload(form) {
|
||||||
|
sendFormXHR(form,
|
||||||
|
() => {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
let sortAscending = {};
|
let sortAscending = {};
|
||||||
|
|
||||||
function sort_table(t) {
|
function sort_table(t) {
|
||||||
|
|
|
@ -1089,5 +1089,4 @@ def edit_post(pid, v):
|
||||||
)
|
)
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
|
return {"message": "Post edited successfully!"}
|
||||||
return redirect(p.permalink)
|
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
|
|
||||||
{% if v and v.can_edit(p) and not v.is_suspended %}
|
{% if v and v.can_edit(p) and not v.is_suspended %}
|
||||||
<div id="edit-post-body-{{p.id}}" class="d-none comment-write collapsed child">
|
<div id="edit-post-body-{{p.id}}" class="d-none comment-write collapsed child">
|
||||||
<form id="post-edit-form-{{p.id}}" action="/edit_post/{{p.id}}" method="post" enctype="multipart/form-data">
|
<form id="post-edit-form-{{p.id}}" action="/edit_post/{{p.id}}" method="post" enctype="multipart/form-data" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRReload(this)">
|
||||||
<input hidden name="formkey" value="{{v|formkey}}">
|
<input hidden name="formkey" value="{{v|formkey}}">
|
||||||
<input hidden name="current_page" value="{{request.path}}">
|
<input hidden name="current_page" value="{{request.path}}">
|
||||||
<textarea id="post-edit-title" autocomplete="off" max-length="500" name="title" class="comment-box form-control rounded" required placeholder="title">{{p.title}}</textarea>
|
<textarea id="post-edit-title" autocomplete="off" max-length="500" name="title" class="comment-box form-control rounded" required placeholder="title">{{p.title}}</textarea>
|
||||||
|
|
Loading…
Reference in New Issue