From aef5313b53b29733164ef67ebfab4b496160ba5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Je=CC=81re=CC=81my=20Fabre?= Date: Thu, 20 Oct 2016 15:37:56 +0200 Subject: [PATCH] Medias first implementation (shutter, list, details) --- app/static/src/js/index.js | 2 + app/static/src/js/modules/audio.js | 2 +- app/static/src/js/modules/video.js | 65 +++++++++++++++++++ app/static/src/sass/modules/_all.scss | 1 + .../sass/modules/medias/_video-playlist.scss | 38 +++++++++++ app/templates/index.html | 3 +- .../media/inc/playlist_audio_detail.html | 4 +- app/templates/media/inc/playlist_shutter.html | 39 ++++++++--- .../media/inc/playlist_video_detail.html | 22 ++++--- app/templates/media/playlist_detail.html | 36 ++++++++-- app/templates/media/playlist_list.html | 1 - 11 files changed, 184 insertions(+), 29 deletions(-) create mode 100644 app/static/src/js/modules/video.js create mode 100644 app/static/src/sass/modules/medias/_video-playlist.scss diff --git a/app/static/src/js/index.js b/app/static/src/js/index.js index 23167785..705525cf 100644 --- a/app/static/src/js/index.js +++ b/app/static/src/js/index.js @@ -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(); diff --git a/app/static/src/js/modules/audio.js b/app/static/src/js/modules/audio.js index 8b8ab8fb..b315dbf6 100644 --- a/app/static/src/js/modules/audio.js +++ b/app/static/src/js/modules/audio.js @@ -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 index 00000000..4cb68fcf --- /dev/null +++ b/app/static/src/js/modules/video.js @@ -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; ia { + color: $color-black-light; + } + + } + + >a { + + @include transition(all 0.25s ease-in-out); + color: white; + + } + + } + +} diff --git a/app/templates/index.html b/app/templates/index.html index 5a0097c4..c46666a4 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -46,13 +46,12 @@
  • - {% trans "Medias" %} + {% trans "Medias" %}
    {% include "media/inc/playlist_shutter.html" %}
    -
  • diff --git a/app/templates/media/inc/playlist_audio_detail.html b/app/templates/media/inc/playlist_audio_detail.html index f622fa19..cbbf9086 100644 --- a/app/templates/media/inc/playlist_audio_detail.html +++ b/app/templates/media/inc/playlist_audio_detail.html @@ -7,7 +7,9 @@
  • {% with media.media as media %} {% for transcoded in media.transcoded.all %} - {{ media.title }} + {% if transcoded.mime_type == "audio/mp4" or transcoded.mime_type == "audio/mp3" %} + {{ media.title }} + {% endif %} {% endfor %} {% endwith %}
  • diff --git a/app/templates/media/inc/playlist_shutter.html b/app/templates/media/inc/playlist_shutter.html index 13835371..cff1a334 100644 --- a/app/templates/media/inc/playlist_shutter.html +++ b/app/templates/media/inc/playlist_shutter.html @@ -1,18 +1,41 @@ {% load mezzanine_tags keyword_tags i18n organization_tags %} + +
    +
    +

    {% trans 'Audios' %}

    +

    {% trans 'View all the audio medias' %}

    + {% trans 'See all audios >' %} +
    +
    + +
    +
    +

    {% trans 'Videos' %}

    +

    {% trans 'View all the video medias' %}

    + {% trans 'See all videos >' %} +
    +
    + + {% for media in home.dynamic_content_home_media.all|slice:":3" %}
    -

    {{ media.content_object.title }}

    +

    {{ media.content_object.title }}

    + {% if media.content_object.description %}

    {{ media.content_object.description|truncatechars:100 }}

    {% endif %} - {% if media.content_object.poster_url %} - - {% endif %} - {% if media.content_type.model == 'video' %} - {% trans 'See the video' %} - {% elif media.content_type.model == 'audio' %} - {% trans 'Hear the sound' %} + + {% comment %} + {% if media.content_object.poster_url %} + + {% endif %} + {% endcomment %} + + {% if media.content_object.type == 'video' %} + {% trans 'See the video' %} + {% elif media.content_object.type == 'audio' %} + {% trans 'Hear the sound' %} {% endif %}
    diff --git a/app/templates/media/inc/playlist_video_detail.html b/app/templates/media/inc/playlist_video_detail.html index 7632f2d5..0d8b4fc7 100644 --- a/app/templates/media/inc/playlist_video_detail.html +++ b/app/templates/media/inc/playlist_video_detail.html @@ -1,19 +1,21 @@ {% load mezzanine_tags keyword_tags i18n organization_tags %} +
    + +
    {% for media in playlist.medias.all %} {% with media.media as media %} {% if forloop.first %} -
    - -
    -
      - {% else %} -
    1. >{{ media.title }}
    2. +
        {% endif %} + {% spaceless %} +
      1. {{ media.title }}
      2. + {% endspaceless %} {% if forloop.last %}
      {% endif %} diff --git a/app/templates/media/playlist_detail.html b/app/templates/media/playlist_detail.html index c3237d3b..e686912f 100644 --- a/app/templates/media/playlist_detail.html +++ b/app/templates/media/playlist_detail.html @@ -12,12 +12,15 @@ {% endmetablock %}{% endblock %} {% block page_class %} - person + playlist {% endblock %} {% block breadcrumb_menu %} {{ block.super }} - + + {% endblock %} {% block page_title %} @@ -26,7 +29,32 @@ {% endeditable %} {% endblock %} +{% block page_sidebar %} + +
      + {% editable playlist.publish_date %} +
      + {{ playlist.publish_date|date:"DATE_FORMAT" }} +
      + {% endeditable %} + +
      + +
      + +
      + {{playlist.type}} +
      + + {% with playlist as object %} + {% include "includes/share_buttons.html" %} + {% endwith %} +
      + +{% 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 }} - {% with playlist as object %} - {% include "includes/share_buttons.html" %} - {% endwith %} - {% endblock %} diff --git a/app/templates/media/playlist_list.html b/app/templates/media/playlist_list.html index 505b6d13..15ced91c 100644 --- a/app/templates/media/playlist_list.html +++ b/app/templates/media/playlist_list.html @@ -21,5 +21,4 @@ {% endwith %}
      {% endfor %} - {% endblock %} -- 2.39.5