From a93f135de141a3b9ee5d4c15dbb570e4a05b96ea Mon Sep 17 00:00:00 2001 From: yomguy Date: Sat, 15 Dec 2012 23:13:37 +0100 Subject: [PATCH] submit answer if min nb of chars reached --- teleforma/locale/fr/LC_MESSAGES/django.mo | Bin 10031 -> 10311 bytes teleforma/locale/fr/LC_MESSAGES/django.po | 29 +++++++++++++----- teleforma/locale/fr/LC_MESSAGES/djangojs.mo | Bin 587 -> 754 bytes teleforma/locale/fr/LC_MESSAGES/djangojs.po | 6 ++++ teleforma/static/teleforma/js/charCount.js | 2 +- .../templates/teleforma/answer_form.html | 27 +++++++++++----- teleforma/templates/teleforma/seminars.html | 2 -- teleforma/views/pro.py | 6 ++-- 8 files changed, 51 insertions(+), 21 deletions(-) diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index 9f1e6508ea43f26a9a4a61286264b68d1a4b97c3..bb0049f10b8eb5332eea40671e2d075ce6061aac 100644 GIT binary patch delta 4613 zcmaLZdvH|c9merD31p!u1Za>z5?sg)4G>HU4U|eW6axr?lmto)#$*FqNS5v;kx*T$ z+(Z;L4N?U~B?^jY4Ty+>CTh?@+bY;8y%^hRVH8ECEp2CT?DyIIrJeqvXXfGazVA8b zy`6J5JUh30Ui6Pc`m{NYw@4gNDzB8O1}ziRd4n8f(**A%q!lc)*&$u9T=*=6@RYUT;-ug<5U>giU` zLtR&h+KE!sg03;=qb9rrb$>l-A_0sJq_D;sHrWMRF_HF1to<=---lZ1L8~7{-G2<3 zqx%h};m6kgC2FDrY19s6;!GTcn!t)Qp1(S5ra?1~ns=gR+=@E?FzSXUP%C^MwUR@~ zV|SgX9XNsN=P!2toYnt@nn2>vcz+%}9CYK05z{35H@pmwev^%4iM5}QyHj=oEwfWigT0Hf36D;aN}{L^ z)}y|T`>nkVwX*G~--BJKcWA$ze+@O^W2pW*EtHR0)~erKclTWII&t-TRr-~Y`N^ei`^W_B;?QEWv%Vb^Zw z51}T|iMp=a>h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 zl{M;_vjsX(M|7f{(T@A0{R~C#zXF@!SoHph=)|U>*U!NM%-l}Fl`cgmusZ7N&>J_S z&uk}p<4b7AhtUbVf!=o#?dRX<1inPC`x+fMuOfGU3$(o*@>`Qhr4;gL@H?R4;DeBE zi^_fYJlPp_d4(Jx6RdEoBtIu^Z6RqmmQc8dyhKJeG=_6?yz|Q2yu@yH(*|+fq@_TpS4hr2!FXFK* zM_P^B$+c0x3`@zHs7nDEMJAFfh{x}8WdH8r?-;V4+)r*MesnziTFgFyT3A31lN$0I z*+;gJC&)3PQvI9=-u(x3`$zNLNwuBbS diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index 39d62a26..e1424963 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-12-14 15:09+0100\n" +"POT-Creation-Date: 2012-12-15 23:08+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Guillaume Pellerin \n" "Language-Team: LANGUAGE \n" @@ -736,15 +736,23 @@ msgstr "" msgid "Write" msgstr "" -#: templates/teleforma/answer_form.html:21 +#: templates/teleforma/answer_form.html:46 msgid "Answer to the following question" -msgstr "Réalisez les consultations fictives suivantes" +msgstr "Réalisez la consultation fictive suivante" -#: templates/teleforma/answer_form.html:35 +#: templates/teleforma/answer_form.html:46 +msgid "with" +msgstr "en" + +#: templates/teleforma/answer_form.html:46 +msgid "words" +msgstr "mots" + +#: templates/teleforma/answer_form.html:60 msgid "Save" msgstr "" -#: templates/teleforma/answer_form.html:39 +#: templates/teleforma/answer_form.html:63 msgid "Submit it" msgstr "Soumettre" @@ -1341,15 +1349,20 @@ msgstr "" "Merci de vous connecter ou bien contactez l'administateur du site pour " "obtenir un accès privé." +#: views/pro.py:212 +msgid "You have successfully saved your answer" +msgstr "Vous avez enregistré votre reponse avec succès" + +#: views/pro.py:214 +msgid "You have successfully submitted your answer" +msgstr "Vous avez soumis votre reponse avec succès" + #~ msgid "Respond to the following question" #~ msgstr "Réalisez la consultation fictive suivante" #~ msgid "Respond to the following questions" #~ msgstr "Réalisez les consultations fictives suivantes" -#~ msgid "keywords" -#~ msgstr "mots clés" - #~ msgid "testimonial template" #~ msgstr "modèlé d'attestation" diff --git a/teleforma/locale/fr/LC_MESSAGES/djangojs.mo b/teleforma/locale/fr/LC_MESSAGES/djangojs.mo index 47f1e117e7faf4195896899aafc665d1360fa18a..19382a43a7f92e2dce215308a6426e501eac6024 100644 GIT binary patch delta 280 zcmX@j@`<(no)F7a1|VPsVi_QI0b+I_&H-W&=m26aAnpWWkeVq#tOLZefY=a-j{|WT zBLl-vAk7WL1xySKY(TmONLv8uW*}_}r1t=6pfWIE29iK72#A0UWdSjrGZKpulS@*I ziYF$R7)0imD&&?HmnamaCMIVnlw_m=S%syUMX4zYd8N5YsYMF;X$r}3JsT%gGIBeE zO*p)wD7APp7n7q|Sbk}-LP}~`YL!A_Nl9vEUP@7_LQbkeUVd&8kd>0Ekc`j)F~3-k F0RRsbKn?%^ delta 112 zcmeywdYUESo)F7a1|VPtVi_Pd0b*7l_5orLNC09GKM{y^fH)n9%NQ9LrT}R+Am(Ob fV6XtvLO>cQ3<'+ options.counterElement +' class="' + options.css + '">'+ options.counterText +''); + $(this).after('<'+ options.counterElement +' id="counter" class="' + options.css + '">'+ options.counterText +''); calculate(this); $(this).keyup(function(){calculate(this)}); $(this).change(function(){calculate(this)}); diff --git a/teleforma/templates/teleforma/answer_form.html b/teleforma/templates/teleforma/answer_form.html index 74129759..9b9d5ee4 100644 --- a/teleforma/templates/teleforma/answer_form.html +++ b/teleforma/templates/teleforma/answer_form.html @@ -8,7 +8,7 @@ $(document).ready(function(){ $('#id_answer').live("paste",function(e) { e.preventDefault(); - new Messi(gettext('Sorry, it is not allowed to paste text here.'), {buttons: [{id: 0, label: gettext('Close'), val: 'X'}], modal: true}); + new Messi(gettext('Sorry, it is not allowed to paste text here.'), {buttons: [{id: 0, label: gettext('OK'), val: 'X'}], modal: true}); }); }); @@ -16,11 +16,25 @@ $(document).ready(function(){ //default usage $("#id_answer").charCount({ necessary: {{question.min_nchar}}, - counterText: gettext('Characters ')+' : ', + counterText: gettext('Characters')+' : ', }); }); +$(document).ready(function(){ + var b = $('#submit_button'); + var c = $('#counter') + b.unbind('click').click(function() { + if (c.hasClass('deceed')){ + new Messi(gettext('You must reach the required number of characters.'), {buttons: [{id: 0, label: gettext('OK'), val: 'X'}], modal: true}); + } + if (c.hasClass('exceed')){ + $('#id_status').value=3; + $('#_AnswerForm').submit(); + } + }); + }); + {% endblock extra_javascript %} @@ -29,7 +43,7 @@ $(document).ready(function(){
-

