Rewrite form generation.
[platal.git] / templates / survey / questions.tpl
similarity index 75%
rename from templates/survey/question.section.tpl
rename to templates/survey/questions.tpl
index cb4d2af..e7c8709 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
-<fieldset>
-  <legend>{$question->label}</legend>
+{literal}
+<script id="question_base" type="text/x-jquery-tmpl">
+  {{if type == 'text'}}
+    {{tmpl "#question_text"}}
+  {{else type == 'section'}}
+    {{tmpl "#question_section"}}
+  {{/if}}
+</script>
 
-{foreach from=$question->children item=child}
-  {include file=$child->voteTemplate() question=$child}
-{/foreach}
-</fieldset>
+<script id="question_section" type="text/x-jquery-tmpl">
+  <fieldset>
+    <legend>${label}</legend>
+
+    {{tmpl(children) "#question_base"}}
+  </fieldset>
+</script>
+
+<script id="question_text" type="text/x-jquery-tmpl">
+  <div>
+    <div>${label}</div>
+    <input type="text" name="qid[${qid}]" value="" />
+  </div>
+</script>
+{/literal}
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}