]> git.parisson.com Git - mezzo.git/commitdiff
[Video] : add video detail
authorEmilie <zawadzki@ircam.fr>
Wed, 8 Feb 2017 17:23:53 +0000 (18:23 +0100)
committerEmilie <zawadzki@ircam.fr>
Wed, 8 Feb 2017 17:23:53 +0000 (18:23 +0100)
app/organization/media/urls.py
app/organization/media/views.py
app/templates/media/audio/audio_detail.html [new file with mode: 0644]
app/templates/media/media/includes/media_card.html
app/templates/media/video/video_detail.html [new file with mode: 0644]

index 28f8419707803cc05433668410ca1b05610021cd..fc8a27e3d0689427cbbffb5c419db2faf0b5e038 100644 (file)
@@ -34,7 +34,7 @@ from organization.media.views import *
 
 urlpatterns = [
     url("^video/overlay/(?P<slug>.*)/$", MediaOverlayView.as_view(), name="organization-media-overlay"),
-    url("^media/detail/(?P<slug>.*)/$", MediaDetailView.as_view(), name="organization-media-detail"),
+    url("^(?P<type>.*)/detail/(?P<slug>.*)/$", MediaDetailView.as_view(), name="organization-media-detail"),
     url("^playlist/list/$", PlaylistListView.as_view(), name="organization-playlist-list"),
     url("^playlist/list/(?P<type>.*)$", PlaylistListView.as_view(), name="organization-playlist-list"),
     url("^playlist/detail/(?P<slug>.*)/$", PlaylistDetailView.as_view(), name="organization-playlist-detail"),
index 4bab950dc38b2bdba26ee0529675a7ca1994e602..e820096ca568f9866ccb2e23e5acbde786f138cf 100644 (file)
@@ -33,7 +33,12 @@ EXCLUDED_MODELS = ("organizationplaylist", "personplaylist")
 class MediaDetailView(SlugMixin, DetailView):
 
     model = Media
-    template_name='media/media_detail.html'
+    context_object_name = 'media'
+    
+    def get_template_names(self):
+        templates = super(MediaDetailView, self).get_template_names()
+        templates.insert(0,'media/'+self.kwargs['type'].lower()+'/'+self.kwargs['type'].lower()+'_detail.html')
+        return templates
 
 
 class PlaylistDetailView(SlugMixin, DetailView):
diff --git a/app/templates/media/audio/audio_detail.html b/app/templates/media/audio/audio_detail.html
new file mode 100644 (file)
index 0000000..2a81f82
--- /dev/null
@@ -0,0 +1,30 @@
+{% extends "pages/page.html" %}
+{% load mezzanine_tags keyword_tags i18n organization_tags %}
+
+{% block meta_title %}{% trans "Media" %}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for person as keywords %}
+{% for keyword in keywords %}
+    {% if not forloop.first %}, {% endif %}
+    {{ keyword }}
+{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block page_class %}
+    media
+{% endblock %}
+
+
+{% block page_title %}
+    {% editable person.title %}
+        <h1 class="dotted">{{ media.title }}</h1>
+    {% endeditable %}
+{% endblock %}
+
+
+
+{% block page_content %}
+
+
+{% endblock %}
index e620514b4c099809818396d6d9fd65e9a0b2dfae..a16e61a6c52b7243cecfaba5006ad7d9b6e43c90 100644 (file)
@@ -1,7 +1,7 @@
 {% load mezzanine_tags keyword_tags i18n organization_tags staticfiles %}
 
 <div class="">
-    <a class="media-box" href="{% url 'organization-media-detail' object.slug %}">
+    <a class="media-box" href="{% url 'organization-media-detail' object|get_media_type|lower object.slug %}">
         <figure class="media-box__image media-box__image--video">
             {% if object.poster_url %}
                 <img src="{{ object.poster_url }}">
@@ -11,6 +11,7 @@
         </figure>
 
         {{ object|get_media_type }}
+
         <h2 class="media-box__title">{{ object.title }}</h2>
         <div class="media-box__desc">
             {{ object.description|richtext_filters|safe|truncatechars_html:200 }}
diff --git a/app/templates/media/video/video_detail.html b/app/templates/media/video/video_detail.html
new file mode 100644 (file)
index 0000000..6a5d35b
--- /dev/null
@@ -0,0 +1,56 @@
+{% extends "pages/page.html" %}
+{% load mezzanine_tags keyword_tags i18n organization_tags %}
+
+{% block meta_title %}{% trans "Media" %}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for person as keywords %}
+{% for keyword in keywords %}
+    {% if not forloop.first %}, {% endif %}
+    {{ keyword }}
+{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block page_class %}
+    media
+{% endblock %}
+
+
+{% block page_title %}
+    {% editable person.title %}
+        <h1 class="dotted">{{ media.title }}</h1>
+    {% endeditable %}
+{% endblock %}
+
+
+
+{% block page_content %}
+    {{ media.title }}
+    {% if media.poster_url %}
+        {{ media.poster_url }}
+    {% endif %}
+
+    {{ media.publish_date|date:"j F, Y" }}
+
+    {% if media.description %}
+        {{ media.description }}
+    {% endif %}
+
+    <br><br>
+
+    {% with media.transcoded.all as media_transcoded %}
+        {% if media_transcoded %}
+            {# WEBM #}
+            {{ media_transcoded.0.url }}
+            {{ media_transcoded.0.mime_type }}
+            <br><br>
+            {# MP4 #}
+            {{ media_transcoded.1.url }}
+            {{ media_transcoded.1.mime_type }}
+            <br><br>
+            {# OGG #}
+            {{ media_transcoded.2.url }}
+            {{ media_transcoded.2.mime_type }}
+        {% endif %}
+    {% endwith %}
+{% endblock %}