update vertical and inline layouts for radio choices

This commit is contained in:
Aider Ibragimov 2015-03-07 07:17:22 +03:00
parent fdd811ec53
commit 7159b31023
3 changed files with 31 additions and 2 deletions

View File

@ -1,4 +1,5 @@
{% load i18n %}
{% trans "None" as none_choice %}
<div class="form-group">
{% if field.label %}
@ -9,7 +10,7 @@
{% if field.allow_null or field.allow_blank %}
<label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{% trans "None" %}
{{ none_choice }}
</label>
{% endif %}
{% for key, text in field.choices.items %}
@ -23,7 +24,7 @@
<div class="radio">
<label>
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{% trans "None" %}
{{ none_choice }}
</label>
</div>
{% endif %}

View File

@ -1,7 +1,18 @@
{% load i18n %}
{% trans "None" as none_choice %}
<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
{% if field.allow_null or field.allow_blank %}
<div class="radio">
<label>
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %}>
{{ none_choice }}
</label>
</div>
{% endif %}
{% for key, text in field.choices.items %}
<div class="radio">
<label>

View File

@ -1,9 +1,18 @@
{% load i18n %}
{% trans "None" as none_choice %}
<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %}
{% if style.inline %}
<div>
{% if field.allow_null or field.allow_blank %}
<label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{{ none_choice }}
</label>
{% endif %}
{% for key, text in field.choices.items %}
<label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}>
@ -12,6 +21,14 @@
{% endfor %}
</div>
{% else %}
{% if field.allow_null or field.allow_blank %}
<div class="radio">
<label>
<input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} />
{{ none_choice }}
</label>
</div>
{% endif %}
{% for key, text in field.choices.items %}
<div class="radio">
<label>