]> git.parisson.com Git - mezzo.git/commitdiff
Update related content. Now related content is displayed as a slider.
authorJérémy Fabre <Jeremy@iMac-de-Jeremy-2.fritz.box>
Tue, 14 Feb 2017 10:52:53 +0000 (11:52 +0100)
committerJérémy Fabre <Jeremy@iMac-de-Jeremy-2.fritz.box>
Tue, 14 Feb 2017 10:52:53 +0000 (11:52 +0100)
17 files changed:
app/static/src/js/index.js
app/static/src/js/modules/lightsliderpersons-init.js [new file with mode: 0644]
app/static/src/js/modules/lightsliderrelated-init.js [new file with mode: 0644]
app/static/src/sass/modules/_all.scss
app/static/src/sass/modules/boxes/_article-box.scss
app/static/src/sass/modules/sliders/_slider-persons.scss [new file with mode: 0644]
app/static/src/sass/vendors/_lightslider.scss
app/templates/agenda/event/includes/event_card.html
app/templates/agenda/event_detail.html
app/templates/agenda/includes/event_date_card.html [new file with mode: 0644]
app/templates/agenda/includes/event_date_line.html
app/templates/agenda/includes/event_linecard.html
app/templates/core/inc/related_content.html
app/templates/magazine/article/includes/article_card.html
app/templates/network/inc/person/person_card_square.html
app/templates/pages/page.html
app/templates/pages/page/includes/page_card.html

index c9be516d75348bc53a8f9ec0339563fb5e3d02b5..da8115face2b012f0df4328e9dae36023f510634 100644 (file)
@@ -14,6 +14,8 @@ var StickyKitInit = require('./modules/sticky-kit-init');
 var LightSliderPageInit = require('./modules/lightsliderpage-init');
 var LightSliderHomeInit = require('./modules/lightsliderhome-init');
 var LightSliderNetworkInit = require('./modules/lightslidernetwork-init');
+var LightSliderPersonsInit = require('./modules/lightsliderpersons-init');
+var LightSliderRelatedInit = require('./modules/lightsliderrelated-init');
 var LazyLoadInit = require('./modules/lazyload-init');
 var HomeMenu = require('./modules/home-menu');
 var Audio = require('./modules/audio');
@@ -37,6 +39,8 @@ window[StickyKitInit] = new StickyKitInit();
 window[LightSliderPageInit] = new LightSliderPageInit();
 window[LightSliderHomeInit] = new LightSliderHomeInit();
 window[LightSliderNetworkInit] = new LightSliderNetworkInit();
+window[LightSliderPersonsInit] = new LightSliderPersonsInit();
+window[LightSliderRelatedInit] = new LightSliderRelatedInit();
 window[LazyLoadInit] = new LazyLoadInit();
 window[HomeMenu] = new HomeMenu();
 window[Audio] = new Audio();
diff --git a/app/static/src/js/modules/lightsliderpersons-init.js b/app/static/src/js/modules/lightsliderpersons-init.js
new file mode 100644 (file)
index 0000000..aaea7a0
--- /dev/null
@@ -0,0 +1,41 @@
+var LightSliderPersonsInit = function() {
+
+    this.feed = null;
+
+    //
+    // Init
+    //
+    this.init();
+
+};
+
+LightSliderPersonsInit.prototype.init = function() {
+
+    var that = this;
+
+    $('[data-slider-persons]').lightSlider({
+        item: 2,
+        slideMargin: 0,
+        pager: false,
+        loop: true,
+        auto: true,
+        pauseOnHover: true,
+        responsive: [
+            {
+                breakpoint: 752,
+                settings: {
+                    item: 2
+                }
+            },
+            {
+                breakpoint: 480,
+                settings: {
+                    item: 1
+                }
+            }
+        ]
+    });
+
+};
+
+module.exports = LightSliderPersonsInit;
diff --git a/app/static/src/js/modules/lightsliderrelated-init.js b/app/static/src/js/modules/lightsliderrelated-init.js
new file mode 100644 (file)
index 0000000..d24734b
--- /dev/null
@@ -0,0 +1,41 @@
+var LightSliderRelatedInit = function() {
+
+    this.slider = null;
+
+    //
+    // Init
+    //
+    this.init();
+
+};
+
+LightSliderRelatedInit.prototype.init = function() {
+
+    var that = this;
+
+    that.slider = $('[data-slider-related]').lightSlider({
+        item: 1,
+        slideMargin: 0,
+        pager: false,
+        loop: true,
+        auto: false,
+        pauseOnHover: true,
+        responsive: [
+            {
+                breakpoint: 752,
+                settings: {
+                    item: 1
+                }
+            },
+            {
+                breakpoint: 480,
+                settings: {
+                    item: 1
+                }
+            }
+        ]
+    });
+
+};
+
+module.exports = LightSliderRelatedInit;
index 6a970b269143ee21a786da7782900371f60a21c9..be0adf8baf0e33ac63d302833d1884436259df9f 100755 (executable)
@@ -44,6 +44,7 @@
 @import 'sliders/slider-page';
 @import 'sliders/slider-home';
 @import 'sliders/slider-network';
