From a7e8b34531aca9199ebe422aa5f65a4a52c10078 Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Fri, 2 Oct 2020 06:26:48 +0200 Subject: [PATCH] refactor: rename template more appropriately --- flaskr/controllers/main_controller.py | 2 +- flaskr/templates/estimation-request.html | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ flaskr/templates/request-estimation.html | 258 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3 files changed, 259 insertions(+), 259 deletions(-) create mode 100644 flaskr/templates/estimation-request.html delete mode 100644 flaskr/templates/request-estimation.html diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index 1dd7f69..cbee269 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -174,7 +174,7 @@ def estimate(): # register new estimation request, more accurately form = EstimateForm() def show_form(): - return render_template("request-estimation.html", form=form, models=models) + return render_template("estimation-request.html", form=form, models=models) if form.validate_on_submit(): diff --git a/flaskr/templates/estimation-request.html b/flaskr/templates/estimation-request.html new file mode 100644 index 0000000..3284e4e --- /dev/null +++ b/flaskr/templates/estimation-request.html @@ -0,0 +1,258 @@ +{% extends "base.html" %} + + +{% block title %}Request an estimation of your travel footprint{% endblock %} + + +{% block hero %} +
+

{{ content.estimate.hero.title | safe }}

+ {{ content.estimate.hero.description | markdown | safe }} +
+{% endblock %} + + + +{#############################################################################} +{# MACROS ####################################################################} + + +{% macro render_field(field) %} +
+ {{ field.label }} + {% if not field.flags.optional %} + * + {% endif %} +
+
+ {{ field(title=field.description, class_="form-control", **kwargs) | safe }} + + {% if field.errors -%} + + {%- endif %} +
+{% endmacro %} + + +{% macro render_checkbox(field) %} +{{ field(class="form-check-input") }} +{{ field.label( + class="form-check-label", + title=field.description +) }} + +{% if field.errors -%} +

{{ field.errors[0] | safe }}

+{%- endif %} +{% endmacro %} + + + +{#############################################################################} +{# BODY ######################################################################} + + +{% block body %} +
+
+
+
+ {{ form.hidden_tag() }} + +{#
#} +{# {{ render_field(form.email) }}#} +{# We will never share your email with anyone.#} +{#
#} +
+
+ {{ render_field(form.first_name) }} + {{ content.estimate.help.first_name | safe }} +
+
+ {{ render_field(form.last_name) }} + {{ content.estimate.help.last_name | safe }} +
+
+
+ {{ render_field(form.institution) }} +
+ +
+
+
+ {{ render_field(form.origin_addresses) }} + + {{ content.estimate.help.origin_addresses | markdown | safe }} + +
+
+
+
+
+ OR +
+
+
+ {{ render_field(form.origin_addresses_file) }} + + {{ content.estimate.help.origin_addresses_file | markdown | safe }} + +
+
+
+ +
+
+
+ {{ render_field(form.destination_addresses) }} + + {{ content.estimate.help.destination_addresses | markdown | safe }} + +
+
+
+
+
+ OR +
+
+
+ {{ render_field(form.destination_addresses_file) }} + + {{ content.estimate.help.destination_addresses_file | markdown | safe }} + +
+
+
+ +{#
#} +{# {{ render_checkbox(form.compute_optimal_destination) }}#} +{#
#} +{#
#} +{# {{ render_checkbox(form.use_atmosfair_rfi) }}#} +{# Disabled. Work in Progress. RFI=1.9#} +{#
#} + +
+
Emission Models to consider
+
+ {% for model in models %} +
+ {{ render_checkbox(form['use_model_'~model.slug]) }} +
+ {% endfor %} +
+ + We will use a mean of the selected models. +   + Please select at least one. +
+ The meaning of RFI + is detailed + here + . +
+
+ +
+ {{ render_field(form.use_train_below_km) }} + + {{ content.estimate.help.use_train_below_km | safe }} + +
+ +
+ {{ render_field(form.comment) }} +
+ +
+ +
+ {{ render_field(form.run_name) }} + {{ content.estimate.help.run_name | safe }} +
+ +
+
+ {{ form.captcha.label }} + * +
+
+ {{ captcha() }} +

+ + {{ form.captcha( + title=form.captcha.description, + class_="form-control", + placeholder="Please write the numbers you see in the image above." + ) | safe }} + + {% if form.captcha.errors -%} +
    + {% for error in form.captcha.errors %} +
  • {{ error }}
  • + {% endfor %} +
+ {%- endif %} +
+
+ + +
+
+
+
+{% endblock %} + +{% block js %} + +{% endblock %} diff --git a/flaskr/templates/request-estimation.html b/flaskr/templates/request-estimation.html deleted file mode 100644 index 3284e4e..0000000 --- a/flaskr/templates/request-estimation.html +++ /dev/null @@ -1,258 +0,0 @@ -{% extends "base.html" %} - - -{% block title %}Request an estimation of your travel footprint{% endblock %} - - -{% block hero %} -
-

{{ content.estimate.hero.title | safe }}

- {{ content.estimate.hero.description | markdown | safe }} -
-{% endblock %} - - - -{#############################################################################} -{# MACROS ####################################################################} - - -{% macro render_field(field) %} -
- {{ field.label }} - {% if not field.flags.optional %} - * - {% endif %} -
-
- {{ field(title=field.description, class_="form-control", **kwargs) | safe }} - - {% if field.errors -%} - - {%- endif %} -
-{% endmacro %} - - -{% macro render_checkbox(field) %} -{{ field(class="form-check-input") }} -{{ field.label( - class="form-check-label", - title=field.description -) }} - -{% if field.errors -%} -

{{ field.errors[0] | safe }}

-{%- endif %} -{% endmacro %} - - - -{#############################################################################} -{# BODY ######################################################################} - - -{% block body %} -
-
-
-
- {{ form.hidden_tag() }} - -{#
#} -{# {{ render_field(form.email) }}#} -{# We will never share your email with anyone.#} -{#
#} -
-
- {{ render_field(form.first_name) }} - {{ content.estimate.help.first_name | safe }} -
-
- {{ render_field(form.last_name) }} - {{ content.estimate.help.last_name | safe }} -
-
-
- {{ render_field(form.institution) }} -
- -
-
-
- {{ render_field(form.origin_addresses) }} - - {{ content.estimate.help.origin_addresses | markdown | safe }} - -
-
-
-
-
- OR -
-
-
- {{ render_field(form.origin_addresses_file) }} - - {{ content.estimate.help.origin_addresses_file | markdown | safe }} - -
-
-
- -
-
-
- {{ render_field(form.destination_addresses) }} - - {{ content.estimate.help.destination_addresses | markdown | safe }} - -
-
-
-
-
- OR -
-
-
- {{ render_field(form.destination_addresses_file) }} - - {{ content.estimate.help.destination_addresses_file | markdown | safe }} - -
-
-
- -{#
#} -{# {{ render_checkbox(form.compute_optimal_destination) }}#} -{#
#} -{#
#} -{# {{ render_checkbox(form.use_atmosfair_rfi) }}#} -{# Disabled. Work in Progress. RFI=1.9#} -{#
#} - -
-
Emission Models to consider
-
- {% for model in models %} -
- {{ render_checkbox(form['use_model_'~model.slug]) }} -
- {% endfor %} -
- - We will use a mean of the selected models. -   - Please select at least one. -
- The meaning of RFI - is detailed - here - . -
-
- -
- {{ render_field(form.use_train_below_km) }} - - {{ content.estimate.help.use_train_below_km | safe }} - -
- -
- {{ render_field(form.comment) }} -
- -
- -
- {{ render_field(form.run_name) }} - {{ content.estimate.help.run_name | safe }} -
- -
-
- {{ form.captcha.label }} - * -
-
- {{ captcha() }} -

- - {{ form.captcha( - title=form.captcha.description, - class_="form-control", - placeholder="Please write the numbers you see in the image above." - ) | safe }} - - {% if form.captcha.errors -%} -
    - {% for error in form.captcha.errors %} -
  • {{ error }}
  • - {% endfor %} -
- {%- endif %} -
-
- - -
-
-
-
-{% endblock %} - -{% block js %} - -{% endblock %} -- libgit2 0.21.2