From: Guillaume Pellerin Date: Fri, 24 Jul 2015 23:43:52 +0000 (+0200) Subject: add pending media for course view X-Git-Tag: 1.1~193 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f4a25d17a9fb0dce780774bc7538bd6cebdcb2b9;p=teleforma.git add pending media for course view --- diff --git a/teleforma/templates/teleforma/courses.html b/teleforma/templates/teleforma/courses.html index 2c15236d..24095547 100644 --- a/teleforma/templates/teleforma/courses.html +++ b/teleforma/templates/teleforma/courses.html @@ -5,11 +5,6 @@ {% block extra_javascript %} - {% endblock extra_javascript %} @@ -42,6 +37,13 @@ $(document).ready(function(){ {% trans "New conference" %} {% endif %} + +{% if user.is_staff %} +
+{% trans "Pending" %} +
+{% endif %} + {% endblock module-action %} {% block notes %} diff --git a/teleforma/templates/teleforma/courses_pending.html b/teleforma/templates/teleforma/courses_pending.html new file mode 100644 index 00000000..9a7f5276 --- /dev/null +++ b/teleforma/templates/teleforma/courses_pending.html @@ -0,0 +1,29 @@ +{% extends "teleforma/courses.html" %} +{% load teleforma_tags %} +{% load telemeta_utils %} +{% load i18n %} + +{% block module-action %} +{% endblock module-action %} + +{% block course %} +
+ + {% for c in courses %} + {% with c.course as course %} + {% for type in c.types %} +
+ + + {% block media %} + {% include "teleforma/inc/media_list_pending.html" %} + {% endblock %} + +
+ {% endfor %} + {% endwith %} + {% endfor %} +
+{% endblock course %} diff --git a/teleforma/templates/teleforma/inc/media_list_pending.html b/teleforma/templates/teleforma/inc/media_list_pending.html new file mode 100644 index 00000000..34deec82 --- /dev/null +++ b/teleforma/templates/teleforma/inc/media_list_pending.html @@ -0,0 +1,67 @@ +{% load teleforma_tags %} +{% load thumbnail %} +{% load i18n %} + +{% if course.media.all|from_course_type:type|from_period:period %} +
+
+

{% trans "Passed conferences"%}

+
+ + + {% for media in course.media.all|from_course_type:type|from_period:period %} + {% if not media.is_published and user.is_staff %} + {% if media.type == 'webm' %} + + + + + + {% endif %} + {% endif %} + {% endfor %} + +
+ + {% if media.item.related.all %} + {% for related in media.item.related.all %} + {% if related.title == "preview" %} + {% thumbnail related.file "168x96" as im %} +
+ {% trans 'Click here' %} +
+ {% endthumbnail %} + {% endif %} + {% endfor %} + {% else %} + {% trans 'Click here' %} + {% endif %} +
+
+
+
+
{% trans "Title" %}
{{ media.conference.course.title }}
+
{% trans "Session" %}
{{ media.conference.session }}
+ {% if media.conference.professor %} +
{% trans "Professor" %}
{{ media.conference.professor }}
+ {% endif %} +
{% trans "Begin" %}
{{ media.conference.date_begin }}
+ {% if media.conference.comment %} +
{% trans "Comment" %}
{{ media.conference.comment }}
+ {% endif %} +
+
+
+ {% if media.is_published and user.is_staff %} + + {% elif not media.is_published and user.is_staff %} + + {% endif %} + {% if media.item.file %} + + + + {% endif %} +
+
+{% endif %} diff --git a/teleforma/urls.py b/teleforma/urls.py index a8151431..1a311d9f 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -72,6 +72,7 @@ urlpatterns = patterns('', # Desk url(r'^desk/$', HomeRedirectView.as_view(), name="teleforma-desk"), url(r'^desk/periods/(?P.*)/courses/$', CourseListView.as_view(), name="teleforma-desk-period-list"), + url(r'^desk/periods/(?P.*)/courses_pending/$', CoursePendingListView.as_view(), name="teleforma-desk-period-pending"), url(r'^desk/periods/(?P.*)/courses/(?P.*)/detail/$', CourseView.as_view(), name="teleforma-desk-period-course"), diff --git a/teleforma/views/core.py b/teleforma/views/core.py index 1392929d..2133539e 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -325,6 +325,16 @@ class CourseView(CourseAccessMixin, DetailView): return media_list +class CoursePendingListView(CourseListView): + + template_name='teleforma/courses_pending.html' + + def get_context_data(self, **kwargs): + context = super(CoursePendingListView, self).get_context_data(**kwargs) + context['courses'] = sorted(context['all_courses'], key=lambda k: k['date'], reverse=True) + return context + + class MediaView(CourseAccessMixin, DetailView): model = Media