]> git.parisson.com Git - mezzo.git/commitdiff
Medias first implementation (shutter, list, details)
authorJérémy Fabre <Jeremy@iMac-de-Jeremy.local>
Thu, 20 Oct 2016 13:37:56 +0000 (15:37 +0200)
committerJérémy Fabre <Jeremy@iMac-de-Jeremy.local>
Thu, 20 Oct 2016 13:37:56 +0000 (15:37 +0200)
app/static/src/js/index.js
app/static/src/js/modules/audio.js
app/static/src/js/modules/video.js [new file with mode: 0644]
app/static/src/sass/modules/_all.scss
app/static/src/sass/modules/medias/_video-playlist.scss [new file with mode: 0644]
app/templates/index.html
app/templates/media/inc/playlist_audio_detail.html
app/templates/media/inc/playlist_shutter.html
app/templates/media/inc/playlist_video_detail.html
app/templates/media/playlist_detail.html
app/templates/media/playlist_list.html

index 231677858345f30d7a6bda34cce35ca68cae2085..705525cff8359bdef09985d5603cb5553a6bb0af 100644 (file)
@@ -17,6 +17,7 @@ var LightSliderNetworkInit = require('./modules/lightslidernetwork-init');
 var LazyLoadInit = require('./modules/lazyload-init');
 var HomeMenu = require('./modules/home-menu');
 var Audio = require('./modules/audio');
+var Video = require('./modules/video');
 
 //
 // Init all the modules
@@ -37,3 +38,4 @@ window[LightSliderNetworkInit] = new LightSliderNetworkInit();
 window[LazyLoadInit] = new LazyLoadInit();
 window[HomeMenu] = new HomeMenu();
 window[Audio] = new Audio();
+window[Video] = new Video();
index 8b8ab8fbc71050d7f83cf6af5e9273ad93e139c9..b315dbf683c028a9e749421af0b3d24ef0ede413 100644 (file)
@@ -59,7 +59,7 @@ Audio.prototype.init = function() {
             //
             var first = playlist.find('li a').attr('data-src');
             playlist.find('li').first().addClass('playing');
-            that.setTitle(as[i], playlist.find('li a').text());
+            that.setTitle(as[i], playlist.find('li:first-child a').text());
             as[i].load(first);
 
             playlist.find('li').bind('click', function(e) {
diff --git a/app/static/src/js/modules/video.js b/app/static/src/js/modules/video.js
new file mode 100644 (file)
index 0000000..4cb68fc
--- /dev/null
@@ -0,0 +1,65 @@
+var Video = function() {
+
+    this.player = null;
+
+    //
+    // Init
+    //
+    this.init();
+
+};
+
+Video.prototype.init = function() {
+
+    var that = this;
+
+    that.player = videojs('video-js-playlist', {
+        aspectRatio:"905:520"
+    });
+
+    var playlist = [];
+    $('.video-playlist li a').each(function(idx) {
+
+        var elem = $(this);
+
+        var srcs = elem.attr('data-src').split(',');
+        var mimes = elem.attr('data-mime').split(',');
+        var obj = {
+            sources: [],
+            poster: elem.attr('data-poster')
+        };
+
+        for(var i=0; i<srcs.length; i++) {
+            obj.sources.push({
+                src: srcs[i],
+                type: mimes[i]
+            });
+        }
+
+        playlist.push(obj);
+
+        elem.click(function(e) {
+            e.preventDefault();
+
+            $('.video-playlist li').removeClass('playing');
+            $(this).parent().addClass('playing');
+            that.player.playlist.currentItem($(this).parent().index());
+            that.player.play();
+
+            return false;
+        });
+
+    });
+    console.log(playlist);
+
+    that.player.playlist(playlist);
+
+};
+
+Video.prototype.open = function(e) {
+
+
+
+}
+
+module.exports = Video;
index e5aee2ab8a6df1dc7016214b2ca12d1de386bea5..19d493c3077e2f98c8160374c482b9ba44ca2b39 100755 (executable)
@@ -7,6 +7,7 @@
 
 // Medias
 @import "medias/audio-playlist";
+@import "medias/video-playlist";
 
 // Boxes
 @import 'boxes/article-box';
diff --git a/app/static/src/sass/modules/medias/_video-playlist.scss b/app/static/src/sass/modules/medias/_video-playlist.scss
new file mode 100644 (file)
index 0000000..6d1a560
--- /dev/null
@@ -0,0 +1,38 @@
+$module: ".video-playlist";
+
+#{$module} {
+
+    margin-top: 0;
+    padding: 0;
+    background: $color-black-light;
+    list-style-type: none;
+
+    &__item {
+
+        @include padding(0.25 1);
+        @include font-size(xs);
+        @include typeface(sans-serif);
+        @include transition(all 0.25s ease-in-out);
+        color: white;
+
+        &.playing {
+
+            background: $color-main;
+            color: $color-black-light;
+
+            >a {
+                color: $color-black-light;
+            }
+
+        }
+
+        >a  {
+
+            @include transition(all 0.25s ease-in-out);
+            color: white;
+
+        }
+
+    }
+
+}
index 5a0097c4a3fc9beebcfa3045784dcfebe7dca71a..c46666a4dc9a1455a29d7a448fe05a3bba7843e2 100644 (file)
           </div>
       </li>
       <li class="home__menu-item">
-          <a href="#" title="{% trans "Media" %}">{% trans "Medias" %}</a>
+          <a href="{% url 'organization-playlist-list' %}" title="{% trans "Media" %}">{% trans "Medias" %}</a>
           <div class="home__shutter">
               <div class="home__shutter-content">
                   <div class="container-fluid tal">
                       {% include "media/inc/playlist_shutter.html" %}
                   </div>
-                  <div><a href="{% url 'organization-playlist-list' %}" title="">{% trans 'See more media >' %}</a></div>
               </div>
           </div>
       </li>
index f622fa19fdc96b74c07c4f47a7bceb9896cc414f..cbbf908661f395ab78742a59a74e76d39b1d0954 100644 (file)
@@ -7,7 +7,9 @@
         <li class="audio-playlist__item">
             {% with media.media as media %}
                 {% for transcoded in media.transcoded.all %}
-                    <a href="#" data-src="{{ transcoded.url }}">{{ media.title }}</a>
+                    {% if transcoded.mime_type == "audio/mp4" or transcoded.mime_type == "audio/mp3" %}
+                        <a href="#" data-src="{{ transcoded.url }}">{{ media.title }}</a>
+                    {% endif %}
                 {% endfor %}
             {% endwith %}
         </li>
index 13835371c75e32f0a88d92ce7031a95b17dc0258..cff1a33468146abf1b06df6c707b2cfe31ef6c2e 100644 (file)
@@ -1,18 +1,41 @@
 {% load mezzanine_tags keyword_tags i18n organization_tags %}
+
+<div class="col-xs-3">
+    <div class="home__shutter-item">
+        <h2><a href="{% url 'organization-playlist-list' %}" title="">{% trans 'Audios' %}</a></h2>
+        <p>{% trans 'View all the audio medias' %}</p>
+        <a href="{% url 'organization-playlist-list' %}" title="">{% trans 'See all audios >' %}</a>
+    </div>
+</div>
+
+<div class="col-xs-3">
+    <div class="home__shutter-item">
+        <h2><a href="{% url 'organization-playlist-list' %}" title="">{% trans 'Videos' %}</a></h2>
+        <p>{% trans 'View all the video medias' %}</p>
+        <a href="{% url 'organization-playlist-list' %}" title="">{% trans 'See all videos >' %}</a>
+    </div>
+</div>
+
+
 {% for media in home.dynamic_content_home_media.all|slice:":3" %}
     <div class="col-xs-3">
         <div class="home__shutter-item">
-            <h2>{{ media.content_object.title }}</h2>
+            <h2><a href="{{ media.content_object.get_absolute_url }}" title="">{{ media.content_object.title }}</a></h2>
+
             {% if media.content_object.description %}
                 <p>{{ media.content_object.description|truncatechars:100 }}</p>
             {% endif %}
-            {% if media.content_object.poster_url %}
-                <img src="{% thumbnail media.content_object.poster_url 203 140 %}">
-            {% endif %}
-            {% if media.content_type.model == 'video' %}
-                <a href="{# media.content_object.get_absolute_url #}" title="">{% trans 'See the video' %}</a>
-            {% elif media.content_type.model == 'audio' %}
-                <a href="{# media.content_object.get_absolute_url #}" title="">{% trans 'Hear the sound' %}</a>
+
+            {% comment %}
+                {% if media.content_object.poster_url %}
+                    <img src="{% thumbnail media.content_object.poster_url 203 140 %}">
+                {% endif %}
+            {% endcomment %}
+
+            {% if media.content_object.type == 'video' %}
+                <a href="{{ media.content_object.get_absolute_url }}" title="">{% trans 'See the video' %}</a>
+            {% elif media.content_object.type == 'audio' %}
+                <a href="{{ media.content_object.get_absolute_url }}" title="">{% trans 'Hear the sound' %}</a>
             {% endif %}
         </div>
     </div>
index 7632f2d50cdc1a110f66c2e2ad06e2e6c5155d56..0d8b4fc772638da8c22b8179cd76d29af0daf52a 100644 (file)
@@ -1,19 +1,21 @@
 {% load mezzanine_tags keyword_tags i18n organization_tags %}
 
+<div class="embed-responsive">
+    <video controls id="video-js-playlist" class="video-js vjs-ircam-skin" data-title="{{ media.title }}" {% if media.poster_url %}poster="{{ media.poster_url }}"{% endif %}>
+        {% for transcoded in media.transcoded.all %}
+           <source src="{{ transcoded.url }}" type="{{ transcoded.mime_type }}" />
+        {% endfor %}
+        Your browser does not support the video tag.
+    </video>
+</div>
 {% for media in playlist.medias.all %}
   {% with media.media as media %}
     {% if forloop.first %}
-        <div class="embed-responsive">
-               <video width="100%" poster="{{ media.poster_url }}" controls data-title="{{ media.title }}" preload="none">
-                {% for transcoded in media.transcoded.all %}
-                      <source src="{{ transcoded.url }}" type="{{ transcoded.mime_type }}" />
-                {% endfor %}
-               </video>
-        </div>
-        <ol>
-    {% else %}
-        <li><a href="#" data-src="{{ media.url }}">>{{ media.title }}</a></li>
+        <ol class="video-playlist">
     {% endif %}
+        {% spaceless %}
+            <li class="video-playlist__item{% if forloop.first %} playing{% endif %}"><a href="#" data-poster="{{media.poster_url }}" data-src="{% for transcoded in media.transcoded.all %}{% if forloop.first %}{% else %},{% endif %}{{ transcoded.url }}{% if forloop.last %}{% endif %}{% endfor %}" data-mime="{% for transcoded in media.transcoded.all %}{% if forloop.first %}{% else %},{% endif %}{{ transcoded.mime_type }}{% if forloop.last %}{% endif %}{% endfor %}">{{ media.title }}</a></li>
+        {% endspaceless %}
     {% if forloop.last %}
         </ol>
     {% endif %}
index c3237d3bcfa82a3fdf7ea0ac1b7ccce3b7a44e8e..e686912feedc85c9b00f19c9d7bf567c14f1440e 100644 (file)
 {% endmetablock %}{% endblock %}
 
 {% block page_class %}
-    person
+    playlist
 {% endblock %}
 
 {% block breadcrumb_menu %}
     {{ block.super }}
-    <li class="breadcrumb__item active">{% trans "Media" %}</li>
+    <li class="breadcrumb__item">
+        <a class="breadcrumb__link" href="{% url 'organization-playlist-list' %}" title="{% trans "Media" %}">{% trans "Media" %}</a>
+    </li>
+    <li class="breadcrumb__item active">{{ playlist.title }}</li>
 {% endblock %}
 
 {% block page_title %}
     {% endeditable %}
 {% endblock %}
 
+{% block page_sidebar %}
+
+    <div class="page__meta" data-sticky data-sticky-parent="row" data-sticky-offset="100" data-sticky-detach-at="971">
+        {% editable playlist.publish_date %}
+            <div class="page__meta-date">
+                {{ playlist.publish_date|date:"DATE_FORMAT" }}
+            </div>
+        {% endeditable %}
+
+        <div class="page__meta-separator">
+
+        </div>
+
+        <div class="page__meta-text">
+            <strong>{{playlist.type}}</strong>
+        </div>
+
+        {% with playlist as object %}
+            {% include "includes/share_buttons.html" %}
+        {% endwith %}
+    </div>
+
+{% endblock %}
+
 {% block page_content %}
+
     {% with playlist.type as type %}
         {% with "media/inc/playlist_"|add:type|add:"_detail.html" as template %}
             {% include template %}
@@ -37,8 +65,4 @@
         {{ playlist.content|safe }}
     </div>
 
-    {% with playlist as object %}
-      {% include "includes/share_buttons.html" %}
-    {% endwith %}
-
 {% endblock %}
index 505b6d13ad2075cc4fb2acbb1aaded6e3063301f..15ced91c496d1958c73ebc1e020b50e5b3e27205 100644 (file)
@@ -21,5 +21,4 @@
         {% endwith %}
         <br>
     {% endfor %}
-
 {% endblock %}