chg: dev: refactor all forms to have Symfony Form Types & Validation Constrainsts - & implement Google ReCapthca v3 #4
This commit is contained in:
@@ -3,108 +3,106 @@
|
||||
{% block title %} - Profile{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="profile-page">
|
||||
|
||||
<div class="profile-header">
|
||||
<div class="profile-avatar">
|
||||
{{ app.user.username|slice(0, 2)|upper }}
|
||||
</div>
|
||||
<div class="profile-info">
|
||||
<h1 class="profile-name">{{ app.user.username }}</h1>
|
||||
{% if app.user.email %}
|
||||
<p class="profile-email">
|
||||
<i class="fa fa-envelope"></i>
|
||||
{{ app.user.email }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p class="profile-role">
|
||||
<i class="fa fa-shield"></i> Registered commander
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="profile-stats">
|
||||
<div class="profile-stat">
|
||||
<i class="fa fa-gamepad profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.total }}</span>
|
||||
<span class="profile-stat__label">Games played</span>
|
||||
</div>
|
||||
<div class="profile-stat profile-stat--win">
|
||||
<i class="fa fa-trophy profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.wins }}</span>
|
||||
<span class="profile-stat__label">Victories</span>
|
||||
</div>
|
||||
<div class="profile-stat profile-stat--loss">
|
||||
<i class="fa fa-flag profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.losses }}</span>
|
||||
<span class="profile-stat__label">Defeats</span>
|
||||
</div>
|
||||
<div class="profile-stat profile-stat--bomb">
|
||||
<i class="fa fa-bomb profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.bombs }}</span>
|
||||
<span class="profile-stat__label">Mines hit</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if recent|length > 0 %}
|
||||
<div class="profile-section">
|
||||
<h2 class="profile-section__title">
|
||||
<i class="fa fa-history"></i> Recent battles
|
||||
</h2>
|
||||
<div class="profile-games">
|
||||
{% for game in recent %}
|
||||
{% set is_red = game.red and game.red.id == app.user.id %}
|
||||
{% set my_points = is_red ? game.redPoints : game.bluePoints %}
|
||||
{% set opp_points = is_red ? game.bluePoints : game.redPoints %}
|
||||
{% set opp = is_red ? game.blue : game.red %}
|
||||
{% set opp_anon = is_red ? game.blueAnon : game.redAnon %}
|
||||
|
||||
{% set result = 'draw' %}
|
||||
{% if game.resign == (is_red ? 'red' : 'blue') %}
|
||||
{% set result = 'loss' %}
|
||||
{% elseif game.resign == (is_red ? 'blue' : 'red') %}
|
||||
{% set result = 'win' %}
|
||||
{% elseif my_points is not null and opp_points is not null %}
|
||||
{% if my_points > opp_points %}
|
||||
{% set result = 'win' %}
|
||||
{% elseif my_points < opp_points %}
|
||||
{% set result = 'loss' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="profile-game profile-game--{{ result }}">
|
||||
<span class="profile-game__badge">
|
||||
{{ result == 'win' ? 'W' : (result == 'loss' ? 'L' : 'D') }}
|
||||
</span>
|
||||
<span class="profile-game__score">
|
||||
{{ my_points ?? '—' }} : {{ opp_points ?? '—' }}
|
||||
</span>
|
||||
<span class="profile-game__vs">vs</span>
|
||||
<span class="profile-game__opponent">
|
||||
{% if opp %}
|
||||
{{ opp.username }}
|
||||
{% elseif opp_anon %}
|
||||
{{ opp_anon.userName }}
|
||||
{% else %}
|
||||
Guest
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="profile-game__color">
|
||||
<i class="fa fa-circle" style="color: {{ is_red ? '#c0392b' : '#2980b9' }}"></i>
|
||||
</span>
|
||||
<span class="profile-game__date">
|
||||
{{ game.updated ? game.updated|date('Y-m-d') : '' }}
|
||||
</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="profile-empty">
|
||||
<i class="fa fa-inbox"></i>
|
||||
<p>No games recorded yet. <a href="{{ path('MineSeekerBundle_gamePlay') }}">Start playing!</a></p>
|
||||
</div>
|
||||
<div class="profile-page">
|
||||
<div class="profile-header">
|
||||
<div class="profile-avatar">
|
||||
{{ app.user.username|slice(0, 2)|upper }}
|
||||
</div>
|
||||
<div class="profile-info">
|
||||
<h1 class="profile-name">{{ app.user.username }}</h1>
|
||||
{% if app.user.email %}
|
||||
<p class="profile-email">
|
||||
<i class="fa fa-envelope"></i>
|
||||
{{ app.user.email }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p class="profile-role">
|
||||
<i class="fa fa-shield"></i> Registered commander
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<div class="profile-stats">
|
||||
<div class="profile-stat">
|
||||
<i class="fa fa-gamepad profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.total }}</span>
|
||||
<span class="profile-stat__label">Games played</span>
|
||||
</div>
|
||||
<div class="profile-stat profile-stat--win">
|
||||
<i class="fa fa-trophy profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.wins }}</span>
|
||||
<span class="profile-stat__label">Victories</span>
|
||||
</div>
|
||||
<div class="profile-stat profile-stat--loss">
|
||||
<i class="fa fa-flag profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.losses }}</span>
|
||||
<span class="profile-stat__label">Defeats</span>
|
||||
</div>
|
||||
<div class="profile-stat profile-stat--bomb">
|
||||
<i class="fa fa-bomb profile-stat__icon"></i>
|
||||
<span class="profile-stat__value">{{ stats.bombs }}</span>
|
||||
<span class="profile-stat__label">Mines hit</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if recent|length > 0 %}
|
||||
<div class="profile-section">
|
||||
<h2 class="profile-section__title">
|
||||
<i class="fa fa-history"></i> Recent battles
|
||||
</h2>
|
||||
<div class="profile-games">
|
||||
{% for game in recent %}
|
||||
{% set is_red = game.red and game.red.id == app.user.id %}
|
||||
{% set my_points = is_red ? game.redPoints : game.bluePoints %}
|
||||
{% set opp_points = is_red ? game.bluePoints : game.redPoints %}
|
||||
{% set opp = is_red ? game.blue : game.red %}
|
||||
{% set opp_anon = is_red ? game.blueAnon : game.redAnon %}
|
||||
|
||||
{% set result = 'draw' %}
|
||||
{% if game.resign == (is_red ? 'red' : 'blue') %}
|
||||
{% set result = 'loss' %}
|
||||
{% elseif game.resign == (is_red ? 'blue' : 'red') %}
|
||||
{% set result = 'win' %}
|
||||
{% elseif my_points is not null and opp_points is not null %}
|
||||
{% if my_points > opp_points %}
|
||||
{% set result = 'win' %}
|
||||
{% elseif my_points < opp_points %}
|
||||
{% set result = 'loss' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="profile-game profile-game--{{ result }}">
|
||||
<span class="profile-game__badge">
|
||||
{{ result == 'win' ? 'W' : (result == 'loss' ? 'L' : 'D') }}
|
||||
</span>
|
||||
<span class="profile-game__score">
|
||||
{{ my_points ?? '—' }} : {{ opp_points ?? '—' }}
|
||||
</span>
|
||||
<span class="profile-game__vs">vs</span>
|
||||
<span class="profile-game__opponent">
|
||||
{% if opp %}
|
||||
{{ opp.username }}
|
||||
{% elseif opp_anon %}
|
||||
{{ opp_anon.userName }}
|
||||
{% else %}
|
||||
Guest
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="profile-game__color">
|
||||
<i class="fa fa-circle" style="color: {{ is_red ? '#c0392b' : '#2980b9' }}"></i>
|
||||
</span>
|
||||
<span class="profile-game__date">
|
||||
{{ game.updated ? game.updated|date('Y-m-d') : '' }}
|
||||
</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="profile-empty">
|
||||
<i class="fa fa-inbox"></i>
|
||||
<p>No games recorded yet. <a href="{{ path('MineSeekerBundle_gamePlay') }}">Start playing!</a></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user