-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for css_classes in FormCheckBox
Had to go the `template` field route so the css_classes value can be accessed in the template properly
- Loading branch information
Showing
3 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
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
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
24 changes: 13 additions & 11 deletions
24
python/nav/web/templates/custom_crispy_templates/form_checkbox.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
<div id="div_{{ field.auto_id }}" class="ctrlHolder{% if field.errors %} error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}"> | ||
<label for="{{ field.id_for_label }}"> | ||
{{ field.label}}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} | ||
{{ field }} | ||
</label> | ||
{% for error in field.errors %} | ||
<small id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="errorField"> | ||
{{ error }} | ||
</small> | ||
{% endfor %} | ||
</div> | ||
{% with input=field.field %} | ||
<div id="div_{{ input.auto_id }}" class="ctrlHolder{% if input.errors %} error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}"> | ||
<label for="{{ input.id_for_label }}"> | ||
{{ input.label}}{% if input.field.required %}<span class="asteriskField">*</span>{% endif %} | ||
{{ input }} | ||
</label> | ||
{% for error in input.errors %} | ||
<small id="error_{{ forloop.counter }}_{{ input.auto_id }}" class="errorField"> | ||
{{ error }} | ||
</small> | ||
{% endfor %} | ||
</div> | ||
{% endwith %} |