Files
notifications-admin/app/templates/components/radios.html
Leo Hemsted 3c0f06a36d set value of radio input to be org id
also don't use nil, this isn't ruby
2016-08-15 10:39:34 +01:00

65 lines
1.8 KiB
HTML

{% macro radios(
field,
hint=None
) %}
<div class="form-group {% if field.errors %} error{% endif %}">
<fieldset>
<legend class="form-label">
{{ field.label }}
{% if field.errors %}
<span class="error-message">
{{ field.errors[0] }}
</span>
{% endif %}
</legend>
{% for option in field %}
<label class="block-label" for="{{ option.id }}">
{{ option }}
{{ option.label.text }}
</label>
{% endfor %}
</fieldset>
</div>
{% endmacro %}
{% macro branding_radios(
field,
hint=None,
branding_dict={}
) %}
<div class="form-group {% if field.errors %} error{% endif %}">
<fieldset>
<legend class="form-label">
{{ field.label }}
{% if field.errors %}
<span class="error-message">
{{ field.errors[0] }}
</span>
{% endif %}
</legend>
{% for value, option, checked in field.iter_choices() %}
<label class="block-label" for="{{ field.name }}-{{ loop.index }}">
<input
type="radio"
name="{{ field.name }}"
id="{{ field.name }}-{{ loop.index }}"
value="{{ value }}"
{% if checked %}checked="checked"{% endif %}
/>
{% if branding_dict.get(value, {}).get('colour') %}
<span style="background: {{ branding_dict[value].colour }}; display: inline-block; width: 3px; height: 27px"></span>
{% endif %}
{% if branding_dict.get(value, {}).get('logo') %}
<img
src="{{ branding_dict[value].logo }}"
height="27"
/>
{% endif %}
{{option}}
</label>
{% endfor %}
</fieldset>
</div>
{% endmacro %}