Change user defined css from the admin panel

This commit is contained in:
Jeremy Zhang
2018-01-07 02:41:02 +00:00
parent 0297481a5e
commit e8ecfc65d2
6 changed files with 144 additions and 9 deletions

View File

@ -27,6 +27,13 @@
<a class="waves-effect waves-light btn" href="{{ url_for('admin.manage_titan_tokens') }}">Manage</a>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>User Defined CSS</h4>
<p class="flow-text">Manage user defined css (custom css).</p>
<a class="waves-effect waves-light btn" href="{{ url_for('admin.list_custom_css_get') }}">Manage</a>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>Disabled Servers</h4>

View File

@ -0,0 +1,20 @@
{% extends 'site_layout.html.j2' %}
{% set title="Manage User CSS as Administrator" %}
{% block content %}
<h1>Manage User CSS</h1>
<p class="flow-text">Select a CSS to manage. Or, create a new user css. <a class="waves-effect waves-light btn" href="{{ url_for('admin.new_custom_css_get') }}">NEW</a></p>
<div class="row">
{% for c in css %}
<div class="col l4 m6 s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable">
<div class="row black-text">
<p class="flow-text"><strong>#{{ c.id }}</strong> {{ c.name }}</p>
<p>Owned by: {{ c.user_id }}</p>
<a class="waves-effect waves-light btn" href="{{ url_for('admin.edit_custom_css_get', css_id=c.id) }}">Manage</a>
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -5,6 +5,10 @@
{% set title="Editing " + css.name + " - User CSS" %}
{% endif %}
{% if not admin %}
{% set admin=False %}
{% endif %}
{%- set live_preview -%}
<iframe id="iframepreview" src="
{% if new %}
@ -45,6 +49,13 @@ will have CSS cosmetic privilages removed, if caught. Please don't, we check the
<input placeholder="Some Lit CSS" id="css_name" type="text" {% if not new %}value="{{ css.name }}"{% endif %}>
<label for="css_name">Name</label>
</div>
{% if admin %}
<div class="col s12">
<p class="flow-text">Set CSS Ownership</p>
<input placeholder="User ID" id="css_user_id" type="text" {% if admin and not new %}value="{{ css.user_id }}"{% endif %}>
<label for="css_user_id">User ID</label>
</div>
{% endif %}
<div class="col s12">
<p class="flow-text">Propose Predefined CSS variables here</p>
<p>
@ -99,7 +110,7 @@ will have CSS cosmetic privilages removed, if caught. Please don't, we check the
</div>
<p><strong>TIP!</strong> You can use the variables in your CSS below! Something like <code>color: var(--leftsidebar);</code> would work!</p>
</div>
{% if (new and premium_css_count >= cosmetics.css_limit) or (not new and premium_css_count >= cosmetics.css_limit and css.css is none) %}
{% if not admin and ((new and premium_css_count >= cosmetics.css_limit) or (not new and premium_css_count >= cosmetics.css_limit and css.css is none)) %}
<div class="col s12">
<hr>
<p class="flow-text">All custom CSS slots are used. Donate to get more!</p>
@ -137,6 +148,7 @@ will have CSS cosmetic privilages removed, if caught. Please don't, we check the
<script>
const newCSS = {% if new %}true{% else %}false{% endif %};
const CSS_ID = {%if new %}null{% else %}{{ css.id }}{% endif %};
const ADMIN = {{ admin|tojson|safe }};
</script>
<script type="text/javascript" src="{{ url_for('static', filename='js/usercss.js') }}"></script>
{% endblock %}