Fixed guild_id showing only first number

This commit is contained in:
Jeremy Zhang 2017-05-08 19:13:53 +00:00
parent 531aa948b9
commit b475cc4e64
4 changed files with 21 additions and 10 deletions

View File

@ -24,9 +24,15 @@ def get_logingreeting():
def guild_embed(guild_id): def guild_embed(guild_id):
if check_guild_existance(guild_id): if check_guild_existance(guild_id):
guild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first() guild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
guild_dict = {
"id": guild.guild_id,
"name": guild.name,
"unauth_users": guild.unauth_users,
"icon": guild.icon
}
return render_template("embed.html.j2", return render_template("embed.html.j2",
login_greeting=get_logingreeting(), login_greeting=get_logingreeting(),
guild_id=guild_id, guild=guild, guild_id=guild_id, guild=guild_dict,
generate_guild_icon=generate_guild_icon_url, generate_guild_icon=generate_guild_icon_url,
unauth_enabled=guild_query_unauth_users_bool(guild_id), unauth_enabled=guild_query_unauth_users_bool(guild_id),
client_id=config['client-id'] client_id=config['client-id']

View File

@ -88,8 +88,13 @@ def administrate_guild(guild_id):
all_members = db.session.query(UnauthenticatedUsers).filter(UnauthenticatedUsers.guild_id == guild_id).order_by(UnauthenticatedUsers.last_timestamp).all() all_members = db.session.query(UnauthenticatedUsers).filter(UnauthenticatedUsers.guild_id == guild_id).order_by(UnauthenticatedUsers.last_timestamp).all()
all_bans = db.session.query(UnauthenticatedBans).filter(UnauthenticatedBans.guild_id == guild_id).all() all_bans = db.session.query(UnauthenticatedBans).filter(UnauthenticatedBans.guild_id == guild_id).all()
users = prepare_guild_members_list(all_members, all_bans) users = prepare_guild_members_list(all_members, all_bans)
dbguild_dict = {"unauth_users": db_guild.unauth_users} dbguild_dict = {
return render_template("administrate_guild.html.j2", guild=db_guild, dbguild=dbguild_dict, members=users, permissions=permissions) "id": db_guild.guild_id,
"name": db_guild.name,
"unauth_users": db_guild.unauth_users,
"icon": db_guild.icon
}
return render_template("administrate_guild.html.j2", guild=dbguild_dict, members=users, permissions=permissions)
@user.route("/administrate_guild/<guild_id>", methods=["POST"]) @user.route("/administrate_guild/<guild_id>", methods=["POST"])
@discord_users_only() @discord_users_only()

View File

@ -42,7 +42,7 @@
<div class="switch"> <div class="switch">
<label> <label>
Disable Disable
<input type="checkbox" id="unauth_users" name="unauth_users" {% if dbguild['unauth_users'] %}checked{% endif %} > <input type="checkbox" id="unauth_users" name="unauth_users" {% if guild['unauth_users'] %}checked{% endif %} >
<span class="lever"></span> <span class="lever"></span>
Enable Enable
</label> </label>

View File

@ -10,7 +10,7 @@
<!--Let browser know website is optimized for mobile--> <!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{{ guild.name }} - Embed - Titan Embeds for Discord</title> <title>{{ guild['name'] }} - Embed - Titan Embeds for Discord</title>
{% include 'google_analytics.html.j2' %} {% include 'google_analytics.html.j2' %}
</head> </head>
<body> <body>
@ -32,16 +32,16 @@
<ul id="guild-nav" class="side-nav"> <ul id="guild-nav" class="side-nav">
<li> <li>
<div class="userView"> <div class="userView">
{% if guild.icon %} {% if guild['icon'] %}
<img class="circle" src="{{ generate_guild_icon( guild.id, guild.icon ) }}"> <img class="circle" src="{{ generate_guild_icon( guild['id'], guild['icon'] ) }}">
{% endif %} {% endif %}
<span class="name">{{ guild.name }}</span> <span class="name">{{ guild['name'] }}</span>
</div> </div>
</li> </li>
<li><a class="subheader">Actions</a></li> <li><a class="subheader">Actions</a></li>
<li><a href="{{ url_for("user.administrate_guild", guild_id=guild.id) }}" class="waves-effect" target="_blank" id="administrate_link" style="display: none;">Manage Guild Embed</a></li> <li><a href="{{ url_for("user.administrate_guild", guild_id=guild['id']) }}" class="waves-effect" target="_blank" id="administrate_link" style="display: none;">Manage Guild Embed</a></li>
<li><a href="https://discordapp.com/channels/{{ guild.id }}/" class="waves-effect" target="_blank">Open Server on Discordapp</a></li> <li><a href="https://discordapp.com/channels/{{ guild['id'] }}/" class="waves-effect" target="_blank">Open Server on Discordapp</a></li>
<li><div class="divider"></div></li> <li><div class="divider"></div></li>