From 50aad296cfb5fae02fe0e11bd7fd06abfb2a1126 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 1 Jul 2022 19:22:33 +0200 Subject: start on a track listing --- fietsboek/routes.py | 1 + fietsboek/templates/browse.jinja2 | 52 +++++++++++++++++++++++++++++++++++++++ fietsboek/templates/layout.jinja2 | 3 +++ fietsboek/views/browse.py | 45 +++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 fietsboek/templates/browse.jinja2 create mode 100644 fietsboek/views/browse.py diff --git a/fietsboek/routes.py b/fietsboek/routes.py index b0ee3c4..018c1d3 100644 --- a/fietsboek/routes.py +++ b/fietsboek/routes.py @@ -5,6 +5,7 @@ def includeme(config): config.add_route('home', '/') config.add_route('login', '/login') config.add_route('logout', '/logout') + config.add_route('browse', '/track/') config.add_route('password-reset', '/password-reset') config.add_route('use-token', '/token/{uuid}') diff --git a/fietsboek/templates/browse.jinja2 b/fietsboek/templates/browse.jinja2 new file mode 100644 index 0000000..174694a --- /dev/null +++ b/fietsboek/templates/browse.jinja2 @@ -0,0 +1,52 @@ +{% extends "layout.jinja2" %} +{% block content %} +
+

{{ _("page.browse.title") }}

+ {% for track in tracks %} +
+
+ {{ track.title | default(track.date, true) }} + {% if track.text_tags() %} + {% for tag in track.tags %}{{ tag.tag }} {% endfor %} + {% endif %} +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ _("page.details.date") }}{{ track.date | format_datetime }}{{ _("page.details.length") }}{{ (track.length / 1000) | round(2) | format_decimal }} km
{{ _("page.details.start_time") }}{{ track.start_time | format_datetime }}{{ _("page.details.end_time") }}{{ track.end_time | format_datetime }}
{{ _("page.details.uphill") }}{{ track.uphill | round(2) | format_decimal }} m{{ _("page.details.downhill") }}{{ track.downhill | round(2) | format_decimal }} m
{{ _("page.details.moving_time") }}{{ track.moving_time }}{{ _("page.details.stopped_time") }}{{ track.stopped_time }}
{{ _("page.details.max_speed") }}{{ mps_to_kph(track.max_speed) | round(2) | format_decimal }} km/h{{ _("page.details.avg_speed") }}{{ mps_to_kph(track.avg_speed) | round(2) | format_decimal }} km/h
+
+
+ {% endfor %} +
+{% endblock %} diff --git a/fietsboek/templates/layout.jinja2 b/fietsboek/templates/layout.jinja2 index 6caf666..4bbb9c0 100644 --- a/fietsboek/templates/layout.jinja2 +++ b/fietsboek/templates/layout.jinja2 @@ -38,6 +38,9 @@ + {% if request.identity is none %}