From 59b19c2e15fc5b75df6ff7f7f2f19fe7a1c7a2be Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 4 Jun 2018 18:08:18 +0200 Subject: [PATCH] Add dota mini --- static/nryg.less | 68 +++++++++++++++++++++++++++++++++++++++ templates/minis/dota.html | 28 ++++++++++++++++ templates/minis/osu.html | 3 -- templates/profile.html | 3 ++ webserver.py | 3 +- 5 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 templates/minis/dota.html diff --git a/static/nryg.less b/static/nryg.less index 4e92046f..c342d6df 100644 --- a/static/nryg.less +++ b/static/nryg.less @@ -196,4 +196,72 @@ input[type="text"], input[type="password"] { grid-column: 4; } +} + +.dota { + padding: 18px; + grid-row-gap: 5px; + grid-template-columns: 20% 80%; + background-image: linear-gradient(to bottom, #801717, #a11d21); + color: #ffffff; + + .player { + grid-row: 1; + grid-column-start: 1; + grid-column-end: 3; + font-size: large; + + a { + text-decoration: none; + } + + .player-image { + width: 32px; + height: 32px; + vertical-align: middle; + } + + .player-name { + color: #ffffff; + } + } + + .title { + grid-row: 2; + font-size: x-small; + } + + .number { + grid-row: 3; + font-size: x-large; + } + + .wins { + grid-column: 1; + text-align: center; + } + + .rank { + grid-column: 2; + grid-row-start: 2; + grid-row-end: 4; + margin-top: auto; + margin-bottom: auto; + + img { + vertical-align: middle; + } + + img.stars { + position: relative; + height: 44px; + left: -44px; + margin-right: -44px; + z-index: 1; + } + + img.medal { + height: 44px; + } + } } \ No newline at end of file diff --git a/templates/minis/dota.html b/templates/minis/dota.html new file mode 100644 index 00000000..89ccf52c --- /dev/null +++ b/templates/minis/dota.html @@ -0,0 +1,28 @@ +
+
+ +
+ Vittorie +
+
+ {{ dota.wins }} +
+
+ {% if dota.rank_tier is none %} + + Non classificato + {% elif dota.rank_tier < 10 %} + + {{ dota.rank_tier }} piazzamenti completati + {% else %} + {% if dota.get_rank_stars_url() %}{% endif %} + {{ dota.get_rank_name() }}[{{ dota.get_rank_number() }}] + {% endif %} +
+
+
\ No newline at end of file diff --git a/templates/minis/osu.html b/templates/minis/osu.html index fa7b47d4..37e3e821 100644 --- a/templates/minis/osu.html +++ b/templates/minis/osu.html @@ -1,6 +1,3 @@ -
diff --git a/templates/profile.html b/templates/profile.html index 55e5b532..3b6fc91a 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -14,4 +14,7 @@ {% if rl %} {% include "minis/rl.html" %} {% endif %} + {% if dota %} + {% include "minis/dota.html" %} + {% endif %} {% endblock %} \ No newline at end of file diff --git a/webserver.py b/webserver.py index 532d868c..5a8a9684 100644 --- a/webserver.py +++ b/webserver.py @@ -34,7 +34,8 @@ def page_profile(name: str): return osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none() rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none() - return render_template("profile.html", royal=user, osu=osu, rl=rl) + dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none() + return render_template("profile.html", royal=user, osu=osu, rl=rl, dota=dota) @app.route("/login")