]> git.parisson.com Git - teleforma.git/commitdiff
Merge fixes
authorYoan Le Clanche <yoanl@pilotsystems.net>
Thu, 3 Dec 2020 16:46:32 +0000 (17:46 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Thu, 3 Dec 2020 16:46:32 +0000 (17:46 +0100)
teleforma/templates/teleforma/inc/conference_list.html
teleforma/templates/teleforma/inc/document_list.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/templates/teleforma/inc/media_list_pending.html
teleforma/templatetags/teleforma_tags.py

index c750fbc11075e9ae97db045d38dc1757900c9a4b..e80f72350f1fdde2c5eaf2ec85792ac7e660f3b1 100644 (file)
@@ -2,14 +2,14 @@
 {% load i18n %}
 
 {% with course.conference.all|from_course_type:type|streaming_only as conferences %}
-{% if conferences|from_period:period %}
+{% if conferences|from_periods:period %}
 <div class="course_content content_video">
 <div class="course_subtitle">
     <h3><img src="/static/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Live conferences"%}</h3>
 </div>
     <table class="listing" width="100%">
     <tbody>
-       {% for conference in conferences|from_period:period %}
+       {% for conference in conferences|from_periods:period %}
         {% for stream in conference.livestream.all %}
          {% if stream.stream_type == 'webm' %}
             <tr>
index 236a15a685351359e5e3867c5a6d3d59374b1151..f07d07ba71020d8f8122bc669b2b62f68ee10c51 100644 (file)
@@ -1,7 +1,7 @@
 {% load teleforma_tags %}
 {% load i18n %}
 
-{% if course.document.all|from_course_type:type|from_period:period|published %}
+{% if course.document.all|from_course_type:type|from_periods:period|published %}
 <div class="course_content">
 <div class="course_subtitle">
 <h3><img src="/static//telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Documents"%}</h3>
@@ -9,11 +9,11 @@
 
 {% with course.document.all as docs %}
 {% for doc_type in doc_types %}
-{% if docs|from_course_type:type|from_doc_type:doc_type|from_period:period and not type_counter > 2 %}
+{% if docs|from_course_type:type|from_doc_type:doc_type|from_periods:period and not type_counter > 2 %}
 <span class="doc_type_title">{{ doc_type }}</span>
 <table class="listing" width="100%">
     <tbody>
-        {% for doc in docs|from_course_type:type|from_doc_type:doc_type|from_period:period|published %}
+        {% 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>
index c96bbd86b4f81530d33d5761e3a226831d9f2dd4..2f5021899bc5b8151a54ae82621e99f57584010c 100644 (file)
           {% 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 media.id %}" title="{% trans "Play" %}">
+            <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|set_host:HOST }}') 0 1px; background-size: 100%; background-color: #dfdfdf;">
+                <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 %}
@@ -52,7 +52,7 @@
              <img src="{{ STATIC_URL }}telemeta/images/delete.png" style="vertical-align:middle" alt="" title="{% trans ' rejected' %}" />
             {% endif %}
             {% if media.item.file and user.is_staff %}
-             <a href="{{ MEDIA_URL|set_host:HOST }}{{ 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 %}
index b450210538fbb7299c42eb1a72e226527e5df568..6cf3bd6eacefcd2f811f23454bf7dcf292c23e6b 100644 (file)
@@ -2,14 +2,14 @@
 {% load thumbnail %}
 {% load i18n %}
 
-{% if course.media.all|from_course_type:type|from_period:period %}
+{% if course.media.all|from_course_type:type|from_periods:period %}
 <div class="course_content content_video">
 <div class="course_subtitle">
     <h3><img src="/static/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 %}
+        {% for media in course.media.all|from_course_type:type|from_periods:period %}
          {% if not media.is_published and user.is_staff %}
           {% if media.type == 'webm' %}
             <tr>
index 751dea08eca11b71198f703a814d7ec716406c36..69885a7ca6909c95ed36481bf830b6408c23e178 100644 (file)
@@ -150,12 +150,17 @@ def from_doc_type(contents, type):
         return contents.filter(type=type)
 
 @register.filter
-def from_period(contents, period):
+def from_periods(contents, period):
     if contents:
         if type(contents[0]) == Document:
             return contents.filter(periods__in=(period,))
         else:
-            return contents.filter(period=period)
+            # check if it's a list before building the query
+            try:
+                iter(period)
+                return contents.filter(period__in=period)
+            except:
+                return contents.filter(period=period)
 
 @register.assignment_tag
 def get_all_professors():