+@import 'sliders/slider-persons';
 
 // Page modules
 @import 'breadcrumb';
index da34dc69f5f6dfc0dd9408d0829c777fd9b6e282..2a8276c3ae3d12108f581ebf81136014b487e71c 100644 (file)
@@ -254,6 +254,8 @@ $module: ".article-box";
         border: 0;
         @include padding(0);
 
+        height: auto;
+
         &:after {
 
             content: "";
diff --git a/app/static/src/sass/modules/sliders/_slider-persons.scss b/app/static/src/sass/modules/sliders/_slider-persons.scss
new file mode 100644 (file)
index 0000000..397eb30
--- /dev/null
@@ -0,0 +1,29 @@
+// -*- coding: utf-8 -*-
+
+// Copyright (c) 2016-2017 Ircam
+// Copyright (c) 2016-2017 Jérémy Fabre
+
+// This file is part of mezzanine-organization.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU Affero General Public License for more details.
+
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+$module: ".slider-persons";
+
+#{$module} {
+
+    //
+    // Overrides lightSlider
+    //
+
+}
index 4a16af9c09664fa68bf589522bfdd02cf2fae2d3..051652939ea36ddcaba0073e38f0af5ff1f9b248 100644 (file)
     }
 
 }
+
+.lSAction {
+    > a {
+        background: transparent;
+        &:before {
+            color: #F2EDDC;
+            font-size: 40px;
+        }
+    }
+    > a.lSPrev {
+
+    }
+    > a.lSNext {
+
+    }
+}
index c3ab60a5df64abc5dc0e4788b6018d94bfafbc95..a948df618cac738bc86103c744e1792c7132abf5 100644 (file)
@@ -18,7 +18,7 @@
         {% with object.images.all|get_type:'card' as images %}
             {% if images %}
                 <figure class="article-box__image">
-                    <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-original="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" class="lazyload" />
+                    <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" class="lazyload" />
                 </figure>
             {% else %}
                 <figure class="article-box__image">
@@ -54,7 +54,7 @@
 
 {% block subtitle %}
     <strong>
-        {% include 'agenda/includes/event_date_line.html' %}
+        {% include 'agenda/includes/event_date_card.html' %}
     </strong>
     {% if object.location %}
          <br /><span>{{ object.location }}</span>
index 60920d6442d0b45183fb435486aa1e57ef2c7de2..42a7b93d6ab88963a8759b31c7ccd2debcff4449 100644 (file)
                 <div class="row">
                     <div class="col-md-8 col-md-push-4">
                         <div class="row">
-                            {% for person in event.persons.all %}
-                                    {% with person.person as person %}
-                                        <div class="col-md-8">
-                                            {% include "network/inc/person/person_card_square.html" %}
-                                        </div>
-                                    {% endwith %}
-                            {% endfor %}
+                            <div>
+                                {% for person in event.persons.all %}
+                                        {% with person.person as person %}
+                                            <div class="col-md-8">
+                                                {% include "network/inc/person/person_card_square.html" %}
+                                            </div>
+                                        {% endwith %}
+                                {% endfor %}
+                            </div>
                         </div>
                     </div>
                 </div>
