From 2b84f3bd5de3a500b63193924bea2f3dfd0c9afd Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 21 Apr 2021 21:07:18 +0200 Subject: common base template, new logo and lots of cleanup --- talermerchantdemos/landing/landing.py | 16 ++-- talermerchantdemos/landing/static | 1 - talermerchantdemos/landing/templates/base.html.j2 | 48 ------------ talermerchantdemos/landing/templates/error.html.j2 | 13 ---- .../landing/templates/footer.html.j2 | 1 - talermerchantdemos/landing/templates/index.html.j2 | 89 ---------------------- .../landing/templates/language-switcher.html.j2 | 1 - talermerchantdemos/landing/templates/menu.html.j2 | 1 - talermerchantdemos/landing/translations | 1 - 9 files changed, 8 insertions(+), 163 deletions(-) delete mode 120000 talermerchantdemos/landing/static delete mode 100644 talermerchantdemos/landing/templates/base.html.j2 delete mode 100644 talermerchantdemos/landing/templates/error.html.j2 delete mode 120000 talermerchantdemos/landing/templates/footer.html.j2 delete mode 100644 talermerchantdemos/landing/templates/index.html.j2 delete mode 120000 talermerchantdemos/landing/templates/language-switcher.html.j2 delete mode 120000 talermerchantdemos/landing/templates/menu.html.j2 delete mode 120000 talermerchantdemos/landing/translations (limited to 'talermerchantdemos/landing') diff --git a/talermerchantdemos/landing/landing.py b/talermerchantdemos/landing/landing.py index ffbedd7..270e205 100644 --- a/talermerchantdemos/landing/landing.py +++ b/talermerchantdemos/landing/landing.py @@ -41,8 +41,7 @@ if not sys.version_info.major == 3 and sys.version_info.minor >= 6: ) sys.exit(1) -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -app = flask.Flask(__name__, template_folder=BASE_DIR) +app = flask.Flask(__name__, template_folder="../templates", static_folder="../static") app.debug = True app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8") @@ -56,6 +55,8 @@ except ConfigurationError as ce: print(ce) exit(1) +BABEL_TRANSLATION_DIRECTORIES = "../translations" + app.config.from_object(__name__) babel = Babel(app) @@ -67,8 +68,7 @@ LOGGER.info( "Operating with the following translations available: " + " ".join(translations) ) -# pylint: disable=no-member -app.jinja_env.globals.update(self_localized=self_localized) +app.add_template_global(self_localized) @babel.localeselector @@ -113,7 +113,7 @@ def utility_processor(): @app.errorhandler(Exception) def internal_error(e): return flask.render_template( - "templates/error.html.j2", + "landing-error.html.j2", message=gettext("Internal error"), stack=traceback.format_exc(), lang=get_locale(), @@ -173,7 +173,7 @@ def start(lang): merchant_survey_url = "#" return flask.render_template( - "templates/index.html.j2", + "landing-index.html.j2", merchant_currency=CURRENCY, lang=lang, bank_url=bank_register_url, @@ -186,14 +186,14 @@ def start(lang): @app.errorhandler(404) def handler_404(e): return flask.render_template( - "templates/error.html.j2", message=gettext("Page not found"), lang=get_locale() + "landing-error.html.j2", message=gettext("Page not found"), lang=get_locale() ) @app.errorhandler(405) def handler_405(e): return flask.render_template( - "templates/error.html.j2", + "landing-error.html.j2", message=gettext("HTTP method not allowed for this page"), lang=get_locale(), ) diff --git a/talermerchantdemos/landing/static b/talermerchantdemos/landing/static deleted file mode 120000 index d9bc54d..0000000 --- a/talermerchantdemos/landing/static +++ /dev/null @@ -1 +0,0 @@ -../static/ \ No newline at end of file diff --git a/talermerchantdemos/landing/templates/base.html.j2 b/talermerchantdemos/landing/templates/base.html.j2 deleted file mode 100644 index 97a91a5..0000000 --- a/talermerchantdemos/landing/templates/base.html.j2 +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - {{ gettext("GNU Taler Demo: Introduction") }} - - - - - {% block styles %}{% endblock %} - {% block scripts %}{% endblock %} - - - -
-


- {{ gettext("Introduction") }}

-

