From: yomguy Date: Sat, 15 Dec 2012 22:13:37 +0000 (+0100) Subject: submit answer if min nb of chars reached X-Git-Tag: 0.9-probarreau~251 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a93f135de141a3b9ee5d4c15dbb570e4a05b96ea;p=teleforma.git submit answer if min nb of chars reached --- diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index 9f1e6508..bb0049f1 100644 Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ 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 47f1e117..19382a43 100644 Binary files a/teleforma/locale/fr/LC_MESSAGES/djangojs.mo and b/teleforma/locale/fr/LC_MESSAGES/djangojs.mo differ diff --git a/teleforma/locale/fr/LC_MESSAGES/djangojs.po b/teleforma/locale/fr/LC_MESSAGES/djangojs.po index 42b3c9e7..3437005f 100644 --- a/teleforma/locale/fr/LC_MESSAGES/djangojs.po +++ b/teleforma/locale/fr/LC_MESSAGES/djangojs.po @@ -23,3 +23,9 @@ msgstr "Désolé, il n'est pas autorisé de coller un texte ici." msgid "Close" msgstr "Fermer" + +msgid "You must reach the required number of characters." +msgstr "Vous devez atteindre le nombre de caractères requis." + +msgid "Characters" +msgstr "Caractères" diff --git a/teleforma/static/teleforma/js/charCount.js b/teleforma/static/teleforma/js/charCount.js index 0afae0ec..5cc239f2 100644 --- a/teleforma/static/teleforma/js/charCount.js +++ b/teleforma/static/teleforma/js/charCount.js @@ -45,7 +45,7 @@ }; this.each(function() { - $(this).after('<'+ 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):