]> git.parisson.com Git - teleforma.git/commitdiff
Add popup message when user has not spent enough time on a seminar
authorYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 9 Mar 2021 11:05:33 +0000 (12:05 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 9 Mar 2021 11:05:33 +0000 (12:05 +0100)
teleforma/templates/teleforma/seminar_detail.html

index 0a0f02971ac6f7e4a2682261be37e6866190e178..859abf090fd62e0e6c1471f0bde85bdb1f0c51f7 100644 (file)
       expandText: 'Lire plus',
       userCollapseText: 'Cacher le texte',
     });
+
+
+    {% if popup_message %}
+      // show a warning popup and set a cookie to not display the popup each visit
+      if(getCookie('time-popup-view') != 1){
+        $( "#warning-message" ).dialog({
+          modal: true,
+          buttons: {
+            Ok: function() {
+              $( this ).dialog( "close" );
+              var expirationDate=new Date();
+              expirationDate.setDate(expirationDate.getDate() + 1);
+              setCookie('time-popup-view', 1 , 1);
+            }
+          }
+        });
+      }
+    {% endif %}
   });
 
+
+
 </script>
 
 
 <script type="text/javascript">
 
   var seminarUtils = {
-
-        {% if user.is_staff %}
-  publish: function(id) {
-    var p = $('#publish');
-    json([id], 'teleforma.publish_seminar', function () {
-      p.removeClass('icon_delete').addClass('icon_ok');
-      p.html('{% trans " published" %}');
-    });
-  },
-  unpublish: function(id) {
-    var p = $('#publish');
-    json([id], 'teleforma.unpublish_seminar', function () {
-      p.removeClass('icon_ok').addClass('icon_delete');
-      p.html('{% trans " rejected" %}');
-    });
-  },
-  {% endif %}
-        }
+    {% if user.is_staff %}
+      publish: function(id) {
+        var p = $('#publish');
+        json([id], 'teleforma.publish_seminar', function () {
+          p.removeClass('icon_delete').addClass('icon_ok');
+          p.html('{% trans " published" %}');
+        });
+      },
+      unpublish: function(id) {
+        var p = $('#publish');
+        json([id], 'teleforma.unpublish_seminar', function () {
+          p.removeClass('icon_ok').addClass('icon_delete');
+          p.html('{% trans " rejected" %}');
+        });
+      },
+    {% endif %}
+  }
 
   var f = seminarUtils;
   $(document).ready(function () {
 
     <div class="course_title">
 
+      {% if popup_message %}
+      <div id="warning-message" title="Avertissement">
+        <p>
+          {{popup_message}}
+        </p>
+      </div>
+      {% endif %}
+
       <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" %}"