mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-23 21:47:04 +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")
|
||||
@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"])
|
||||
|
@ -4,9 +4,20 @@
|
||||
{% block content %}
|
||||
<h1>Manage Guilds (Admin)</h1>
|
||||
<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">
|
||||
{% 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="row valign-wrapper">
|
||||
<div class="col s3">
|
||||
@ -19,14 +30,30 @@
|
||||
<div class="col s7">
|
||||
<span class="black-text">
|
||||
<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>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="s12 black-text">
|
||||
<p>ID: <code>{{ server.guild_id }}</code></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</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 %}
|
Loading…
Reference in New Issue
Block a user