diff --git a/app/templates/agenda/includes/event_date_card.html b/app/templates/agenda/includes/event_date_card.html
new file mode 100644 (file)
index 0000000..4aaa9a3
--- /dev/null
@@ -0,0 +1,12 @@
+{% load i18n %}
+{% load event_tags %}
+
+{% if object.start and not object.end %}
+    {{ object.start|date:"l j F" }}<br>
+{% else %}
+    {% if object.start|date:"d.m.y" == object.end|date:"d.m.y" %}
+        {{ object.start|date:"l j F" }}<br>
+    {% else %}
+        {{ object.start|date:"j F" }} {% trans "to" %} {{ object.end|date:"j F" }}
+    {% endif %}
+{% endif %}
index 82f5fe6eb3b257c359437ebb5ff6eee36f065386..6a41de204cc57342ea38df4276f06cbaacef313a 100644 (file)
@@ -1,12 +1,54 @@
-{% load i18n %}
-{% load event_tags %}
-
-{% if object.start and not object.end %}
-    {{ object.start|date:"l j F" }}
-{% else %}
-    {% if object.start|date:"d.m.y" == object.end|date:"d.m.y" %}
-        {{ object.start|date:"l j F" }}
+{% load event_tags pages_tags mezzanine_tags organization_tags i18n  %}
+{% with event.periods.all as periods %}
+    <!-- Start date only  -->
+    {% if event.start and not event.end %}
+        {{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
+        <!-- Start date with hour  -->
+        {% if event.start and event.start|date:"H:i" != "23:59" %}
+            {{ event.start|time:"TIME_FORMAT" }}
+        {% endif %}
+    <!-- Start and end date  -->
     {% else %}
-        {{ object.start|date:"j F" }} {% trans "to" %} {{ object.end|date:"j F" }}
+        <!-- Start and end date is the same day  -->
+        {% if event.start|date:"d.m.y" == event.end|date:"d.m.y" %}
+            {% if not periods %}
+                {{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
+                <!-- Start date with hour  -->
+                {% if event.end and event.end|date:"H:i" != "23:59" %}
+                    {{ event.start|time:"TIME_FORMAT" }} - {{ event.end|time:"TIME_FORMAT" }}
+                {% else %}
+                    {{ event.start|time:"TIME_FORMAT" }}
+                {% endif %}
+            {% else %}
+                {{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
+                {% for period in periods %}
+                    {% if period.date_to and period.date_to|date:"H:i" != "23:59" %}
+                        {{ period.date_from|time:"TIME_FORMAT" }} - {{ period.date_to|time:"TIME_FORMAT" }}
+                    {% else %}
+                        {% if forloop.last or periods|length == 2 %} {% trans "and"%} {% elif not forloop.first %}, {% endif %}
+                        {{ period.date_from|time:"TIME_FORMAT" }}
+                    {% endif %}
+                {% endfor %}
+            {% endif %}
+        <!-- Start and end date are the same month  -->
+        {% elif event.start|date:"m.y" == event.end|date:"m.y" %}
+            {{ event.start|date:"WEEK_DAY_FORMAT" }}
+            {% if event.end|subtract:event.start|get_attr:"days" > 1 %}
+                {% trans "through" %}
+            {% else %}
+                {% trans "and" %}
+            {% endif %}
+            {{ event.end|date:"DATE_EVENT_FORMAT" }}
+        <!-- Start and end date are completely different  -->
+        {% else %}
+            {{ event.start|date:"DATE_EVENT_FORMAT" }} {% trans "through" %} {{ event.end|date:"DATE_EVENT_FORMAT" }},<br>
+            <!-- Start date with hour  -->
+            {% if event.end and event.end|date:"H:i" != "23:59" %}
+                {{ event.start|time:"TIME_FORMAT" }} - {{ event.end|time:"TIME_FORMAT" }}
+            {% else %}
+                {{ event.start|time:"TIME_FORMAT" }}
+            {% endif %}
+        {% endif %}
+
     {% endif %}
-{% endif %}
+{% endwith %}
index 803218b43b2af0acbdf79876389a1a25c81ad8db..648b5d127060f9b28c4f9445c96de7d8601bab2e 100644 (file)
 
                 <div class="event-line-box__body">
                     {% if event.location %}
-                        <div class="event-line-box__location">{{ event.location }}</div>
+                        <div class="event-line-box__location">
+                            {{ event.location }}
+                            {% if event.location.room %}
+                                 / {{ event.location.room }}
+                            {% endif %}
+                        </div>
                     {% endif %}
                     <h3 class="event-line-box__title">
                         {{ event.title }}
index 9e81611ce6be45159fd2cf8a16432833400d6afe..109567639b844e4e62a605b5a4df7889c07c9758 100644 (file)
@@ -8,21 +8,32 @@
                 </div>
             </div>
             <div class="row">
-                <div class="col-md-10 col-md-push-3 col-xxs-16">
-                    <div class="row">
+                <div class="col-xxs-16">
+                    <div data-slider-related>
+
                         {% for content in dynamic_content %}
-                            <div class="col-xs-8">
-                                {% if content.content_type.model == "article" %}
-                                    {% include "magazine/article/includes/article_card.html" with object=content.content_object  %}
-                                {% elif content.content_type.model == "event" %}
-                                    {% include "agenda/event/includes/event_card.html" with object=content.content_object %}
-                                {% elif content.content_type.model == "custompage" %}
-                                    {% include "pages/page/includes/page_card.html" with object=content.content_object %}
-                                {% endif %}
-                            </div>
+                            {% if forloop.counter0 == 0 or forloop.counter|divisibleby:3 %}
+                                <div class="container">
+                                    <div class="row">
+                            {% endif %}
+                                <div class="col-xs-6 col-xs-push-2">
+                                    {% if content.content_type.model == "article" %}
+                                        {% include "magazine/article/includes/article_card.html" with object=content.content_object  %}
+                                    {% elif content.content_type.model == "event" %}
+                                        {% include "agenda/event/includes/event_card.html" with object=content.content_object %}
+                                    {% elif content.content_type.model == "custompage" %}
+                                        {% include "pages/page/includes/page_card.html" with object=content.content_object %}
+                                    {% endif %}
+                                </div>
+                            {% if forloop.last or forloop.counter|divisibleby:2 %}
+                                </div>
+                                </div>
+                            {% endif %}
                         {% endfor %}
+
                     </div>
                 </div>
+
             </div>
         </div>
     </div>
index 9d2906d889b082975eacd28e0da2f1486dceef2e..aed1e92bfc8a7876613a23d9c9b6bb7367c018b9 100644 (file)
@@ -27,7 +27,7 @@
 
             {% if images %}
                 <figure class="article-box__image">
-                    <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-original="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=object.photo_alignment|get_photo_alignment %}" class="lazyload" />
+                    <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=object.photo_alignment|get_photo_alignment %}" class="lazyload" />
                 </figure>
             {% else %}
                 <figure class="article-box__image">
index c1254821bff0367fe118ecd49dc57562e0ce9e15..ec146f8d60984cf8e0c4998be11c1b58e936f7cf 100644 (file)
@@ -6,7 +6,7 @@
             <div class="article-box__header">
                 <a href="{{ person.get_absolute_url }}" title="{{ person.first_name }}&nbsp;{{ person.last_name }}">
                     <figure class="article-box__image">
-                        <img class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-original="{{ MEDIA_URL }}{% thumbnail card_images.first 427 500 top=0.5 %}" alt="person"/>
+                        <img class="lazyload" src="{{ MEDIA_URL }}{% thumbnail card_images.first 427 500 top=0.5 %}" alt="person"/>
                     </figure>
                 </a>
             </div>
index f940ffc7c8fb0e4411029792996d8912b6a6006b..babe9714c637fafb40d248f828ad120e9e72db35 100644 (file)
@@ -25,7 +25,7 @@
 
             <div class="row">
 
-                <div class="col-sm-16 col-md-10 col-md-push-3 tac">
+                <div class="col-sm-16 col-md-12 col-md-push-2 tac">
                     {% block page_title %}
                         {{ page.title }}
                     {% endblock %}
index 92f46ee519920beffc5addf3c5d806cabde76863..210db39b8cac68885ab953804c74e592a7e43911 100644 (file)
@@ -16,7 +16,7 @@
     {% with object.images.all|get_type:'card' as images %}
         {% if images %}
             <figure class="article-box__image">
-                <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-original="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" class="lazyload" />
+                <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" class="lazyload" />
             </figure>
         {% else %}
             <figure class="article-box__image">