PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/mod_survey/templates/_survey_question_matching.tpl

https://code.google.com/p/zotonic/
Smarty Template | 29 lines | 29 code | 0 blank | 0 comment | 6 complexity | 4bf3326d9d4c19718d4ac50c877468f3 MD5 | raw file
 1{% if question.question %}
 2<p>{{ question.question|escape }}</p>
 3{% endif %}
 4{% with question.parts.options|randomize as options %}
 5{% with question.parts.items as items %}
 6	<ul class="matching">
 7	{% for n in items %}
 8		{% with forloop.counter as index %}
 9			<li>
10				<label>
11					{{ n }}
12				</label>
13				{% with [name, "_", index|make_list]|join as nm %}
14				{% with answers[nm] as ans %}
15				<select id="{{ #match.index }}" name="{{ nm }}">
16					<option></option>
17					{% for opt in options %}
18						<option {% if ans == opt %}selected="selected" {% endif %}>{{ opt }}</option>
19					{% endfor %}
20				</select>
21				{% if question.is_required %}{% validate id=#match.index name=nm type={presence} %}{% endif %}
22				{% endwith %}
23				{% endwith %}
24			</li>
25		{% endwith %}
26	{% endfor %}
27	</ul>
28{% endwith %}
29{% endwith %}