From 3a4282fd75e3b3317b2b08b4aa2e6ac154310e73 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Fri, 7 Jul 2017 00:06:56 +0200 Subject: Absolute imports & some other improvements (#243) * Use absolute imports and rename package to ihatemoney * Add a ihatemoney command * Factorize application creation logic * Refactor the tests * Update the wsgi.py module with the new create_app() function * Fix some styling thanks to Flake8. * Automate Flake8 check in the CI. --- ihatemoney/templates/forms.html | 168 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 ihatemoney/templates/forms.html (limited to 'ihatemoney/templates/forms.html') diff --git a/ihatemoney/templates/forms.html b/ihatemoney/templates/forms.html new file mode 100644 index 0000000..ffdd165 --- /dev/null +++ b/ihatemoney/templates/forms.html @@ -0,0 +1,168 @@ +{% macro input(field, multiple=False, class='form-control', inline=False) -%} +
+ {% if field.type != "SubmitField" %} + {% if inline %} + {{ field.label(class="col-3") }} + {% else %} + {{ field.label() }} + {% endif %} + {% endif %} +
+ {% if multiple == True %} + {{ field(multiple=True, class=class) }} + {% else %} + {{ field(class=class) | safe }} + {% endif %} + {% if field.description %} +

{{ field.description }}

+ {% endif %} +
+
+{% endmacro %} + +{% macro submit(field, cancel=False, home=False) -%} +
+ + {% if home %} + {{ _("Can't remember the password?") }} + {% endif %} + {% if cancel %} + + {% endif %} +
+{% endmacro %} + +{% macro authenticate(form, home=False) %} + + {% include "display_errors.html" %} + + {{ form.hidden_tag() }} + {{ input(form.id) }} + {{ input(form.password) }} + {% if not home %} + {{ submit(form.submit, home=True) }} + {% endif %} + +{% endmacro %} + +{% macro admin(form) %} + + {% include "display_errors.html" %} + + {{ form.hidden_tag() }} + {{ input(form.admin_password) }} + {{ submit(form.submit) }} + +{% endmacro %} + +{% macro create_project(form, home=False) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {% if not home %} + {{ input(form.id) }} + {% endif %} + {{ input(form.name) }} + {{ input(form.password) }} + {{ input(form.contact_email) }} + {% if not home %} + {{ submit(form.submit, home=True) }} + {% endif %} + +{% endmacro %} + +{% macro edit_project(form) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.name) }} + {{ input(form.password) }} + {{ input(form.contact_email) }} +
+ + {{ _("delete") }} +
+ +{% endmacro %} + +{% macro add_bill(form, edit=False, title=True) %} + +
+ {% if title %}{% if edit %}{{ _("Edit this bill") }} {% else %}{{ _("Add a bill") }} {% endif %}{% endif %} + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.date, class="form-control datepicker", inline=True) }} + {{ input(form.what, inline=True) }} + {{ input(form.payer, inline=True, class="form-control custom-select") }} + {{ input(form.amount, inline=True) }} + +
+ +
+ +
+
+
+
+ {{ form.submit(class="btn btn-primary") }} + {% if not edit %} {{ form.submit2(class="btn") }}{% endif %} +
+ +{% endmacro %} + +{% macro add_member(form) %} +{{ form.hidden_tag() }} +
+ + {{ form.name(placeholder=_("Type user name here"), class="form-control") }} + +
+{% endmacro %} + +{% macro edit_member(form, title=True) %} +
+ {% if title %}{{ _("Edit this member") }}{% endif %} + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.name) }} + {{ input(form.weight) }} +
+
+ {{ form.submit(class="btn btn-primary") }} +
+{% endmacro %} + + +{% macro invites(form) %} + {{ form.hidden_tag() }} + {{ input(form.emails) }} +
+ + {{ _("No, thanks") }} +
+{% endmacro %} + +{% macro export_project(form) %} +
+ {{ form.hidden_tag() }} + {{ input(form.export_type) }} + {{ input(form.export_format) }} +
+
+ +
+{% endmacro %} + +{% macro remind_password(form) %} + + {% include "display_errors.html" %} + {{ form.hidden_tag() }} + {{ input(form.id) }} + {{ submit(form.submit) }} + +{% endmacro %} -- cgit v1.1