forked from rDrama/rDrama
save failed css on failure
parent
2c332c5fa7
commit
08bbe29726
|
@ -395,7 +395,7 @@ def kick(v:User, pid):
|
||||||
def sub_settings(v:User, sub):
|
def sub_settings(v:User, sub):
|
||||||
sub = get_sub_by_name(sub)
|
sub = get_sub_by_name(sub)
|
||||||
if not v.mods(sub.name): abort(403)
|
if not v.mods(sub.name): abort(403)
|
||||||
return render_template('sub/settings.html', v=v, sidebar=sub.sidebar, sub=sub)
|
return render_template('sub/settings.html', v=v, sidebar=sub.sidebar, sub=sub, css=sub.css)
|
||||||
|
|
||||||
|
|
||||||
@app.post('/h/<sub>/sidebar')
|
@app.post('/h/<sub>/sidebar')
|
||||||
|
@ -437,11 +437,11 @@ def post_sub_css(v:User, sub):
|
||||||
|
|
||||||
if len(css) > 6000:
|
if len(css) > 6000:
|
||||||
error = "CSS is too long (max 6000 characters)"
|
error = "CSS is too long (max 6000 characters)"
|
||||||
return render_template('sub/settings.html', v=v, sidebar=sub.sidebar, sub=sub, error=error)
|
return render_template('sub/settings.html', v=v, sidebar=sub.sidebar, sub=sub, error=error, css=css)
|
||||||
|
|
||||||
valid, error = validate_css(css)
|
valid, error = validate_css(css)
|
||||||
if not valid:
|
if not valid:
|
||||||
return render_template('sub/settings.html', v=v, sidebar=sub.sidebar, sub=sub, error=error)
|
return render_template('sub/settings.html', v=v, sidebar=sub.sidebar, sub=sub, error=error, css=css)
|
||||||
|
|
||||||
sub.css = css
|
sub.css = css
|
||||||
g.db.add(sub)
|
g.db.add(sub)
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
<div class="w-lg-100">
|
<div class="w-lg-100">
|
||||||
<form id="css" action="/h/{{sub}}/css" method="post">
|
<form id="css" action="/h/{{sub}}/css" method="post">
|
||||||
<input hidden name="formkey" value="{{v|formkey}}">
|
<input hidden name="formkey" value="{{v|formkey}}">
|
||||||
<textarea autocomplete="off" maxlength="6000" class="form-control rounded" id="bio-text" placeholder="Enter css here..." rows="10" name="css" form="css">{% if sub.css %}{{sub.css}}{% endif %}</textarea>
|
<textarea autocomplete="off" maxlength="6000" class="form-control rounded" id="bio-text" placeholder="Enter css here..." rows="10" name="css" form="css">{% if css %}{{css}}{% endif %}</textarea>
|
||||||
<div class="d-flex mt-2">
|
<div class="d-flex mt-2">
|
||||||
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" data-nonce="{{g.nonce}}" data-onclick="disable(this)" value="Save">
|
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" data-nonce="{{g.nonce}}" data-onclick="disable(this)" value="Save">
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue