diff options
| author | rubenwardy <rw@rubenwardy.com> | 2020-07-10 20:47:03 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2020-07-10 20:47:03 +0100 |
| commit | 16b174d882fd115b62b484d20e1cbdbd457198a9 (patch) | |
| tree | b0e6444e31bc9ab9995eae570857533c9c5ef93e /app/templates/macros | |
| parent | 61e2c8a1c0bc65115500f106b2f47a97ff44e5dc (diff) | |
| download | cheatdb-16b174d882fd115b62b484d20e1cbdbd457198a9.tar.xz | |
Improve recommends styling on review edit form
Diffstat (limited to 'app/templates/macros')
| -rw-r--r-- | app/templates/macros/forms.html | 15 | ||||
| -rw-r--r-- | app/templates/macros/reviews.html | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/app/templates/macros/forms.html b/app/templates/macros/forms.html index 858e0d4..89525f9 100644 --- a/app/templates/macros/forms.html +++ b/app/templates/macros/forms.html @@ -133,6 +133,21 @@ {% endfor %} {%- endmacro %} +{% macro render_toggle_field(field, icons=[]) -%} +<div class="btn-group btn-group-toggle" data-toggle="buttons"> + {% for value, label, checked in field.iter_choices() %} + <label class="btn btn-primary"> + {% set icon = icons[value] %} + {% if icon %} + <i class="fas {{ icon }} mr-2"></i> + {% endif %} + <input type="radio" name="{{ field.id }}" id="{{ field.id }}" value="{{ value }}" autocomplete="off" {% if checked %} checked{% endif %}> + {{ label }} + </label> + {% endfor %} + </div> +{%- endmacro %} + {% macro render_submit_field(field, label=None, tabindex=None) -%} {% if not label %}{% set label=field.label.text %}{% endif %} {#<button type="submit" class="form-control btn btn-default btn-primary">{{label}}</button>#} diff --git a/app/templates/macros/reviews.html b/app/templates/macros/reviews.html index 642e086..1ab9de5 100644 --- a/app/templates/macros/reviews.html +++ b/app/templates/macros/reviews.html @@ -87,11 +87,11 @@ <div class="btn-group btn-group-toggle" data-toggle="buttons"> <label class="btn btn-primary"> <i class="fas fa-thumbs-up mr-2"></i> - <input type="radio" name="recommends" id="yes" autocomplete="off"> {{ _("Yes") }} + <input type="radio" name="recommends" value="yes" autocomplete="off"> {{ _("Yes") }} </label> <label class="btn btn-primary"> <i class="fas fa-thumbs-down mr-2"></i> - <input type="radio" name="recommends" id="no" autocomplete="off"> {{ _("No") }} + <input type="radio" name="recommends" value="no" autocomplete="off"> {{ _("No") }} </label> </div> |
