1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-30 15:04:18 +00:00

Fix annoying misalign in game and profile pages

This commit is contained in:
Steffo 2018-07-25 21:10:43 +02:00
parent 51494c2ad7
commit 7f40dbb338
13 changed files with 132 additions and 69 deletions

View file

@ -8,7 +8,6 @@ import sys
import db import db
import youtube_dl import youtube_dl
import concurrent.futures import concurrent.futures
import stagismo
import platform import platform
import typing import typing
import os import os
@ -17,8 +16,8 @@ import configparser
import subprocess import subprocess
import async_timeout import async_timeout
import raven import raven
import cast
import logging import logging
import errors
logging.basicConfig() logging.basicConfig()
@ -472,6 +471,27 @@ async def cmd_dump_voice_player_error(channel: discord.Channel, author: discord.
await client.send_message(channel, f"```\n{str(voice_player.error)}\n```") await client.send_message(channel, f"```\n{str(voice_player.error)}\n```")
@command
async def cmd_register(channel: discord.Channel, author: discord.Member, params: typing.List[str]):
session = await loop.run_in_executor(executor, db.Session())
if len(params) < 1:
await client.send_message(channel, "⚠️ Non hai specificato un username!\n"
"Sintassi corretta: `!register <username_ryg>`")
return
try:
d = db.Discord.create(session,
royal_username=params[0],
discord_user=author)
except errors.AlreadyExistingError:
await client.send_message(channel,
"⚠ Il tuo account Discord è già collegato a un account RYG "
"o l'account RYG che hai specificato è già collegato a un account Discord.")
return
session.add(d)
session.commit()
session.close()
await client.send_message(channel, "✅ Sincronizzazione completata!")
async def queue_predownload_videos(): async def queue_predownload_videos():
while True: while True:
for index, video in enumerate(voice_queue[:int(config["YouTube"]["predownload_videos"])].copy()): for index, video in enumerate(voice_queue[:int(config["YouTube"]["predownload_videos"])].copy()):
@ -551,7 +571,8 @@ commands = {
"!q": cmd_queue, "!q": cmd_queue,
"!shuffle": cmd_shuffle, "!shuffle": cmd_shuffle,
"!clear": cmd_clear, "!clear": cmd_clear,
"!dump_vp": cmd_dump_voice_player_error "!dump_vp": cmd_dump_voice_player_error,
"!register": cmd_register
} }

View file

@ -20,16 +20,16 @@ h1, h2, h3, h4, h5, h6 {
a { a {
color: @link-color; color: @link-color;
text-decoration: none; text-decoration: none;
}
a:hover, a:active { &:hover, &:active {
color: @link-color; color: @link-color;
text-decoration: underline; text-decoration: underline;
} }
a:visited { &:visited {
color: @visited-color; color: @visited-color;
} }
}
blockquote { blockquote {
color: @quote-color; color: @quote-color;
@ -162,8 +162,31 @@ nav {
} }
} }
@media (min-width:601px) {
.mobile-only {
display: none;
}
}
@media (max-width:600px) {
.desktop-only {
display: none;
}
}
//Dirtiest hack ever
.game-panels {
font-size: 0;
.game-panel {
font-size: medium;
}
}
.game-panel { .game-panel {
display: inline-block; display: inline-block;
margin: 4px;
vertical-align: top;
} }
.game-grid { .game-grid {
@ -171,7 +194,6 @@ nav {
width: 360px; width: 360px;
height: 100px; height: 100px;
border-radius: 10px; border-radius: 10px;
margin: 4px;
position: relative; position: relative;
.game-title { .game-title {
@ -199,18 +221,6 @@ nav {
} }
} }
@media (min-width:601px) {
.mobile-only {
display: none;
}
}
@media (max-width:600px) {
.desktop-only {
display: none;
}
}
.osu { .osu {
font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif; font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif;
font-style: italic; font-style: italic;
@ -489,7 +499,7 @@ nav {
} }
.ow { .ow {
padding: 15px; padding: 16px;
font-family: "FuturaNo2D", sans-serif; font-family: "FuturaNo2D", sans-serif;
background-color: #371b00; background-color: #371b00;
border: 2px solid #ff9c00; border: 2px solid #ff9c00;
@ -579,6 +589,16 @@ nav {
} }
} }
.telegram {
background-color: #32afed;
color: white !important;
padding: 18px;
.useless-stuff {
grid-column: 1;
}
}
.wiki { .wiki {
.wiki-log { .wiki-log {

View file

@ -12,9 +12,11 @@
<h1> <h1>
Royal Games su {{ game_name }} Royal Games su {{ game_name }}
</h1> </h1>
<div class="game-panels">
{% for mini in minis %} {% for mini in minis %}
{% with record = mini %} {% with record = mini %}
{% include "minis/" + game_short_name + ".html" %} {% include "minis/" + game_short_name + ".html" %}
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}
</div>
{% endblock %} {% endblock %}

View file

@ -0,0 +1,12 @@
<div class="game-panel">
<div class="game-grid telegram">
<div class="player">
{% if record.username is none %}
<span class="player-name">{{ record.first_name }}</span>
{% else %}
<a href="https://t.me/{{ record.username }}" class="player-name">@{{ record.username }}</a>
{% endif %}
</div>
<div class="game-score useless-stuff">è su Telegram!</div>
</div>
</div>

View file

@ -22,6 +22,7 @@
<h1> <h1>
Profilo di {{ ryg.username }} {% if session.get('user_id', '') == ryg.id %}<a href="/setcss" id="edit-css">Modifica</a>{% endif %} Profilo di {{ ryg.username }} {% if session.get('user_id', '') == ryg.id %}<a href="/setcss" id="edit-css">Modifica</a>{% endif %}
</h1> </h1>
<div class="game-panels">
{% with record = ryg %} {% with record = ryg %}
{% include "minis/ryg.html" %} {% include "minis/ryg.html" %}
{% endwith %} {% endwith %}
@ -55,4 +56,10 @@
{% include "minis/ow.html" %} {% include "minis/ow.html" %}
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{% if tg %}
{% with record = tg %}
{% include "minis/telegram.html" %}
{% endwith %}
{% endif %}
</div>
{% endblock %} {% endblock %}

View file

@ -79,9 +79,10 @@ def page_profile(name: str):
dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none() dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none()
lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none() lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none()
ow = db_session.query(db.Overwatch).filter_by(royal=user).one_or_none() ow = db_session.query(db.Overwatch).filter_by(royal=user).one_or_none()
tg = db_session.query(db.Telegram).filter_by(royal=user).one_or_none()
db_session.close() db_session.close()
return render_template("profile.html", ryg=user, css=css, osu=osu, rl=rl, dota=dota, lol=lol, steam=steam, ow=ow, return render_template("profile.html", ryg=user, css=css, osu=osu, rl=rl, dota=dota, lol=lol, steam=steam, ow=ow,
config=config) tg=tg, config=config)
@app.route("/login") @app.route("/login")