]> git.parisson.com Git - teleforma.git/commitdiff
submit answer if min nb of chars reached
authoryomguy <yomguy@parisson.com>
Sat, 15 Dec 2012 22:13:37 +0000 (23:13 +0100)
committeryomguy <yomguy@parisson.com>
Sat, 15 Dec 2012 22:13:37 +0000 (23:13 +0100)
teleforma/locale/fr/LC_MESSAGES/django.mo
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/locale/fr/LC_MESSAGES/djangojs.mo
teleforma/locale/fr/LC_MESSAGES/djangojs.po
teleforma/static/teleforma/js/charCount.js
teleforma/templates/teleforma/answer_form.html
teleforma/templates/teleforma/seminars.html
teleforma/views/pro.py

index 9f1e6508ea43f26a9a4a61286264b68d1a4b97c3..bb0049f10b8eb5332eea40671e2d075ce6061aac 100644 (file)
Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ
index 39d62a26f46e4131c16fd8ac4238c69a74291b75..e142496334c7649af0b3a39d7319ec8bbe4bcae8 100644 (file)
@@ -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 <yomguy@parisson.com>\n"
 "Language-Team: LANGUAGE <lists@parisson.com>\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"
 
index 47f1e117e7faf4195896899aafc665d1360fa18a..19382a43a7f92e2dce215308a6426e501eac6024 100644 (file)
Binary files a/teleforma/locale/fr/LC_MESSAGES/djangojs.mo and b/teleforma/locale/fr/LC_MESSAGES/djangojs.mo differ
index 42b3c9e7cce8bee3988543d44d023af370de1650..3437005f8ff577b167a18470f5f25550a48abc25 100644 (file)
@@ -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"
index 0afae0ecab7db96195f014549d57c42022183608..5cc239f222f6b823f063897213d2f71c477d6ce9 100644 (file)
@@ -45,7 +45,7 @@
                };
                                
                this.each(function() {                          
-                       $(this).after('</span><'+ options.counterElement +' class="' + options.css + '">'+ options.counterText +'</'+ options.counterElement +'>');
+                       $(this).after('<'+ options.counterElement +' id="counter" class="' + options.css + '">'+ options.counterText +'</'+ options.counterElement +'>');
                        calculate(this);
                        $(this).keyup(function(){calculate(this)});
                        $(this).change(function(){calculate(this)});
index 74129759644cac1689182e341361ba97210dbacf..9b9d5ee4eb0eb4cf9ceab8a0dac9a6e5ff017ab8 100644 (file)
@@ -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(); 
+            }
+          });
+        });
+
 </script>
 {% endblock extra_javascript %}
 
@@ -29,7 +43,7 @@ $(document).ready(function(){
 
 <div class="course_content">
   <div class="course_subtitle">
-   <h3><img src="{{ STATIC_URL }}telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Answer to the following question" %}</h3>
+   <h3><img src="{{ STATIC_URL }}telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Answer to the following question" %} {% trans "with" %} {{question.min_nchar}} {% trans "words" %}</h3>
   </div>
   <div style="text-align: justify;">
     {{ question.question|safe }}
@@ -43,11 +57,10 @@ $(document).ready(function(){
 
 <br />
 <a href="#" class="component_icon button icon_save"
-   onclick="document.getElementById('_AnswerForm').submit(); return false;">{% trans "Save" %}</a>
+   onclick="document.getElementById('_AnswerForm').submit();">{% trans "Save" %}</a>
 
-<a href="#" class="component_icon button icon_ok"
-   onclick="document.getElementById('id_status').value=3; 
- document.getElementById('_AnswerForm').submit(); return false;">{% trans "Submit it" %}</a>
+<a href="#" id="submit_button" class="component_icon button icon_ok"
+">{% trans "Submit it" %}</a>
 
 {% endblock course_content %}
 
index 3fcf155fe1f68b1531f214ca8e83b01addc5164e..948abe5a110d63c56a4c2bb6c23cf0d72e344d16 100644 (file)
@@ -116,8 +116,6 @@ server_status_callback();
 {% endif %}
 {% endblock status %}
 
-
-
 </div>
 
 {% endblock content %}
index 503aaa2e880057a8f1c01260895e0bf3b8811749..9fa958cd6f30baf90f983ade188088ee9691d7e9 100644 (file)
@@ -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):