Improves usability.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 30 Jan 2011 14:45:16 +0000 (15:45 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 30 Jan 2011 14:45:16 +0000 (15:45 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
htdocs/javascript/survey.js
templates/survey/edit.questions.tpl
templates/survey/vote.questions.tpl

index 80614a9..19adaa7 100644 (file)
                 });
             if (type.val()) {
                 question.children('.q_edit_form')
-                        .bindQuestion(type.val(), q.qid, q.parameters)
+                        .bindQuestion(type.val(), q.qid, q)
             }
             this.childrenContainer().children('.add_question').before(question);
             $.renumberQuestions();
index 866607b..0c3fba9 100644 (file)
@@ -94,8 +94,8 @@
     <div>
       Ajouter une case Autre ?
       <select name="q_edit[${qid}][allow_other]">
-        <option value="1">Oui</option>
-        <option value="" selected="selected">Non</option>
+        <option value="1" {{if allow_other}}selected="selected"{{/if}}>Oui</option>
+        <option value="" {{if !allow_other}}selected="selected"{{/if}}>Non</option>
       </select>
     </div>
   </div>
index 0a1f74e..e8ca444 100644 (file)
 <script id="question_multiple" type="text/x-jquery-tmpl">
   <div>
     <div><strong>${label}</strong></div>
-    {{tmpl(answers) "#question_multiple_answer"}}
+    {{each answers}}
+      <input type="${subtype}" name="qid[${qid}][]" value="${$index}" /> ${$value}<br />
+    {{/each}}
+    {{if allow_other}}
+      <input type="${subtype}" name="qid[${qid}][other][checked]" value="1" /> Autre, prĂ©ciser&nbsp;:
+      <input type="text" name="qid[${qid}][other][text]" />
+    {{/if}}
   </div>
 </script>
-
-<script id="question_multiple_answer" type="text/x-jquery-tmpl">
-  <input type="checkbox" name="qid[${qid}][]" value="${$data}" /> ${$data} <br />
-</script>
 {/literal}
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}