taler-merchant-demos

Python-based Frontends for the Demonstration Web site
Log | Files | Refs | Submodules | README | LICENSE

commit 2c71494d172ed40f69852e27b5ddc53e10947506
parent 04a7984b69975260187409a604d60bf101030400
Author: Florian Dold <florian@dold.me>
Date:   Thu, 22 Apr 2021 15:03:30 +0200

use flask-agnostic helpers in base template

Diffstat:
Mtalermerchantdemos/httpcommon/__init__.py | 6+++++-
Mtalermerchantdemos/templates/common-base.html.j2 | 14+++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/talermerchantdemos/httpcommon/__init__.py b/talermerchantdemos/httpcommon/__init__.py @@ -152,7 +152,6 @@ all_languages = { } - ## # Make the environment available into templates. # @@ -177,11 +176,16 @@ def make_utility_processor(pagename): # returns the YYYY-MM-DD date format. return timestamp.strftime("%Y-%b-%d") + def static(name): + return flask.url_for("static", filename=name) + return dict( env=env, prettydate=prettydate, getactive=getactive, getlang=getlang, all_languages=all_languages, + static=static, ) + return utility_processor diff --git a/talermerchantdemos/templates/common-base.html.j2 b/talermerchantdemos/templates/common-base.html.j2 @@ -18,18 +18,18 @@ <html> <head> <title>{{ page_title | default(gettext("GNU Taler Demo")) }}</title> - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='pure.css') }}" /> - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='demo.css') }}" /> - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='navbar.css') }}" /> - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='torsten.css') }}" /> - {% block styles %}{% endblock %} - {% block scripts %}{% endblock %} + <link rel="stylesheet" type="text/css" href="{{ static('pure.css') }}" /> + <link rel="stylesheet" type="text/css" href="{{ static('demo.css') }}" /> + <link rel="stylesheet" type="text/css" href="{{ static('navbar.css') }}" /> + <link rel="stylesheet" type="text/css" href="{{ static('torsten.css') }}" /> + {% block head %} + {% endblock %} </head> <body> <header class="demobar" style="display: flex; flex-direction: column;"> <p> - <img src="{{ url_for('static', filename='logo-white.svg') }}" height="100"><br/> + <img src="{{ static('logo-white.svg') }}" height="100"><br/> </p> <div>