]> git.parisson.com Git - teleforma.git/commitdiff
Download button in list restricted to allowed users
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 20 Aug 2018 08:31:59 +0000 (10:31 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 20 Aug 2018 08:31:59 +0000 (10:31 +0200)
teleforma/templates/teleforma/inc/media_list.html

index afde6ad0b4c9453dd56501a44cf727a76c5eeaea..0ed5f56e4764185b0345f9756b9011dffa792315 100644 (file)
             {% elif not media.is_published and user.is_staff %}
              <img src="/static/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/teleforma/images/download_media.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" />
-             </a>
+            {% if media.item.file and media.is_published or user.is_superuser or user.is_staff %}
+                {% if not "video" in media.mime_type or perms.telemeta.can_play_all_items or request.user_agent.os.family == 'iOS' %}
+                    <a href="{% url teleforma-media-download period.id media.id %}">
+                        <img src="/static/teleforma/images/download_media.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" />
+                    </a>
+                {% endif %}
             {% endif %}
             </td>
             </tr>