From 2a28a5c0c5a7c96a108619dbd4ce6283c7f3f374 Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 27 Dec 2017 22:31:18 +0000 Subject: [PATCH] rodelbahn_view.html now uses jinja2. git-svn-id: http://www.winterrodeln.org/svn/wradmin/trunk@2761 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- wradmin/controllers/rodelbahn.py | 14 ++- wradmin/templates/rodelbahn_view.html | 121 +++++++++++++------------- 2 files changed, 65 insertions(+), 70 deletions(-) diff --git a/wradmin/controllers/rodelbahn.py b/wradmin/controllers/rodelbahn.py index c9c5b6f..71e633f 100644 --- a/wradmin/controllers/rodelbahn.py +++ b/wradmin/controllers/rodelbahn.py @@ -8,7 +8,6 @@ import wrpylib.wrmwcache import wrpylib.mwmarkup import wradmin.model as model -from wradmin.genshi import render_genshi_template, TemplateContext class RodelbahnController: @@ -25,16 +24,15 @@ class RodelbahnController: def view(self, id): """Displays a sled run""" q = model.meta.Session.query(model.WrSledrunCache) - c = TemplateContext() - c.sledding = q.get(id) - if c.sledding is None: + sledding = q.get(id) + if sledding is None: abort(404) q = model.meta.Session.query(model.WrReport) q = q.filter_by(page_id=id).order_by(sa.sql.expression.desc(model.WrReport.id)) - c.paginator = paginate.Page(q.all(), page=int(request.args.get('page', 1)), - url_maker=lambda page: url_for('rodelbahn_view', id=id, page=page), - items_per_page=25) - return render_genshi_template('rodelbahn_view.html', c=c) + paginator = paginate.Page(q.all(), page=int(request.args.get('page', 1)), + url_maker=lambda page: url_for('rodelbahn_view', id=id, page=page), + items_per_page=25) + return render_template('rodelbahn_view.html', sledding=sledding, paginator=paginator) def update(self): """Updates the wrsledruncache table from the wiki""" diff --git a/wradmin/templates/rodelbahn_view.html b/wradmin/templates/rodelbahn_view.html index 016a20c..56f44c6 100644 --- a/wradmin/templates/rodelbahn_view.html +++ b/wradmin/templates/rodelbahn_view.html @@ -1,138 +1,135 @@ - - - - +{% extends "master.html" %} +{% block title %}Rodelbahn {{sledding.page_title}}{% endblock %} - - Rodelbahn - - - -

Rodelbahn #${c.sledding.page_id}: ${c.sledding.page_title}

+{% block content %} +

Rodelbahn #{{sledding.page_id}}: {{sledding.page_title}}

Inhalt der Rodelbahnbox

- + - + - - + + - + - - + + - - + + - - + + - + - + - + - + - - + + - + - + - + - + - + - + - - + +
ID${c.sledding.page_id}{{sledding.page_id}}
Name${c.sledding.page_title}{{sledding.page_title}}
Länge${c.sledding.length}Länge{{sledding.length}}
Gehzeit${c.sledding.walkup_time}{{sledding.walkup_time}}
Höhe (oben)${c.sledding.top_elevation}Höhe (oben){{sledding.top_elevation}}
Höhe (unten)${c.sledding.bottom_elevation}Höhe (unten){{sledding.bottom_elevation}}
Aufstieg möglich${h.bool(c.sledding.walkup_possible)}Aufstieg möglich{{h.bool(sledding.walkup_possible)}}
Aufstieg getrennt${h.tristate_float(c.sledding.walkup_separate)}{{h.tristate_float(sledding.walkup_separate)}}
Lift${h.bool(c.sledding.lift)}{{h.bool(sledding.lift)}}
Licht${h.tristate_float(c.sledding.night_light)}{{h.tristate_float(sledding.night_light)}}
Rodelverleih${h.bool(c.sledding.sled_rental)}{{h.bool(sledding.sled_rental)}}
Öffentliche Anreise${h.public_transport(c.sledding.public_transport)}Öffentliche Anreise{{h.public_transport(sledding.public_transport)}}
Bild${c.sledding.image}{{sledding.image}}
Latitude${c.sledding.position_latitude}{{sledding.position_latitude}}
Longitude${c.sledding.position_longitude}{{sledding.position_longitude}}
Information${c.sledding.information_phone}{{sledding.information_phone}}
Forum-ID${c.sledding.forum_id}{{sledding.forum_id}}
In Arbeit${h.bool(c.sledding.under_construction)}{{h.bool(sledding.under_construction)}}
In Übersicht${h.bool(c.sledding.show_in_overview)}In Übersicht{{h.bool(sledding.show_in_overview)}}

Rodelbahnberichte

- -

${Markup(c.paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last'))}

+{% if paginator %} +

{{paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last') | safe}}

- - + + - - - - - - - - - - - + + + {% for r in paginator %} + + + + + + + + + + {% endfor %}
ID Datum EintragDatum UngültigDatum für BerichtDatum UngültigDatum für Bericht Zustand (1 bis 5) Beschreibung (WikiText) Autor-NameGelöscht
${r.id}${r.date_entry}${r.date_invalid}${r.date_report}${r.condition}${r.description}${r.author_name}${r.delete_date}Gelöscht
{{r.id}}{{r.date_entry}}{{r.date_invalid}}{{r.date_report}}{{r.condition}}{{r.description}}{{r.author_name}}{{r.delete_date}}
-

${Markup(c.paginator.pager('~2~'))}

-
- +

{{paginator.pager('~2~') | safe}}

+ +{% else %}

Es sind keine Rodelbahnberichte zu dieser Rodelbahn vorhanden.

-
- - +{% endif %} + +{% endblock %} -- 2.39.5