From: Florent Bruneau Date: Sun, 9 Jan 2011 16:00:31 +0000 (+0100) Subject: Bases of survey edition interface. X-Git-Tag: xorg/1.1.0~203 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=4700140294aec48d7d02a3bd142e872b91c60f8b;p=platal.git Bases of survey edition interface. Signed-off-by: Florent Bruneau --- diff --git a/htdocs/javascript/survey.js b/htdocs/javascript/survey.js index fb944cd..15ae19e 100644 --- a/htdocs/javascript/survey.js +++ b/htdocs/javascript/survey.js @@ -20,11 +20,26 @@ (function($) { $.fn.extend({ - surveyQuestions: function(questions) { + showQuestions: function(questions) { var data = $('#question_base').tmpl(questions); this.children().remove(); data.appendTo(this); return this; + }, + + addQuestion: function(id) { + var question = $("#q_edit_new").tmpl([{ qid: id } ]); + question + .children('select') + .change(function () { + var type = $(this).val(); + var form = question.children('.q_edit_form'); + form.empty(); + $("#q_edit_base").tmpl([ { qid: id, type: type } ]).appendTo(form); + return true; + }); + question.appendTo(this); + return this; } }); })(jQuery); diff --git a/templates/survey/edit.questions.tpl b/templates/survey/edit.questions.tpl new file mode 100644 index 0000000..f938971 --- /dev/null +++ b/templates/survey/edit.questions.tpl @@ -0,0 +1,57 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2011 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +{literal} + + + + + + + +{/literal} + +{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *} diff --git a/templates/survey/edit.tpl b/templates/survey/edit.tpl index 6a2d274..04de2a0 100644 --- a/templates/survey/edit.tpl +++ b/templates/survey/edit.tpl @@ -32,10 +32,35 @@
- Déroulement du sondage + Paramètre du sondage Premier jour :
Dernier jour :
+ Sondage anonyme : Oui  +  Non
+ +

Questions

+ + + +
+ +
+ + +{include file="survey/vote.questions.tpl"} +{include file="survey/edit.questions.tpl"} + {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}