Make team profile pages use the shared errors component (#1589)

* Fix team pages to use the core errors alert component
* Closes #1585
This commit is contained in:
Kevin Chung
2020-08-08 04:09:13 -04:00
committed by GitHub
parent f597332c90
commit 69b4aafeac
3 changed files with 206 additions and 218 deletions

View File

@@ -154,6 +154,9 @@ def new():
@authed_only
@require_team_mode
def private():
infos = get_infos()
errors = get_errors()
user = get_current_user()
if not user.team_id:
return render_template("teams/team_enrollment.html")
@@ -167,6 +170,9 @@ def private():
place = team.place
score = team.score
if config.is_scoreboard_frozen():
infos.append("Scoreboard has been frozen")
return render_template(
"teams/private.html",
solves=solves,
@@ -176,6 +182,8 @@ def private():
score=score,
place=place,
score_frozen=config.is_scoreboard_frozen(),
infos=infos,
errors=errors,
)
@@ -184,6 +192,7 @@ def private():
@check_score_visibility
@require_team_mode
def public(team_id):
infos = get_infos()
errors = get_errors()
team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404()
solves = team.get_solves()
@@ -195,6 +204,9 @@ def public(team_id):
if errors:
return render_template("teams/public.html", team=team, errors=errors)
if config.is_scoreboard_frozen():
infos.append("Scoreboard has been frozen")
return render_template(
"teams/public.html",
solves=solves,
@@ -203,4 +215,6 @@ def public(team_id):
score=score,
place=place,
score_frozen=config.is_scoreboard_frozen(),
infos=infos,
errors=errors,
)

View File

@@ -154,19 +154,7 @@
</div>
</div>
<div class="container">
{% if errors %}
<div id='errors' class="row">
{% for error in errors %}
<h1>{{ error }}</h1>
{% endfor %}
</div>
{% else %}
{% if score_frozen %}
<div class="row">
<h1 class="text-center">Scoreboard has been frozen.</h1>
</div>
{% endif %}
{% include "components/errors.html" %}
<br>
@@ -287,7 +275,6 @@
</h3>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}

View File

@@ -54,19 +54,7 @@
</div>
</div>
<div class="container">
{% if errors %}
<div id='errors' class="row">
{% for error in errors %}
<h1>{{ error }}</h1>
{% endfor %}
</div>
{% else %}
{% if score_frozen %}
<div class="row">
<h1 class="text-center">Scoreboard has been frozen.</h1>
</div>
{% endif %}
{% include "components/errors.html" %}
<br>
@@ -184,7 +172,6 @@
</h3>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}