forked from MarseyWorld/MarseyWorld
remove editing sidebar from PCM
parent
3a97dac234
commit
bc927ef238
|
@ -146,41 +146,6 @@ def merge_all(v, id):
|
|||
return redirect(user.url)
|
||||
|
||||
|
||||
|
||||
if SITE_NAME == 'PCM':
|
||||
@app.get('/admin/sidebar')
|
||||
@admin_level_required(3)
|
||||
def get_sidebar(v):
|
||||
|
||||
try:
|
||||
with open(f'files/templates/sidebar_{SITE_NAME}.html', 'r', encoding="utf-8") as f: sidebar = f.read()
|
||||
except:
|
||||
sidebar = None
|
||||
|
||||
return render_template('admin/sidebar.html', v=v, sidebar=sidebar)
|
||||
|
||||
|
||||
@app.post('/admin/sidebar')
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
@admin_level_required(3)
|
||||
def post_sidebar(v):
|
||||
|
||||
text = request.values.get('sidebar', '').strip()
|
||||
|
||||
with open(f'files/templates/sidebar_{SITE_NAME}.html', 'w+', encoding="utf-8") as f: f.write(text)
|
||||
|
||||
with open(f'files/templates/sidebar_{SITE_NAME}.html', 'r', encoding="utf-8") as f: sidebar = f.read()
|
||||
|
||||
ma = ModAction(
|
||||
kind="change_sidebar",
|
||||
user_id=v.id,
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
|
||||
return render_template('admin/sidebar.html', v=v, sidebar=sidebar, msg='Sidebar edited successfully!')
|
||||
|
||||
|
||||
@app.post("/@<username>/make_admin")
|
||||
@admin_level_required(3)
|
||||
def make_admin(v, username):
|
||||
|
|
|
@ -61,16 +61,10 @@
|
|||
<li><a href="/daily_chart">Daily Stat Chart</a></li>
|
||||
</ul>
|
||||
|
||||
{% if SITE_NAME in ['PCM', 'WPD'] -%}
|
||||
<h4>Configuration</h4>
|
||||
<ul>
|
||||
{% if SITE_NAME == 'PCM' -%}
|
||||
<li><a href="/admin/sidebar">Edit Sidebar</a></li>
|
||||
{%- elif SITE_NAME == 'WPD' -%}
|
||||
<li><a href="/create_hole">Create {{ HOLE_NAME | capitalize }}</a></li>
|
||||
{%- endif %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
|
||||
{% if v.admin_level > 2 %}
|
||||
<pre></pre>
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
{% extends "default.html" %}
|
||||
|
||||
{% block pagetitle %}Edit {{SITE_NAME}} sidebar{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if msg %}
|
||||
<div class="alert alert-success alert-dismissible fade show my-3" role="alert">
|
||||
<i class="fas fa-check-circle my-auto" aria-hidden="true"></i>
|
||||
<span>
|
||||
{{msg}}
|
||||
</span>
|
||||
<button class="close" data-bs-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row my-5">
|
||||
<div class="col col-md-8">
|
||||
<div class="settings">
|
||||
<div id="description">
|
||||
<h2>Edit Sidebar</h2>
|
||||
<br>
|
||||
</div>
|
||||
<div class="body d-lg-flex">
|
||||
<div class="w-lg-100">
|
||||
<form id="profile-settings" action="/admin/sidebar" method="post">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<textarea autocomplete="off" maxlength="10000" class="form-control rounded" id="bio-text" aria-label="With textarea" placeholder="Enter sidebar here..." rows="50" name="sidebar" form="profile-settings">{% if sidebar %}{{sidebar}}{% endif %}</textarea>
|
||||
|
||||
<div class="d-flex mt-2">
|
||||
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" onclick="disable(this)" value="Save">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue