diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-12-22 22:29:30 +0000 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-12-22 22:29:30 +0000 |
| commit | 79f4e162863302cbcaa5ecc41347959d8c9218c1 (patch) | |
| tree | 9ca507b7608365fd78308a2dbd28c693ab05f41f /app/templates/macros/forms.html | |
| parent | 137a6928bcb247cf080012b20db05e0fd796a4a8 (diff) | |
| download | cheatdb-79f4e162863302cbcaa5ecc41347959d8c9218c1.tar.xz | |
Improve style of forms
Diffstat (limited to 'app/templates/macros/forms.html')
| -rw-r--r-- | app/templates/macros/forms.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/templates/macros/forms.html b/app/templates/macros/forms.html index e53beec..255a4ca 100644 --- a/app/templates/macros/forms.html +++ b/app/templates/macros/forms.html @@ -1,10 +1,10 @@ -{% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None) -%} +{% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None, fieldclass=None) -%} <div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}"> {% if field.type != 'HiddenField' and label_visible %} - {% if not label %}{% set label=field.label.text %}{% endif %} - <label for="{{ field.id }}">{{ label|safe }}</label> + {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} + {% if label %}<label for="{{ field.id }}">{{ label|safe }}</label>{% endif %} {% endif %} - {{ field(class_='form-control', **kwargs) }} + {{ field(class_=fieldclass or 'form-control', **kwargs) }} {% if field.errors %} {% for e in field.errors %} <p class="help-block">{{ e }}</p> @@ -124,9 +124,9 @@ {% macro render_radio_field(field) -%} {% for value, label, checked in field.iter_choices() %} - <div class="radio"> - <label> - <input type="radio" name="{{ field.id }}" id="{{ field.id }}" value="{{ value }}"{% if checked %} checked{% endif %}> + <div class="form-check my-1"> + <label class="form-check-label"> + <input class="form-check-input" type="radio" name="{{ field.id }}" id="{{ field.id }}" value="{{ value }}"{% if checked %} checked{% endif %}> {{ label }} </label> </div> |
