comparison default/input/xmlui.html @ 55:d58fdd57df49

input/xmlui: fixed for_name in labels + selection in listWidget
author Goffi <goffi@goffi.org>
date Sun, 05 Nov 2017 21:50:45 +0100
parents dfef430a26ef
children 4347910cc594
comparison
equal deleted inserted replaced
54:a5dc14675d5e 55:d58fdd57df49
132 {% endmacro%} 132 {% endmacro%}
133 133
134 {% macro label_widget(wid, config, for=none) %} 134 {% macro label_widget(wid, config, for=none) %}
135 {% if config.form %} 135 {% if config.form %}
136 <label class="xmlui_widget xmlui_label" {{ {'for':for}|xmlattr }}> 136 <label class="xmlui_widget xmlui_label" {{ {'for':for}|xmlattr }}>
137 {{wid|item_filter(config.filter)}} 137 {{wid|item_filter(config.filters)}}
138 </label> 138 </label>
139 {% else %} 139 {% else %}
140 <span class="xmlui_widget xmlui_label" {{ {'id':none if not for else 'label_%s'|format(for)}|xmlattr }}>{{wid|item_filter(config.filters)}}</span> 140 <span class="xmlui_widget xmlui_label" {{ {'id':none if not for else 'label_%s'|format(for)}|xmlattr }}>{{wid|item_filter(config.filters)}}</span>
141 {% endif %} 141 {% endif %}
142 {% endmacro%} 142 {% endmacro%}
165 165
166 {% macro list_widget(wid, config, id=none) %} 166 {% macro list_widget(wid, config, id=none) %}
167 {% if config.form %} 167 {% if config.form %}
168 <select class="xmlui_widget xmlui_list" {{ {'name':wid.name, 'id':id}|xmlattr }}> 168 <select class="xmlui_widget xmlui_list" {{ {'name':wid.name, 'id':id}|xmlattr }}>
169 {% for value,label in wid.options %} 169 {% for value,label in wid.options %}
170 <option {{ {'value':value}|xmlattr }} {{ 'selected' if value == wid.selected }}> 170 <option {{ {'value':value}|xmlattr }} {{ 'selected' if value in wid.selected }}>
171 {{- label -}} 171 {{- label -}}
172 </option> 172 </option>
173 {% endfor %} 173 {% endfor %}
174 </select> 174 </select>
175 {% else %} 175 {% else %}