diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index 66f495f..cabef6d 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -28,7 +28,7 @@ from flaskr.core import ( get_emission_models, increment_hit_counter, ) -from flaskr.content import content +from flaskr.content import content, base_url from wtforms import validators @@ -51,7 +51,6 @@ OUT_ENCODING = 'utf-8' pi_email = "didier.barret@irap.omp.eu" # todo: move to content YAML or .env # pi_email = "goutte@protonmail.com" -base_url = "https://travel-footprint-calculator.irap.omp.eu/" # ----------------------------------------------------------------------------- @@ -243,7 +242,11 @@ def estimate(): # register new estimation request, more accurately send_email( to_recipient=pi_email, subject="[TCFM] New Estimation Request: %s" % estimation.public_id, - message="TODO" + message=render_template( + 'email/run_requested.html', + base_url=base_url, + estimation=estimation, + ) ) flash("Estimation request submitted successfully.", "success") diff --git a/flaskr/templates/email/run_requested.html b/flaskr/templates/email/run_requested.html new file mode 100644 index 0000000..0b865f1 --- /dev/null +++ b/flaskr/templates/email/run_requested.html @@ -0,0 +1,67 @@ +{% extends "email/base.html" %} + +{% block content %} +
+ The run
+{% if estimation.run_name %}
+ "{{ estimation.run_name }}"
+{% endif %}
+ {{ estimation.public_id }}
has been requested.
+
+ It will be
+ available here
+ when it's done.
+
+ Author + | +
+ {{ estimation.author_name }}+ |
+
+ {{ estimation.origins_count }} + Origin{% if estimation.origins_count > 1 %}s{% endif %} + | +
+ + +{{ estimation.origin_addresses | truncate(1024, true, '…') }} ++ |
+
+ {{ estimation.destinations_count }} + Destination{% if estimation.destinations_count > 1 %}s{% endif %} + | +
+ + +{{ estimation.destination_addresses | truncate(1024, true, '…') }} ++ |
+
+ Models + | +
+ + +{{ estimation.models_slugs }} ++ |
+