Created
March 28, 2014 22:43
-
-
Save lgvital/9844519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/template/tenxer/shared/macros/forms.html b/template/tenxer/shared/macros/forms.html | |
index 5e68dfb..5450da4 100644 | |
--- a/template/tenxer/shared/macros/forms.html | |
+++ b/template/tenxer/shared/macros/forms.html | |
@@ -201,14 +201,16 @@ | |
{{ option(field, attrs=attr, label=group.1) }} | |
{% else %} | |
<optgroup label="{{ group.0 }}"> | |
- {% for choice in group.1 %} | |
- {% if (fvalue|string == choice.0|string) or (fvalue is iterable and choice.0|string in fvalue|map('string')) %} | |
- {% set attr = {"selected":"selected","value": choice.0} %} | |
- {% else %} | |
- {% set attr = {"value": choice.0} %} | |
- {% endif %} | |
- {{ option(field, attrs=attr, label=choice.1) }} | |
- {% endfor %} | |
+ {% if group.1 %} | |
+ {% for choice in group.1 %} | |
+ {% if (fvalue|string == choice.0|string) or (fvalue is iterable and choice.0|string in fvalue|map('string')) %} | |
+ {% set attr = {"selected":"selected","value": choice.0} %} | |
+ {% else %} | |
+ {% set attr = {"value": choice.0} %} | |
+ {% endif %} | |
+ {{ option(field, attrs=attr, label=choice.1) }} | |
+ {% endfor %} | |
+ {% endif %} | |
</optgroup> | |
{% endif %} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment