]> git.parisson.com Git - mezzo.git/commitdiff
add video poster
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 7 Apr 2016 12:37:02 +0000 (14:37 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 7 Apr 2016 12:37:02 +0000 (14:37 +0200)
app/festival/migrations/0013_auto_20160407_1432.py [new file with mode: 0644]
app/festival/migrations/0014_auto_20160407_1433.py [new file with mode: 0644]
app/festival/models.py
app/festival/templates/festival/inc/video_card.html
app/festival/templates/festival/video_detail.html
app/templates/blog/includes/post_card.html [new file with mode: 0644]
app/templates/index.html

diff --git a/app/festival/migrations/0013_auto_20160407_1432.py b/app/festival/migrations/0013_auto_20160407_1432.py
new file mode 100644 (file)
index 0000000..e03e859
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.2 on 2016-04-07 12:32
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('festival', '0012_auto_20160405_2351'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='audio',
+            name='poster',
+            field=models.URLField(blank=True, max_length=1024, verbose_name='poster'),
+        ),
+        migrations.AddField(
+            model_name='video',
+            name='poster',
+            field=models.URLField(blank=True, max_length=1024, verbose_name='poster'),
+        ),
+    ]
diff --git a/app/festival/migrations/0014_auto_20160407_1433.py b/app/festival/migrations/0014_auto_20160407_1433.py
new file mode 100644 (file)
index 0000000..ac63f68
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.2 on 2016-04-07 12:33
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('festival', '0013_auto_20160407_1432'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='audio',
+            old_name='poster',
+            new_name='poster_url',
+        ),
+        migrations.RenameField(
+            model_name='video',
+            old_name='poster',
+            new_name='poster_url',
+        ),
+    ]
index 51dd0fce71c6b357608dc4e86955ba9b9097a6a3..487f32021d240b0b95b583e2ad91cbfeef9a8180 100644 (file)
@@ -118,6 +118,7 @@ class Media(Displayable, RichText):
     open_source_url = models.URLField(_('open source URL'), max_length=1024, blank=True)
     closed_source_url = models.URLField(_('closed source URL'), max_length=1024, blank=True)
     featured = models.BooleanField(_('featured'), default=False)
+    poster_url = models.URLField(_('poster'), max_length=1024, blank=True)
 
     class Meta(MetaCore):
         abstract = True
@@ -142,6 +143,8 @@ class Media(Displayable, RichText):
                 self.open_source_url = source.attrib['src']
             elif self.closed_source_mime_type in source.attrib['type']:
                 self.closed_source_url = source.attrib['src']
+        video = self.q('video')
+        self.poster_url = video[0].attrib['poster']
 
 
 class Audio(Media):
index 1b35317c41b4cc015e5d0e7a1d187de79475f344..6fe56d1cefed2e6402d74b9630538f15b2190d5f 100644 (file)
@@ -1,9 +1,11 @@
+{% load i18n %}
+
 <div class="video__card">
     <div class="video__card__thumbnail">
-        <img src="http://source.unsplash.com/9Vx-QeC0-9Q/400x400" alt="">
+        <img src="{{ video.poster_url }}" alt="">
     </div>
     <div class="video__card__info">
         <h3 class="video__card__name">{{ video.title }}</h3>
     </div>
-    <a href="{% url 'festival-video-detail' video.slug %}" class="video__card__link">Lire la video</a>
+    <a href="{% url 'festival-video-detail' video.slug %}" class="video__card__link">{% trans "Play the video" %}</a>
 </div>
index eea4f39e385bf46d1094ad1c8cdf561b1503d33a..e4a7de5edcbf5ea11872fd6ef9c1e321554d8609 100644 (file)
@@ -17,7 +17,7 @@
 </div>
 
 <div class="embed-responsive">
-       <video width="100%" controls data-title="{{ video.title }}" preload="none">
+       <video width="100%" poster="{{ video.poster_url }}" controls data-title="{{ video.title }}" preload="none">
          <source src="{{ video.open_source_url }}" type="{{ video.open_source_mime_type }}" />
       <source src="{{ video.closed_source_url }}" type="{{ video.closed_source_mime_type }}" />
          </video>
diff --git a/app/templates/blog/includes/post_card.html b/app/templates/blog/includes/post_card.html
new file mode 100644 (file)
index 0000000..c867038
--- /dev/null
@@ -0,0 +1,14 @@
+<div class="artist__item msry__item">
+    <div class="artist__item__inner">
+        <a href="{% url 'festival-artist-detail' artist.slug %}" class="artist__item__inner">
+            <figure class="artist__item__img">
+                <img src="{% if artist.photo_featured %}{{ MEDIA_URL }}/{{ artist.photo_featured }}{% elif artist.photo %}{{ MEDIA_URL }}/{{ artist.photo }}{% else %}{% endif %}" alt="Portrait {{ artist.name }}">
+            </figure>
+            <h3 class="artist__item__name">
+                <span>
+                    {{ artist.name }}
+                </span>
+            </h3>
+        </a>
+    </div>
+</div>
index ffde84c5078f3c1c035cfaf3112b0bef0384103f..3b73f53a2b9aa5dc25184c7cb2a2d87136ef971b 100644 (file)
 {% featured_video as video %}
 {% include 'festival/inc/video_card.html' %}
 
+{% }
+{% featured_playlist as playlist %}
+{% include 'festival/audio_playlist.html' %}
+
+
 {% featured_playlist as playlist %}
 {% include 'festival/audio_playlist.html' %}