]> git.parisson.com Git - teleforma.git/commitdiff
add pending media for course view
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 24 Jul 2015 23:43:52 +0000 (01:43 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 24 Jul 2015 23:43:52 +0000 (01:43 +0200)
teleforma/templates/teleforma/courses.html
teleforma/templates/teleforma/courses_pending.html [new file with mode: 0644]
teleforma/templates/teleforma/inc/media_list_pending.html [new file with mode: 0644]
teleforma/urls.py
teleforma/views/core.py

index 2c15236d9e5d7de2e5617238ab3debabd624b2b1..240955479c1f2c446297cc3cf65052044e94ef4b 100644 (file)
@@ -5,11 +5,6 @@
 
 
 {% block extra_javascript %}
-<script type="text/javascript">
-$(document).ready(function(){
-    InitChatWindow("{% url jqchat_ajax room.id %}", null);
-    });
-</script>
 {% endblock extra_javascript %}
 
 
@@ -42,6 +37,13 @@ $(document).ready(function(){
 <a href="{% url teleforma-conference-record %}" class="component_icon button" id="action_red">{% trans "New conference" %}</a>
 </div>
 {% endif %}
+
+{% if user.is_staff %}
+<div class="module_action">
+<a href="{% url teleforma-desk-period-pending period.id %}" class="component_icon button" id="action_red">{% trans "Pending" %}</a>
+</div>
+{% 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 (file)
index 0000000..9a7f527
--- /dev/null
@@ -0,0 +1,29 @@
+{% extends "teleforma/courses.html" %}
+{% load teleforma_tags %}
+{% load telemeta_utils %}
+{% load i18n %}
+
+{% block module-action %}
+{% endblock module-action %}
+
+{% block course %}
+<div class="desk_center">
+
+    {% for c in courses %}
+     {% with c.course as course %}
+      {% for type in c.types %}
+      <div class="course">
+        <div class="course_title">
+         <a href="{% url teleforma-desk-period-course period.id course.id %}">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}</a>
+        </div>
+
+        {% block media %}
+         {% include "teleforma/inc/media_list_pending.html" %}
+        {% endblock %}
+
+      </div>
+     {% endfor %}
+    {% endwith %}
+   {% endfor %}
+</div>
+{% 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 (file)
index 0000000..34deec8
--- /dev/null
@@ -0,0 +1,67 @@
+{% load teleforma_tags %}
+{% load thumbnail %}
+{% load i18n %}
+
+{% if course.media.all|from_course_type:type|from_period:period %}
+<div class="course_content">
+<div class="course_subtitle">
+    <h3><img src="{{ STATIC_URL }}telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Passed conferences"%}</h3>
+</div>
+    <table class="listing" width="100%">
+    <tbody>
+        {% 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' %}
+            <tr>
+            <td {% if forloop.first %}class="border-top"{% endif %} width="230px" style="vertical-align:middle">
+            <a href="{% url teleforma-media-detail period.id media.id %}" title="{% trans "Play" %}">
+            {% if media.item.related.all %}
+             {% for related in media.item.related.all %}
+              {% if related.title == "preview" %}
+               {% thumbnail related.file "168x96" as im %}
+                <div style="background: no-repeat url('{{ im.url }}') 0 1px; background-size: 100%; background-color: #dfdfdf;">
+                 <img src="{{ STATIC_URL }}teleforma/images/play_168.png" width="100%" alt="{% trans 'Click here' %}" />
+                </div>
+               {% endthumbnail %}
+              {% endif %}
+             {% endfor %}
+            {% else %}
+              {% trans 'Click here' %}
+            {% endif %}
+            </a>
+            </td>
+            <td {% if forloop.first %}class="border-top"{% endif %} width="60%" style="padding-left: 1em;">
+                <div>
+                    <dl class="listing" style="font-size: 1.2em;">
+                    <dt>{% trans "Title" %}</dt><dd>{{ media.conference.course.title }}</dd>
+                    <dt>{% trans "Session" %}</dt><dd>{{ media.conference.session }}</dd>
+                    {% if media.conference.professor %}
+                    <dt>{% trans "Professor" %}</dt><dd><a href="{% url telemeta-profile-detail media.conference.professor.user.username %}" target="_blank">{{ media.conference.professor }}</a></dd>
+                    {% endif %}
+                    <dt>{% trans "Begin" %}</dt><dd>{{ media.conference.date_begin }}</dd>
+                    {% if media.conference.comment %}
+                    <dt>{% trans "Comment" %}</dt><dd>{{ media.conference.comment }}</dd>
+                    {% endif %}
+                    </dl>
+                 </div>
+            </td>
+            <td {% if forloop.first %}class="border-top"{% endif %} width="10%" align="center">
+            {% if media.is_published and user.is_staff %}
+             <img src="{{ STATIC_URL }}telemeta/images/ok.png" style="vertical-align:middle" alt="" title="{% trans ' published' %}" />
+            {% elif not media.is_published and user.is_staff %}
+             <img src="{{ STATIC_URL }}telemeta/images/delete.png" style="vertical-align:middle" alt="" title="{% trans ' rejected' %}" />
+            {% endif %}
+            {% if media.item.file %}
+             <a href="{{ MEDIA_URL }}{{ media.item.file }}">
+              <img src="{{ STATIC_URL }}teleforma/images/download_media.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" />
+             </a>
+            {% endif %}
+            </td>
+            </tr>
+          {% endif %}
+         {% endif %}
+        {% endfor %}
+    </tbody>
+    </table>
+</div>
+{% endif %}
index a8151431ea69c5788017161082b948421cc69c4b..1a311d9f6f90d08692c866bfdb5b8266a163d03d 100644 (file)
@@ -72,6 +72,7 @@ urlpatterns = patterns('',
     # Desk
     url(r'^desk/$', HomeRedirectView.as_view(), name="teleforma-desk"),
     url(r'^desk/periods/(?P<period_id>.*)/courses/$', CourseListView.as_view(), name="teleforma-desk-period-list"),
+    url(r'^desk/periods/(?P<period_id>.*)/courses_pending/$', CoursePendingListView.as_view(), name="teleforma-desk-period-pending"),
     url(r'^desk/periods/(?P<period_id>.*)/courses/(?P<pk>.*)/detail/$', CourseView.as_view(),
         name="teleforma-desk-period-course"),
 
index 1392929d203e8a24ebc121d0861e2074bc025360..2133539e2eb1c3fb34fb7eac4803ea32c9fe1fff 100644 (file)
@@ -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