{{ - gettext("This is the GNU Taler demo.") + "
" + - gettext("Here you can try out the GNU Taler payment system using a toy currency.") - }} -

-
- {% from 'templates/menu.html.j2' import menu with context %} {{ menu('landing') }} - -
- {% block main %} - This is the main content of the page. - {% endblock %} - {% include 'templates/footer.html.j2' %} -
- - diff --git a/talermerchantdemos/landing/templates/error.html.j2 b/talermerchantdemos/landing/templates/error.html.j2 deleted file mode 100644 index 009947c..0000000 --- a/talermerchantdemos/landing/templates/error.html.j2 +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "templates/base.html.j2" %} -{% block main %} -

{{ gettext("Error encountered") }}

- -

{{ message }}

- - {% if stack %} -

{{gettext("Stack trace:")}}

-
-    {{ stack }}
-  
- {% endif %} -{% endblock main %} diff --git a/talermerchantdemos/landing/templates/footer.html.j2 b/talermerchantdemos/landing/templates/footer.html.j2 deleted file mode 120000 index 028b093..0000000 --- a/talermerchantdemos/landing/templates/footer.html.j2 +++ /dev/null @@ -1 +0,0 @@ -../../templates/footer.html.j2 \ No newline at end of file diff --git a/talermerchantdemos/landing/templates/index.html.j2 b/talermerchantdemos/landing/templates/index.html.j2 deleted file mode 100644 index 9beb7c0..0000000 --- a/talermerchantdemos/landing/templates/index.html.j2 +++ /dev/null @@ -1,89 +0,0 @@ -{% extends "templates/base.html.j2" %} -{% block main %} -
-

{{ gettext("Step 1: Install the Taler wallet") }}

-

- {{ - gettext('Install the wallet from the installation page.').format(link="https://wallet.taler.net/") + "
" + - gettext('Installation only takes one click.') - }} -

-

- {{ gettext('After installation, you may be asked to grant the browser-based Taler wallet additional optional permissions that allow it to improve your user experience.') }}
- {{ gettext('These permissions will allow the wallet to automatically open if a page asks for a Taler payment.') }}
- {{ gettext('Regardless of the permissions you grant, the wallet will never transmit information about you or your browsing history to anyone.') }} -

-
- -
-

{{ gettext("Step 2: Withdraw coins") }}

-

- {{ - gettext('In this demo you are paying with {currency}, an imaginary currency.').format(currency=merchant_currency) + "
" + - gettext('To withdraw {currency} coins you must first create an account at our bank.').format(currency=merchant_currency,bank=bank_url) + "
" + - gettext('Signing up only requires you to pick a username and password.') + "
" + - gettext('When you create an account at our bank, you will be credited 100 {currency} for signing up.').format(currency=merchant_currency) + "
" + - gettext("Afterwards, use the bank's Web interface to authorize the transfer of {currency} to your wallet.").format(currency=merchant_currency) - }} -

-

- {{ gettext('Once you have completed this step, you can click on the Taler icon in your browser to check your balance.') }} -

-
- -
-

{{ gettext("Step 3: Pay") }}

-

- {{ - gettext("We have two demo merchants where you can spend your coins:") - }} -

- -
-
-

{{ gettext("Step 4: Check money flow") }}

-

- {{ - gettext('You can see the wire transfers from the escrow account of the exchange to the merchants on the public accounts page of the bank.').format(bank=bank_url) + "
" + - gettext('Note that only accounts configured to be publicly viewable are shown on that page.') - }} -

-
-
-

{{ gettext("Step 5: Survey") }}

-

- {{ - gettext("Websites can give tips to visitors for completing tasks.") + "
" + - gettext('You can earn some {currency} coins by filling in our survey.').format(url=merchant_survey_url,currency=merchant_currency) - }} -

-
- -
-

{{ gettext("Step 6: Reach out to us") }}

-

- {{ - gettext("We appreciate feedback about Taler and this demonstrator.") + "
" + - gettext('Let us know what you think by contacting us.').format(link="mailto:demo-feedback@taler.net") - }} -

-
-{% endblock %} diff --git a/talermerchantdemos/landing/templates/language-switcher.html.j2 b/talermerchantdemos/landing/templates/language-switcher.html.j2 deleted file mode 120000 index 6423c5c..0000000 --- a/talermerchantdemos/landing/templates/language-switcher.html.j2 +++ /dev/null @@ -1 +0,0 @@ -../../templates/language-switcher.html.j2 \ No newline at end of file diff --git a/talermerchantdemos/landing/templates/menu.html.j2 b/talermerchantdemos/landing/templates/menu.html.j2 deleted file mode 120000 index b9575ea..0000000 --- a/talermerchantdemos/landing/templates/menu.html.j2 +++ /dev/null @@ -1 +0,0 @@ -../../templates/menu.html.j2 \ No newline at end of file diff --git a/talermerchantdemos/landing/translations b/talermerchantdemos/landing/translations deleted file mode 120000 index 0a951f7..0000000 --- a/talermerchantdemos/landing/translations +++ /dev/null @@ -1 +0,0 @@ -../../translations/ \ No newline at end of file -- cgit v1.2.3