20 lines
971 B
HTML
20 lines
971 B
HTML
{# Auswahlliste fuer Textkanaele, gruppiert nach Kategorie #}
|
||
{% macro channel_select(name, channels, selected, types=("text", "news"), empty="– keiner –") %}
|
||
{% set cats = channels | selectattr("type", "equalto", "category") | list %}
|
||
<select name="{{ name }}">
|
||
<option value="">{{ empty }}</option>
|
||
{% for ch in channels if ch.type in types and not ch.category_id %}
|
||
<option value="{{ ch.id }}"{% if ch.id == selected %} selected{% endif %}># {{ ch.name }}</option>
|
||
{% endfor %}
|
||
{% for cat in cats %}
|
||
{% set inner = channels | selectattr("category_id", "equalto", cat.id) | selectattr("type", "in", types) | list %}
|
||
{% if inner %}
|
||
<optgroup label="{{ cat.name }}">
|
||
{% for ch in inner %}
|
||
<option value="{{ ch.id }}"{% if ch.id == selected %} selected{% endif %}># {{ ch.name }}</option>
|
||
{% endfor %}
|
||
</optgroup>
|
||
{% endif %}
|
||
{% endfor %}
|
||
</select>
|
||
{% endmacro %}
|