]> git.parisson.com Git - teleforma.git/commitdiff
add JS timers
authorGuillaume Pellerin <yomguy@parisson.com>
Sun, 20 Jul 2014 14:30:17 +0000 (16:30 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Sun, 20 Jul 2014 14:30:17 +0000 (16:30 +0200)
teleforma/models/pro.py
teleforma/templates/teleforma/answer_form.html
teleforma/templates/teleforma/seminar_detail.html
teleforma/views/pro.py

index e7fad46f4eafcb1f78db1edaaccff5da0de348f2..f571534cf7b415120ee7b9326030b130c9e8d336 100755 (executable)
@@ -315,7 +315,7 @@ class SeminarRevision(models.Model):
     date_modified  = models.DateTimeField(_('date modified'), blank=True, null=True)
 
     def __unicode__(self):
-        return ' - '.join([self.seminar.title, self.user.username, str(self.date)])
+        return ' - '.join([self.seminar.title, self.user.username, str(self.date), str(self.date_modified)])
 
     class Meta(MetaCore):
         db_table = app_label + '_' + 'seminar_revisions'
index d6c2d021f20b12b56df5af9c831bc66a5131f941..83d474e44a4188dd91d4219660b3c7edd185e0fd 100644 (file)
@@ -32,7 +32,6 @@ $(document).ready(function(){
           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')){
-            b1.unbind('click');
             $('#id_status').val("3");
             $('#_AnswerForm').submit();
         }
@@ -41,7 +40,6 @@ $(document).ready(function(){
     var b2 = $('#save_button');
     b2.unbind('click').click(function() {
       $(window).unbind('beforeunload');
-      b2.unbind('click');
       $('#_AnswerForm').submit();
     });
 
index bddca01fcb18fe5ef3b5fbe17ea06b69b144ce40..ab94a785b5509f1ebdd3f07eb6d65e3feee9f42f 100644 (file)
@@ -52,11 +52,25 @@ var seminarUtils = {
                 p.html('{% trans " rejected" %}')
                 });
          }
+        load : function(id, username){
+            json([id, username],'teleforma.seminar_load',function(){
+                return false
+                });
+         },
+
+        unload : function(id, username){
+            json([id, username],'teleforma.seminar_unload',function(){
+                return false
+                });
+         },
+
         }
 
 $(window).ready(function(){
-    var p = $('#publish');
     var f = seminarUtils;
+    f.load('{{seminar.id}}','{{user.username}}');
+
+    var p = $('#publish');
     p.unbind('click').click(function() {
         if (p.hasClass('icon_ok')){
             f.unpublish('{{seminar.id}}');
@@ -71,6 +85,11 @@ $(window).ready(function(){
 
     });
 
+$(window).unload(function(){
+    var f = seminarUtils;
+    f.unload('{{seminar.id}}','{{user.username}}');
+    });
+
 </script>
 {% endif %}
 
@@ -84,12 +103,12 @@ $(window).ready(function(){
     <div class="course">
 
         <div class="course_title">
-          
+
           <div style="float: right; font-size: 0.9em;">
             {% if seminar_progress == 100 and not user.is_staff %}
             <img src="{{ STATIC_URL }}telemeta/images/ok.png" title="{% trans "validated" %}" alt="{% trans "validated" %}"/>
             {% endif %}
-            
+
             {% if user.is_staff %}
             <a id="publish" href="#" class="{% if seminar.status == 2 %}component_icon button icon_ok{% else %}component_icon button icon_delete{% endif %}">{% if seminar.status == 2 %}{% trans " published" %}{% else %}{% trans " rejected" %}{% endif %}</a>
             {% endif %}
index 896a76b1cc1f429670e46eddaf305b8976e58d2e..6f95c07a1305f39b0130897a063a1e6131aca49e 100644 (file)
@@ -102,6 +102,7 @@ def set_revision(user, seminar):
         r = revisions[0]
         if not r.date_modified:
             r.date_modified = datetime.datetime.now()
+            r.save()
         else:
             SeminarRevision.objects.create(seminar=seminar, user=user)
     else: