From afbbb987ca457df3e70815a09ba6d08e0537b33c Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 23 Jul 2018 05:25:00 +0000 Subject: [PATCH] Fix admin panel guild cards and allow sorting by guildid --- webapp/titanembeds/blueprints/admin/admin.py | 12 ++++++- .../templates/admin_guilds.html.j2 | 33 +++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/webapp/titanembeds/blueprints/admin/admin.py b/webapp/titanembeds/blueprints/admin/admin.py index 81009a8..6aa9180 100644 --- a/webapp/titanembeds/blueprints/admin/admin.py +++ b/webapp/titanembeds/blueprints/admin/admin.py @@ -256,7 +256,17 @@ def update_administrate_guild(guild_id): @admin.route("/guilds") @is_admin def guilds(): - guilds = db.session.query(Guilds).all() + guilds = [] + dbguilds = db.session.query(Guilds).all() + for guild in dbguilds: + rguild = redisqueue.get_guild(guild.guild_id) + if not rguild: + continue + guilds.append({ + "guild_id": guild.guild_id, + "name": rguild["name"], + "icon": rguild["icon"] + }) return render_template("admin_guilds.html.j2", servers=guilds, icon_generate=generate_guild_icon_url) @admin.route("/tokens", methods=["GET"]) diff --git a/webapp/titanembeds/templates/admin_guilds.html.j2 b/webapp/titanembeds/templates/admin_guilds.html.j2 index 490ea2d..127d33f 100644 --- a/webapp/titanembeds/templates/admin_guilds.html.j2 +++ b/webapp/titanembeds/templates/admin_guilds.html.j2 @@ -4,9 +4,20 @@ {% block content %}

Manage Guilds (Admin)

Select a server to configure Titan Embeds. (Total server count: {{ servers|length }})

+
+
+

Filter by ID

+
+
+ + +
+
+
+
{% for server in servers %} -
+
@@ -19,14 +30,30 @@

{{ server.name|e }}

-
Modify
+
+

ID: {{ server.guild_id }}

+
{% endfor %}
- {% endblock %} +{% block script %} + +{% endblock %} \ No newline at end of file