#flex-container > .raw-item {
width: 5rem;
+}
+
+/* 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
<tbody>
{% for doc in docs %}
<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>
<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 %}">
from teleforma.views.core import get_course_conferences
from ..exam.models import Quota, Script
-from ..models.core import Document, Professor
+from ..models.core import Document, MediaRead, Professor
from ..models.crfpa import IEJ, Course, NewsItem, Training, QuizValidation
from ..views import get_courses
from ..utils import generate_hash
return validations[0].date_validated
else:
return ''
+
+@register.filter
+def document_read(document, user):
+ return document.readers.filter(id=user.id).exists()
+
+@register.filter
+def media_read(media, user):
+ return MediaRead.objects.filter(media=media, user=user).exists()
bucket = False
if get_access(document, courses):
+ # Track document read
+ document.readers.add(request.user)
+
if settings.TELEFORMA_PRIVATE_DOCUMENTS_MODE:
file = document.private_file(request.user)
if settings.TELEFORMA_PRIVATE_MEDIA_USE_S3: