]> git.parisson.com Git - teleforma.git/commitdiff
Fix missing video and preview url
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 8 Jun 2022 11:43:35 +0000 (13:43 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 8 Jun 2022 11:43:35 +0000 (13:43 +0200)
teleforma/templates/teleforma/course_media.html
teleforma/templates/teleforma/inc/media_package_list.html
teleforma/templates/teleforma/seminar_media_audio.html
teleforma/templates/teleforma/seminar_media_video.html

index 268137e3b3327da761c51e02959ca4dd3c8b07ea..de28f8cf7e147ff35f5a199c067092e867285f96 100644 (file)
@@ -51,9 +51,9 @@
 {% endblock extra_javascript %}
 
 {% block module-action %}
-{% if media.item.file and media.is_published %}
+{% if media.file and media.is_published %}
 <div class="module_action">
-<a href="{{ MEDIA_URL|set_host:HOST }}{{ media.item.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
+<a href="{{ MEDIA_URL|set_host:HOST }}{{ media.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
 </div>
 {% endif %}
 {% endblock module-action %}
 <div class="video">
 <video id="my_video_1" class="video-js vjs-default-skin" width="640" height="360" controls preload="auto" data-setup='{}'>
 <!-- Hello Chrome and Firefox (and Opera?) -->
-<source src="{{ MEDIA_URL|set_host:HOST }}{{ media.item.file }}" type="{{ media.mime_type }}" />
+<source src="{{ MEDIA_URL|set_host:HOST }}{{ media.file }}" type="{{ media.mime_type }}" />
 </video>
 </div>
 
 {% elif "audio" in media.mime_type %}
 
 <div style="margin-top:1em;">
-{% if media.item.related.all %}
- {% for related in media.item.related.all %}
-  {% if related.title == "preview" %}
-   <img src="{{ MEDIA_URL|set_host:HOST }}{{ related.file }}" width="300px" alt="" />
+  {% if media.poster_file %}
+   <img src="{{ MEDIA_URL|set_host:HOST }}{{ media.poster_file }}" width="300px" alt="" />
+  {% else %}
+   snapshot
   {% endif %}
- {% endfor %}
-{% else %}
- snapshot
-{% endif %}
 </div>
 <div class="audio">
 <audio controls preload="auto">
-<source src="{{ MEDIA_URL|set_host:HOST }}{{ media.item.file }}" type="{{ media.mime_type }}" />
+<source src="{{ MEDIA_URL|set_host:HOST }}{{ media.file }}" type="{{ media.mime_type }}" />
 </audio>
 </div>
 {% endif %}
index 14c9d9a12a8f7ebfc0872e78e23ad8581e554713..a92462d4ac5eac9e01ff66bdfd561ebd1c215d01 100644 (file)
@@ -23,7 +23,7 @@
             <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.item.title }}</dd>
+                    <dt>{% trans "Title" %}</dt><dd>{{ media.title }}</dd>
                     {% with seminar.professor.all as professors %}
                         {% if professors %}
                             <dt>{% if professors.count > 1 %}{% trans "Professors" %}{% else %}{% trans "Professor" %}{% endif %}</dt>
index 0f5aef92ac877c30681f8326d54e517784a808ad..ecebc0ceedbafbf4c7301cff3d15106b3a6dbadf 100644 (file)
@@ -42,7 +42,7 @@
 
 <div class="audio">
 <audio id="audio_1" controls preload="auto">
-    {% for transcoded in media.item.transcoded.all %}
+    {% for transcoded in media.transcoded.all %}
      {% if "audio" in transcoded.mime_type %}
         <source src="{{ MEDIA_URL }}{{ transcoded.file }}#t=0" type="{{ transcoded.mime_type }}" />
      {% endif %}
@@ -58,7 +58,7 @@
 <dl class="listing">
 
 
-<dt>{% trans "Title" %}</dt><dd>{% if media.title %}{{ media.title }}{% else %}{{ media.item.title }}{% endif %}</dd>
+<dt>{% trans "Title" %}</dt><dd>{{ media.title }}</dd>
 
 {% with seminar.professor.all as professors %}
   {% if professors %}
@@ -89,7 +89,7 @@
   <h3><img src="{{STATIC_URL}}teleforma/images/module_playlist.png" alt="status" style="vertical-align:middle" /> {% trans "Audio index" %}</h3>
  <div id="index">
   <ul>
-  {% for marker in media.item.markers.all %}
+  {% for marker in media.markers.all %}
   {% if not forloop.first %}
    <li><a href="#" onclick="jumpToTimeoffset({{ marker.time|point }});">{{ marker.title }}</a></li>
   {% endif %}
