diff options
| author | Jocelyn Delalande <jocelyn@crapouillou.net> | 2017-02-01 19:41:55 +0100 |
|---|---|---|
| committer | Jocelyn Delalande <jocelyn@crapouillou.net> | 2017-02-04 00:41:05 +0100 |
| commit | 286213026982435e6e87cdbbd5dddcd80e925b91 (patch) | |
| tree | 0afd5f1693f69629b2a8fd45c82d81ef5a288852 /budget/templates/forms.html | |
| parent | 37da1db38ac17209f6ab6832a0bf5052ae81475b (diff) | |
| download | ihatemoney-mirror-286213026982435e6e87cdbbd5dddcd80e925b91.zip ihatemoney-mirror-286213026982435e6e87cdbbd5dddcd80e925b91.tar.gz ihatemoney-mirror-286213026982435e6e87cdbbd5dddcd80e925b91.tar.bz2 | |
Adapt to bootstrap 4 forms
- Adapt to BS4 class names and hierarchy
- Redesign some forms to have the label above the input (mobile-friendly)
- For the remaining inline form (add bill), use the grid, as BS no longer
provides inline form alignment helpers
Diffstat (limited to 'budget/templates/forms.html')
| -rw-r--r-- | budget/templates/forms.html | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/budget/templates/forms.html b/budget/templates/forms.html index 07e5b3d..cf599a9 100644 --- a/budget/templates/forms.html +++ b/budget/templates/forms.html @@ -1,9 +1,13 @@ -{% macro input(field, multiple=False, class=None) -%} - <div class="control-group"> +{% macro input(field, multiple=False, class='form-control', inline=False) -%} + <div class="form-group{% if inline %} row{% endif %}"> {% if field.type != "SubmitField" %} - {{ field.label(class="control-label") }} + {% if inline %} + {{ field.label(class="col-3") }} + {% else %} + {{ field.label() }} + {% endif %} {% endif %} - <div class="controls"> + <div class="controls{% if inline %} col-9{% endif %}"> {% if multiple == True %} {{ field(multiple=True, class=class) }} {% else %} @@ -77,11 +81,11 @@ {% if title %}<legend>{% if edit %}{{ _("Edit this bill") }} {% else %}{{ _("Add a bill") }} {% endif %}</legend>{% endif %} {% include "display_errors.html" %} {{ form.hidden_tag() }} - {{ input(form.date, class="datepicker") }} - {{ input(form.what) }} - {{ input(form.payer) }} - {{ input(form.amount) }} - {{ input(form.payed_for) }} + {{ 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) }} + {{ input(form.payed_for, inline=True, class="form-check-input") }} </fieldset> <div class="actions"> {{ form.submit(class="btn btn-primary") }} |
