mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Fix admin panel guild cards and allow sorting by guildid
This commit is contained in:
parent
0203f24ce7
commit
afbbb987ca
@ -256,7 +256,17 @@ def update_administrate_guild(guild_id):
|
|||||||
@admin.route("/guilds")
|
@admin.route("/guilds")
|
||||||
@is_admin
|
@is_admin
|
||||||
def guilds():
|
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)
|
return render_template("admin_guilds.html.j2", servers=guilds, icon_generate=generate_guild_icon_url)
|
||||||
|
|
||||||
@admin.route("/tokens", methods=["GET"])
|
@admin.route("/tokens", methods=["GET"])
|
||||||
|
@ -4,9 +4,20 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Manage Guilds (Admin)</h1>
|
<h1>Manage Guilds (Admin)</h1>
|
||||||
<p class="flow-text">Select a server to configure Titan Embeds. <strong>(Total server count: {{ servers|length }})</strong></p>
|
<p class="flow-text">Select a server to configure Titan Embeds. <strong>(Total server count: {{ servers|length }})</strong></p>
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card-panel indigo lighten-5 z-depth-3 hoverable">
|
||||||
|
<p class="black-text flow-text">Filter by ID</p>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<input id="guild_id" type="text" class="validate black-text">
|
||||||
|
<label for="guild_id">Server/Embed ID</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for server in servers %}
|
{% for server in servers %}
|
||||||
<div class="col l4 m6 s12">
|
<div class="col l4 m6 s12 guild-card" data-guildid="{{ server.guild_id }}">
|
||||||
<div class="card-panel indigo lighten-5 z-depth-3 hoverable">
|
<div class="card-panel indigo lighten-5 z-depth-3 hoverable">
|
||||||
<div class="row valign-wrapper">
|
<div class="row valign-wrapper">
|
||||||
<div class="col s3">
|
<div class="col s3">
|
||||||
@ -19,14 +30,30 @@
|
|||||||
<div class="col s7">
|
<div class="col s7">
|
||||||
<span class="black-text">
|
<span class="black-text">
|
||||||
<p class="flow-text truncate">{{ server.name|e }}</p>
|
<p class="flow-text truncate">{{ server.name|e }}</p>
|
||||||
<br>
|
|
||||||
<a class="waves-effect waves-light btn" href="{{url_for('admin.administrate_guild', guild_id=server['guild_id'])}}">Modify</a>
|
<a class="waves-effect waves-light btn" href="{{url_for('admin.administrate_guild', guild_id=server['guild_id'])}}">Modify</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="s12 black-text">
|
||||||
|
<p>ID: <code>{{ server.guild_id }}</code></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block script %}
|
||||||
|
<script>
|
||||||
|
$("#guild_id").keyup(function() {
|
||||||
|
var guildid = this.value.trim();
|
||||||
|
var cards = document.getElementsByClassName("guild-card");
|
||||||
|
for (var i = 0; i < cards.length; i++) {
|
||||||
|
if (cards[i].dataset.guildid.indexOf(guildid) > -1) {
|
||||||
|
cards[i].style.display = "";
|
||||||
|
} else {
|
||||||
|
cards[i].style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user