@@ -119,9 +119,9 @@ $(document).ready(function(){
 {% endblock index %}
 
 {% block module-action-right %}
-{% if media.item.file and media.is_published and media.item.file.path|in_download_formats and user.is_superuser %}
+{% if media.file and media.is_published and media.file.path|in_download_formats and user.is_superuser %}
  <div class="module_action">
-   <a href="{{ MEDIA_URL }}{{ media.item.transcoded.all.0.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
+   <a href="{{ MEDIA_URL }}{{ media.transcoded.all.0.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
  </div>
 {% endif %}
 {% endblock module-action-right %}
index 63ddf53c3f7984f4fc54dc6f13220fd08db3ef22..bd9deb0c10d3b18fd9c13493960ef308a4f1982e 100644 (file)
@@ -95,13 +95,13 @@ $(window).ready(function(){
 <div class="media">
 
 <div class="video">
-<video id="my_video_1" class="video-js vjs-default-skin" width="864" height="480" controls preload="none" {% if media.item.related.all %}{% for related in media.item.related.all %}{% if related.title == "preview" %}poster="{{ MEDIA_URL }}{{ related.file }}"{% endif %}{% endfor %}{% endif %} data-setup='{}'>
-  {% for transcoded in media.item.transcoded.all %}
+<video id="my_video_1" class="video-js vjs-default-skin" width="864" height="480" controls preload="none" {% if media.poster_file %}poster="{{ MEDIA_URL }}{{ media.poster_file }}"{% endif %} data-setup='{}'>
+  {% for transcoded in media.transcoded.all %}
    {% if "video" in transcoded.mime_type %}
     <source src="{{ MEDIA_URL }}{{ transcoded.file }}#t=0" type="{{ transcoded.mime_type }}" />
    {% endif %}
   {% endfor %}
-    <source src="{{ MEDIA_URL }}{{ media.item.file }}#t=0" type="{{ media.mime_type }}" />
+    <source src="{{ MEDIA_URL }}{{ media.file }}#t=0" type="{{ media.mime_type }}" />
 </video>
 </div>
 
@@ -113,7 +113,7 @@ $(window).ready(function(){
 <div class="course_content" id="media_infos">
 <dl class="listing">
 
-<dt>{% trans "Title" %}</dt><dd>{% if media.title %}{{ media.title }}{% else %}{{ media.item.title }}{% endif %}</dd>
+<dt>{% trans "Title" %}</dt><dd>{% if media.title %}{{ media.title }}{% else %}{{ media.title }}{% endif %}</dd>
 {% with seminar.professor.all as professors %}
   {% if professors %}
     <dt>{% if professors.count > 1 %}{% trans "Professors" %}{% else %}{% trans "Professor" %}{% endif %}</dt>
@@ -125,7 +125,7 @@ $(window).ready(function(){
 <dt>{% trans "Date modified" %}</dt><dd>{{ media.date_modified }}</dd>
 <dt>{% trans "Media ID" %}</dt><dd>{{ media.id }}</dd>
 <dt>{% trans "Seminar ID" %}</dt><dd>{{ seminar.code }}</dd>
-<dt>{% trans "Idem ID" %}</dt><dd>{{ media.item.public_id }}</dd>
+<dt>{% trans "Idem ID" %}</dt><dd>{{ media.public_id }}</dd>
 {% endif %}
 
 </dl>
@@ -144,7 +144,7 @@ $(window).ready(function(){
   <h3><img src="{{STATIC_URL}}teleforma/images/module_playlist.png" alt="status" style="vertical-align:middle" /> {% trans "Video index" %}</h3>
  <div id="index">
   <ul>
-  {% for marker in media.item.markers.all %}
+  {% for marker in media.markers.all %}
   {% if not forloop.first and marker.time|point != '0.0' %}
    <li><a href="#" onclick="jumpToTimeoffset({{ marker.time|point }});">{{ marker.title }}</a></li>
   {% endif %}
@@ -171,9 +171,9 @@ $(document).ready(function(){
 {% endblock index %}
 
 {% block module-action-right %}
-{% if media.item.file and media.is_published and media.item.file.path|in_download_formats and user.is_superuser %}
+{% if media.file and media.is_published and media.file.path|in_download_formats and user.is_superuser %}
  <div class="module_action">
-   <a href="{{ MEDIA_URL }}{{ media.item.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
+   <a href="{{ MEDIA_URL }}{{ media.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" />&nbsp;{% trans "Download" %}</a>
  </div>
 {% endif %}
 {% endblock module-action-right %}