]> git.parisson.com Git - teleforma.git/commitdiff
Add "new" on not read documents
authorYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 27 Jan 2026 13:23:39 +0000 (14:23 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 27 Jan 2026 13:23:39 +0000 (14:23 +0100)
teleforma/static/teleforma/css/teleforma.css
teleforma/static/teleforma/js/application.js
teleforma/templates/teleforma/inc/document_list.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/templatetags/teleforma_tags.py
teleforma/views/core.py
teleforma/webclass/views.py

index 26e657e4b16a349481ff1d2460b27cc2805ad40f..8e7210cf15dcc386c6fe3915bf8f84bb15526dbc 100644 (file)
@@ -3325,6 +3325,12 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
        font-weight: bold;
 }
 
-
-
-
+/* New resource indicator */
+.new-resource {
+    background-color: #e74c3c;
+    color: white;
+    padding: 2px 8px;
+    border-radius: 3px;
+    font-size: 0.85em;
+    font-weight: bold;
+}
\ No newline at end of file
index 38bb61cd70d487b61dde33370e11d9668ca7ee62..4ff43fe2a73975ee594198919b9a6e871c1cc403 100644 (file)
@@ -34,7 +34,7 @@ $(document).ready(function(){
                  var $tbody = $(this);
                  if($tbody.find('tr').size()>=2) {
                      $tbody.find('tr:not(:first)').remove();
-                     $tbody.append('<tr><td><a href="'+course_url+'">Voir la suite</a></td><td></td><td></td></tr>')
+                     $tbody.append('<tr><td><a href="'+course_url+'">Voir la suite</a></td><td></td><td></td><td></td></tr>')
                  }
              });
          })
index b1f21155ae4a1e1597f10e13ebb4286636f6e2c9..2e0c6a0878ae49ba1b6828761a9c8eaffa543caa 100644 (file)
     <tbody>
         {% for doc in docs|from_course_type:type|from_doc_type:doc_type|from_periods:period|published %}
         <tr>
-        <td {% if forloop.first %}class="border-top"{% endif %} width="60%">{% if doc.file %}<a href="{% url 'teleforma-document-view' doc.id %}" target="_blank" title="{% trans "View" %}"><img src="/static//teleforma/images/application-msword.png" style="vertical-align:middle" alt="" />{% endif %} {{ doc.title }}{% if doc.file %}</a>{% endif %}</td>
-        <td {% if forloop.first %}class="border-top"{% endif %} width="35%">{{ doc.date_added }}</td>
+        <td {% if forloop.first %}class="border-top"{% endif %} width="55%">{% if doc.file %}<a href="{% url 'teleforma-document-view' doc.id %}" target="_blank" title="{% trans "View" %}"><img src="/static//teleforma/images/application-msword.png" style="vertical-align:middle" alt="" />{% endif %} {{ doc.title }}{% if doc.file %}</a>{% endif %}</td>
+        <td {% if forloop.first %}class="border-top"{% endif %} width="30%">{{ doc.date_added }}</td>
         <td {% if forloop.first %}class="border-top"{% endif %} width="5%" align="center">{% if doc.file %}<a href="{% url 'teleforma-document-download' doc.id %}"><img src="/static/teleforma/images/download.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" /></a>{% endif %}</td>
+        <td {% if forloop.first %}class="border-top"{% endif %} width="10%" align="center">
+          {% if not doc|document_read:user %}
+            <span class="new-resource">Nouveau</span>
+          {% endif %}
+        </td>
         </tr>
     {% endfor %}
     </tbody>
index 9224be4c476af5ad9b4eca0dc1c71e78b081ad8d..d205825fc45827d55900dcf59ec0a0a0ce891e68 100644 (file)
@@ -75,6 +75,9 @@
                     <img src="/static/teleforma/images/delete.png" style="vertical-align:middle" alt="" title="{% trans ' rejected' %}" />
                 {% endif %}
             {% endif %}
+            {% if not conference.video|media_read:user %}
+                <span class="new-resource">Nouveau</span>
+            {% endif %}
             {% if conference.video.file %}
                 {% if not "video" in conference.video.mime_type or request.user_agent.os.family == 'iOS' %}
                     <a href="{% url 'teleforma-media-download' period.id conference.video.id %}">
index 0fd6b753d847535170fea1560fb8ffe43df3aa53..856061b600be6f8d47e97108cfa81a26e5fec0e6 100644 (file)
@@ -465,3 +465,11 @@ def course_past_conferences(context):
 def conference_publication(context, conference):
     period = context['period']
     return conference.publication_info(period)
+
+@register.filter
+def document_read(document, user):
+    return document.readers.filter(id=user.id).exists()
+
+@register.filter
+def media_read(media, user):
+    return media.readers.filter(id=user.id).exists()
index 67fc1ec354be7245556368c7d5773fc24c293d2e..b59a4ef4c283aa275bb6b937f90b868dff15bb2f 100644 (file)
@@ -774,6 +774,8 @@ class DocumentView(CourseAccessMixin, DetailView):
         courses = get_courses(request.user)
         document = Document.objects.get(pk=pk)
         if get_access(document, courses):
+            # Track document read
+            document.readers.add(request.user)
             return serve_media(document.file.path.encode('utf8'), streaming=True)
         else:
             return redirect('teleforma-home')
index e9e7aba5868a58729754c521a88f66cb200bd258..a583cdf1975edc30fe969bec0c017ef33bd1ef43 100644 (file)
@@ -249,9 +249,11 @@ def unregister(request, pk):
 @access_required
 def create_bbb_conference(request, period_id, course_id, course_type_id):
     """
-    Create a BBB conference
+    Create a Conference object and join a bbb webclass with a random room id. 
+    A cron script will later store the BBB record id in the Conference object.
     """
 
+
     username = request.user.get_full_name()
     is_professor = len(request.user.professor.all()) >= 1
     is_staff = request.user.is_staff or request.user.is_superuser