{% trans "Answer to the following question" %}

+

{% trans "Answer to the following question" %} {% trans "with" %} {{question.min_nchar}} {% trans "words" %}

{{ question.question|safe }} @@ -43,11 +57,10 @@ $(document).ready(function(){
{% trans "Save" %} + onclick="document.getElementById('_AnswerForm').submit();">{% trans "Save" %} -{% trans "Submit it" %} +{% trans "Submit it" %} {% endblock course_content %} diff --git a/teleforma/templates/teleforma/seminars.html b/teleforma/templates/teleforma/seminars.html index 3fcf155f..948abe5a 100644 --- a/teleforma/templates/teleforma/seminars.html +++ b/teleforma/templates/teleforma/seminars.html @@ -116,8 +116,6 @@ server_status_callback(); {% endif %} {% endblock status %} - -
{% endblock content %} diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index 503aaa2e..9fa958cd 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -34,7 +34,7 @@ from teleforma.views.core import * - +from django.utils.translation import ugettext_lazy as _ def get_seminars(user): seminars = [] @@ -209,9 +209,9 @@ class AnswerView(FormView): answer.question = self.question answer.save() if answer.status <= 2: - messages.info(self.request, "You have successfully saved your answer") + messages.info(self.request, _("You have successfully saved your answer")) elif answer.status == 3: - messages.info(self.request, "You have successfully submitted your answer") + messages.info(self.request, _("You have successfully submitted your answer")) return super(AnswerView, self).form_valid(form) def form_invalid(self, form): -- 2.39.5