diff --git a/bullet/bullet_admin/templates/bullet_admin/results/announce.html b/bullet/bullet_admin/templates/bullet_admin/results/announce.html index e94e0b36..c95438f8 100644 --- a/bullet/bullet_admin/templates/bullet_admin/results/announce.html +++ b/bullet/bullet_admin/templates/bullet_admin/results/announce.html @@ -1,53 +1,57 @@ {% extends "web/root_base.html" %} {% load results %} + {% block title %} - Results announcement + Results announcement {% endblock title %} {% block root_content %} -
- {% if not hidden %} -
-
{{ position }}.
- {% if team %} - {% if team.school %} -
- {{ team.school.name }} - {% if team.in_school_symbol %} - {{ team.in_school_symbol }} - {% endif %} -
-
{{ team.school.address }}
- {% else %} -
{{ team.name }}
- {% endif %} -
{{ team.contestants_names }}
-
{% big_squares result_row %}
-
{{ result_row.solved_count }}
- {% endif %} -
+
+ {% if not hidden %} +
+
{{ position }}.
+ {% if team %} + {% if team.school %} + {# TODO: #998 Unify team display #} +
+ {{ team.school.name }} + {% if team.in_school_symbol %} + {{ team.in_school_symbol }} + {% endif %} +
+
{{ team.school.address }}
+ {% else %} +
{{ team.name }}
{% endif %} -
- {{ position }}. - - - -
+ +
{{ team.contestants_names }}
+
{% squares result_row big=True %}
+
{{ result_row.solved_count }}
+ {% endif %} +
+ {% endif %} + +
+ {{ position }}. + + +
+
{% endblock root_content %} diff --git a/bullet/competitions/templates/teams/list.html b/bullet/competitions/templates/teams/list.html index d6d6e647..cca9c6e4 100644 --- a/bullet/competitions/templates/teams/list.html +++ b/bullet/competitions/templates/teams/list.html @@ -1,27 +1,27 @@ {% extends "web/base.html" %} -{% load content_blocks countries country_url i18n static %} +{% load content_blocks countries country_url i18n static teams %} {% block title %} - {% if is_waitinglist %} - {% translate "Waiting list" %} - {% else %} - {% translate "Team list" %} - {% endif %} + {% if is_waitinglist %} + {% translate "Waiting list" %} + {% else %} + {% translate "Team list" %} + {% endif %} {% endblock title %} {% block hero %} -

- {% if is_waitinglist %} - {% translate "Waiting list" %} - {% else %} - {% translate "Team list" %} - {% endif %} -

+

+ {% if is_waitinglist %} + {% translate "Waiting list" %} + {% else %} + {% translate "Team list" %} + {% endif %} +

{% endblock hero %} {% block content %} {% load_blocks "category" %} -
-
+
+
{% for c in countries %} @@ -32,47 +32,45 @@

{% endfor %}

-
- {% if is_waitinglist %} - {% translate "Team list" %} - {% else %} - {% translate "Waiting list" %} - {% endif %} + +
+ {% if is_waitinglist %} + {% translate "Team list" %} + {% else %} + {% translate "Waiting list" %} + {% endif %}
+ + + {% for v in venues %} -
-
-

- {{ v.venue.name }} - ({% content_block "category:name_"|add:v.venue.category.identifier %}) -

- {% if not is_waitinglist %} -
- {% blocktranslate with teams=v.teams|length capacity=v.venue.capacity %}Teams: {{ teams }} / {{ capacity }}{% endblocktranslate %} -
- {% endif %} -
- {% for team in v.teams %} -
-
- {% if team.school %} -
- {{ team.school.name }} - {% if team.in_school_symbol %} - {{ team.in_school_symbol }} - {% endif %} -
-
{{ team.school.address }}
- {% else %} -
{{ team.name }}
- {% endif %} -
-
{{ team.contestants.all|join:", " }}
-
- {% endfor %} +
+

+ {{ v.venue.name }} + ({% content_block "category:name_"|add:v.venue.category.identifier %}) +

+ + {% if not is_waitinglist %} +
+ {% blocktranslate with teams=v.teams|length capacity=v.venue.capacity %}Teams: {{ teams }} / {{ capacity }}{% endblocktranslate %} +
+ {% endif %} + +
+ {% for team in v.teams %} +
+ {% inline_team_name team %} +
{{ team.contestants.all|join:", " }}
+ {% endfor %} +
+
{% endfor %}
{% endblock content %} diff --git a/bullet/problems/templates/problems/results.html b/bullet/problems/templates/problems/results.html index 5b224c58..08012a53 100644 --- a/bullet/problems/templates/problems/results.html +++ b/bullet/problems/templates/problems/results.html @@ -1,46 +1,45 @@ {% extends "web/base.html" %} {% load content_blocks country_url i18n utils %} {% block title %} - {% translate "Results" %} + {% translate "Results" %} {% endblock title %} {% block extrahead %} - {{ block.super }} - {% if country %} - - {% else %} - - {% endif %} + {{ block.super }} + + {% if country %} + + {% else %} + + {% endif %} {% endblock extrahead %} {% block hero %} - {% load_blocks "category" %} -
-

{% translate "Results" %}

-

- {% content_block "category:name_"|add:category.identifier %}, {{ country_name }}, {{ competition.name }} -

-
+ {% load_blocks "category" %} +
+

{% translate "Results" %}

+

+ {% content_block "category:name_"|add:category.identifier %}, {{ country_name }}, {{ competition.name }} +

+
{% endblock hero %} {% block content %} -
-
- - {% translate "International" %} - - {% for c in countries %} - - - {{ c.name }} - - {% endfor %} -
- {% include "problems/results/table.html" %} +
+
+ + {% translate "International" %} + + + {% for c in countries %} + + + {{ c.name }} + + {% endfor %}
+ {% include "problems/results/table.html" %} +
{% endblock content %} diff --git a/bullet/problems/templates/problems/results/squares.html b/bullet/problems/templates/problems/results/squares.html index 81171179..1bb97fc6 100644 --- a/bullet/problems/templates/problems/results/squares.html +++ b/bullet/problems/templates/problems/results/squares.html @@ -1,8 +1,15 @@ -
- {% for sq in squares %} -
- {% if big %}{{ forloop.counter|add:offset }}{% endif %} -
+{# django #} +
+ {% for group in squares %} +
+ {% for sq in group %} +
+ {% if big %}{{ sq.problem }}{% endif %} +
{% endfor %} +
+ {% endfor %}
diff --git a/bullet/problems/templates/problems/results/table.html b/bullet/problems/templates/problems/results/table.html index 0ba71292..f823a569 100644 --- a/bullet/problems/templates/problems/results/table.html +++ b/bullet/problems/templates/problems/results/table.html @@ -1,71 +1,61 @@ -{% load i18n results utils %} +{% load i18n results teams utils %} + {% if not results_time.has_started %} -
- {% translate "The competition did not start yet." %} -
+
+ {% translate "The competition did not start yet." %} +
{% elif results_time.is_frozen %} -
- {% translate "Results are frozen." %} {% translate "These are not the final results yet." %} -
+
+ {% translate "Results are frozen." %} + {% translate "These are not the final results yet." %} +
{% elif results_time.has_started and not results_time.is_final %} -
- {% translate "Interim results." %} {% translate "The competition is ongoing, the results may change." %} -
+
+ {% translate "Interim results." %} + {% translate "The competition is ongoing, the results may change." %} +
{% endif %} +
- - - {% for row in object_list %} - - - - - - - - {% empty %} - - - - {% endfor %} +
-
{{ forloop.counter0|add:start_index }}.
- -
- {% if row.team.school %} -
- {{ row.team.school.name }} - {% if row.team.in_school_symbol %} - {{ row.team.in_school_symbol }} - {% endif %} -
-
{{ row.team.school.address }}
- {% else %} -
{{ row.team.name }}
- {% endif %} -
-
-
- {% if not hide_squares %} - {% squares row problem_count team_problem_count first_problem %} - {% endif %} -
{{ row.solved_count }}
-
- {% if not hide_contestants %} -
{{ row.team.contestants.all|join:", " }}
- {% endif %} -
{% translate "(No team has solved any problem yet)" %}
+ + {% for row in object_list %} + + + + + + {% empty %} + + + + {% endfor %} -
+
+
{{ forloop.counter0|add:start_index }}.
+
{{ row.solved_count }}
+
+ + {% full_team_name row.team flag=True %} + + {% if not hide_squares %} +
+ {% squares row problem_count team_problem_count first_problem %} +
+ {% endif %} + + {% if not hide_contestants %} +
{{ row.team.contestants.all|join:", " }}
+ {% endif %} +
+ {% translate "(No team has solved any problem yet)" %} +
+
diff --git a/bullet/problems/templatetags/results.py b/bullet/problems/templatetags/results.py index 14dbe054..876b4d1a 100644 --- a/bullet/problems/templatetags/results.py +++ b/bullet/problems/templatetags/results.py @@ -15,6 +15,7 @@ def squares( problem_count: Optional[int] = None, team_problem_count: Optional[int] = None, first_problem: Optional[int] = None, + big: bool = False, ): category: Category = obj.team.venue.category if not team_problem_count: @@ -24,24 +25,22 @@ def squares( if not problem_count: problem_count = category.competition.problem_count - first_problem + 1 + squares = obj.get_squares(problem_count, team_problem_count, first_problem) + squares_grouped = [] + for i in range(0, len(squares), 5): + group = [] + for idx in range(i, i + 5): + if len(squares) <= idx: + continue + group.append({"problem": idx + first_problem, "state": squares[idx]}) + squares_grouped.append(group) + return { - "squares": obj.get_squares(problem_count, team_problem_count, first_problem), - "offset": first_problem - 1, + "squares": squares_grouped, + "big": big, } -@register.inclusion_tag("problems/results/squares.html") -def big_squares( - obj: ResultRow, - problem_count: Optional[int] = None, - team_problem_count: Optional[int] = None, - first_problem: Optional[int] = None, -): - ctx = squares(obj, problem_count, team_problem_count, first_problem) - ctx["big"] = True - return ctx - - @register.inclusion_tag("problems/results/timer.html") def venue_timer(venue: Venue | str, competition: Competition): if isinstance(venue, str): diff --git a/bullet/users/templates/partials/team_name.html b/bullet/users/templates/partials/team_name.html new file mode 100644 index 00000000..8df099c8 --- /dev/null +++ b/bullet/users/templates/partials/team_name.html @@ -0,0 +1,20 @@ +{# django #} +{% if team.school %} +
+ {% if flag %} + + {% endif %} +
+
+ {{ team.school.name }} + + {% if team.in_school_symbol %} + {{ team.in_school_symbol }} + {% endif %} +
+
{{ team.school.address }}
+
+
+{% else %} +
{{ team.name }}
+{% endif %} diff --git a/bullet/users/templates/partials/team_name_inline.html b/bullet/users/templates/partials/team_name_inline.html new file mode 100644 index 00000000..c358ada7 --- /dev/null +++ b/bullet/users/templates/partials/team_name_inline.html @@ -0,0 +1,12 @@ +{# django #} +{% if team.school %} +
+ + {# This is on a single line in order to control whitespace around the comma. #} + {{ team.school.name }}{% if team.in_school_symbol %} {{ team.in_school_symbol }}{% endif %}, + + {{ team.school.address }} +
+{% else %} +
{{ team.name }}
+{% endif %} diff --git a/bullet/users/templatetags/__init__.py b/bullet/users/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/bullet/users/templatetags/teams.py b/bullet/users/templatetags/teams.py new file mode 100644 index 00000000..2f569b59 --- /dev/null +++ b/bullet/users/templatetags/teams.py @@ -0,0 +1,13 @@ +from django import template + +register = template.Library() + + +@register.inclusion_tag("partials/team_name.html") +def full_team_name(team, flag=False): + return {"team": team, "flag": flag} + + +@register.inclusion_tag("partials/team_name_inline.html") +def inline_team_name(team): + return {"team": team} diff --git a/bullet/web/templates/page_blocks/markdown.html b/bullet/web/templates/page_blocks/markdown.html index d953aa09..bb849b79 100644 --- a/bullet/web/templates/page_blocks/markdown.html +++ b/bullet/web/templates/page_blocks/markdown.html @@ -1,8 +1,9 @@ {% extends "page_blocks/_base.html" %} {% load markdownify %} + {% block container %} - {% include "page_blocks/_centered_header.html" %} -
- {{ content|markdownify }} -
+ {% include "page_blocks/_centered_header.html" %} +
+ {{ content|markdownify }} +
{% endblock container %} diff --git a/bullet/web/templates/web/page.html b/bullet/web/templates/web/page.html index 626845dc..8dc685b7 100644 --- a/bullet/web/templates/web/page.html +++ b/bullet/web/templates/web/page.html @@ -1,26 +1,27 @@ {% extends "web/base.html" %} {% load markdownify page_blocks %} {% block title %} - {{ page.title }} + {{ page.title }} {% endblock title %} {% block hero %} - {% if not page_blocks %} -

- {{ page.title }} -

- {% endif %} + {% if not page_blocks %} +

+ {{ page.title }} +

+ {% endif %} {% endblock hero %} {% block content %} - {% for page_block in page_blocks %} - {% render_page_block page_block %} - {% empty %} -
- {{ page.content|markdownify }} -
- {% endfor %} - {% if page_blocks %} - {% include "web/snippets/state_selector.html" %} - {% endif %} + {% for page_block in page_blocks %} + {% render_page_block page_block %} + {% empty %} +
+ {{ page.content|markdownify }} +
+ {% endfor %} + + {% if page_blocks %} + {% include "web/snippets/state_selector.html" %} + {% endif %} {% endblock content %} diff --git a/bullet/web/templates/web/root_base.html b/bullet/web/templates/web/root_base.html index 6b57ae99..185db20b 100644 --- a/bullet/web/templates/web/root_base.html +++ b/bullet/web/templates/web/root_base.html @@ -27,15 +27,16 @@ - + {% block extrahead %} {% endblock extrahead %} + {# TODO: Remove iconify #} + diff --git a/css/app.css b/css/app.css index e8b1d8de..8fc51348 100644 --- a/css/app.css +++ b/css/app.css @@ -170,3 +170,7 @@ .prose-archive img:not(.math) { @apply mx-auto max-w-full w-2/3 max-h-40 object-contain; } + +.prose iframe { + max-width: 100%; +}