AACResults/templates/index.html

123 lines
4.2 KiB
HTML
Raw Normal View History

2018-08-14 08:54:02 +00:00
<!DOCTYPE html>
<html lang="en-ZA">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>AAC Statistics</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}" />
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
</head>
{%- set ns = namespace() -%}
{%- set ns.limit = limit -%}
{%- if ns.limit == 0 or ns.limit == 10 -%}
{%- set ns.limit = None -%}
{%- endif -%}
{%- set ns.year = year -%}
{%- if ns.year == 0 -%}
{%- set ns.year = None -%}
{%- endif -%}
<body>
<nav></nav>
<article>
<h1>AAC Statistics {% if title %}: {{ title }}{% endif %}</h1>
{%- if results -%}
<table>
<thead>
<tr>
<th>Position</th>
{% if ltype != 'person' %}
<th>Name</th>
<th>Licence</th>
{% endif %}
<th>Time</th>
<th>Average Pace</th>
{% if ltype != 'event' %}
<th>Event</th>
{% endif %}
<th>Date</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{%- for row in results -%}
{%- set person='{} {}'.format(row.name, row.surname) -%}
{%- if distance %}{# set total_km += row.distance #}{% endif -%}
<tr>
<td>{{ row.position }}</td>
{%- if ltype != 'person' -%}
<td><a href="{{ url_for('person', title=person, start=None) }}">{{ person }}</a></td>
<td><a href="{{ url_for('licence', title=row.licence, year=row.date|year, start=None, limit=ns.limit) }}">{{ row.licence }}</a></td>
{%- endif -%}
<td>{{ row.time }}</td>
<td class="nowrap">{% if row.distance is number %}{{ (row.time / row.distance) | pace }} min/KM{% endif %}</td>
{%- if ltype != 'event' -%}
<td><a href="{{ url_for('race', title=row.event, year=row.date|year, start=None, limit=ns.limit) }}">{{ row.event }} ({{ row.distance }} KM)</a></td>
{%- endif -%}
<td>{{ row.date | clean_date }}</td>
<td>
{% if row.sex and row.sexposition and row.sexposition <= 100 %}{{ row.sexposition | ordinal }} {{ row.sex.lower() }}{% endif %}
{% if row.sexposition and row.catposition %}/{% endif %}
{% if row.catposition and row.catposition <= 100 %}{{ row.catposition | ordinal }} in category{% endif %}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
{%- endif -%}
<nav class="nextprev">
{%- set ns.start = start -%}
{%- set ns.prev = start-limit -%}
{%- set ns.next = start+limit -%}
{%- if ns.prev == 0-%}
{%- set ns.prev = None -%}
{%- endif -%}
{%- if ns.next == 0-%}
{%- set ns.next = None -%}
{%- endif -%}
{%- if ns.start == 0-%}
{%- set ns.start = None -%}
{%- endif -%}
{%- set thispage = (start / limit)|round(0,'floor')|int + 1 -%}
{%- set totalpages = (total / limit)|round(0,'ceil')|int -%}
{%- set ns.ellipsis = False -%}
{% if thispage > 1 %}
<span class="first"><a href="{{ url_for(request.endpoint, title=title, year=ns.year, start=None, limit=ns.limit) }}">&laquo;First</a></span>
{% if (start-limit) > 1 %}
<span class="prev"><a href="{{ url_for(request.endpoint, title=title, year=ns.year, start=ns.prev, limit=ns.limit) }}">&lt;Prev</a></span>
{% endif %}
{% endif %}
<span class="navlink">
{% for page in range(1, totalpages+1) %}
{% if page < 4 or page > (totalpages+1-4) or (page > (thispage-3) and page < (thispage+3)) %}
{%- if page != thispage -%}
<a href="{{ url_for(request.endpoint, title=title, year=ns.year, start=(page-1)*limit, limit=ns.limit) }}">{{ page }}</a>
{%- else -%}
<strong>{{ page }}</strong>
{%- endif %}
{%- set ns.ellipsis = False -%}
{%- else -%}
{%- if not ns.ellipsis -%}
&hellip;
{%- endif -%}
{%- set ns.ellipsis = True -%}
{% endif %}
{% endfor %}
</span>
{% if thispage < totalpages %}
{% if (start+limit) != (totalpages-1)*limit %}
<span class="next"><a href="{{ url_for(request.endpoint, title=title, year=ns.year, start=ns.next, limit=ns.limit) }}">Next&gt;</a></span>
{% endif %}
<span class="last"><a href="{{ url_for(request.endpoint, title=title, year=ns.year, start=(totalpages-1)*limit, limit=ns.limit) }}">Last&raquo;</a></span>
{% endif %}
</nav>
</article>
</body>
</html>