]> git.parisson.com Git - mezzo.git/commitdiff
Card templates full refactoring
authorJérémy Fabre <Jeremy@iMac-de-Jeremy.local>
Mon, 17 Oct 2016 12:53:01 +0000 (14:53 +0200)
committerJérémy Fabre <Jeremy@iMac-de-Jeremy.local>
Mon, 17 Oct 2016 12:53:01 +0000 (14:53 +0200)
12 files changed:
app/templates/agenda/includes/event_card.html
app/templates/core/inc/generic_card.html
app/templates/core/inc/related_content.html
app/templates/home/inc/body.html
app/templates/magazine/article/article_detail.html
app/templates/magazine/article/includes/article_card.html
app/templates/magazine/topic/topic_detail.html
app/templates/pages/custompage.html
app/templates/pages/includes/page_box.html [new file with mode: 0644]
app/templates/pages/includes/page_card.html
app/templates/pages/page.html
app/templates/pages/teampage.html

index 76cd1405555ef78890edac029bb5d20b23e7854e..45490b3ec71ef0fd42810254bd8cd7a23bbf35e6 100644 (file)
@@ -1,51 +1,66 @@
-{% load i18n future mezzanine_tags event_tags keyword_tags disqus_tags organization_tags %}
-
-{% block event_list_event_title %}
-<div class="event__card msry__item">
-    {% ifchanged event.start.month %}
-        <h1>{{ event.start|date:'F' }}</h1>
-    {% endifchanged %}
-    {% with event.images.all|get_type:'card' as images %}
-    {% if images %}
-    {% block event_list_event_featured_image %}
-    <a href="{{ event.get_absolute_url }}" class="event__thumbnail">
-        <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 500 500 %}" width="500" height="500">
-    </a>
-    {% endblock %}
+{% extends "core/inc/generic_card.html" %}
+{% load i18n pages_tags mezzanine_tags media_tags organization_tags %}
+
+{% block metatitle %}
+    {{ event.title }}
+{% endblock %}
+
+{% block title %}
+    {{ event.title }}
+{% endblock %}
+
+{% block url %}
+    {{ event.get_absolute_url }}
+{% endblock %}
+
+{% block image %}
+    <figure class="article-box__image">
+        {% with event.images.all|get_type:'card' as images %}
+            {% if images %}
+                <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" />
+            {% endif %}
+        {% endwith %}
+    </figure>
+{% endblock %}
+
+{% block tags %}
+    <div class="article-box__tags">
+        {% if event.departments.first %}
+            {% with event.departments.first as department %}
+                <div class="tag tag--small dashed">
+                  {{ department.department.name }}
+                </div>
+            {% endwith %}
+        {% endif %}
+        {% if event.category %}
+            <div class="tag tag--small tag--category">
+                {{ event.category }}
+            </div>
+        {% endif %}
+    </div>
+{% endblock %}
+
+{% block content %}
+    {{ event.description|richtext_filters|safe|truncatechars_html:200 }}
+{% endblock %}
+
+{% block subtitle %}
+    <strong>
+        {% include 'agenda/includes/event_date.html' %}
+    </strong>
+    {% if event.location %}
+         <br />{{ event.location }}
     {% endif %}
-    {% endwith %}
-    <h3 class="event__name">
-        <a href="{{ event.get_absolute_url }}">{{ event.title }}</a>
-    </h3>
-    <span class="event__card__description">{{ event.description|slice:":128" }}</span>
-    {% endblock %}
-
-    {% block event_list_event_metainfo %}
-    {% with False as unit_booking %}
-    {% include "agenda/includes/event_metainfo.html" %}
-    {% for child in event.children.all %}
-    {% with child as event %}
-    {% include "agenda/includes/event_metainfo.html" %}
-    {% endwith %}
-    {% endfor %}
-    {% endwith %}
-    {% endblock %}
-
-    {% block event_list_event_content %}
-    {% comment %}
-    <div class="event__description">
-    {{ event.description_from_content|safe }}
-    <a href="{{ event.get_absolute_url }}" class="event__meta__cta">{% trans "read more" %}</a>
-</div>
-{% endcomment %}
-{% endblock %}
-<!--[if IE]><![endif]-->
-{% block booking %}
-<a href="{{ event.get_absolute_url }}" class="btn btn-full">
-    {# <i class="icon icon__bookmark"></i> #}
-    {# {% trans "Booking" %} #}
-    Détails
-</a>
-{% endblock %}
-
-</div>
+{% endblock %}
+
+{% block btn %}
+    {% if event.prices.all.0|floatformat != '0' and event.prices.all|length > 0 %}
+        {% for price in event.prices.all %}
+            {% if forloop.first %}
+                <div class="article-box__btn">
+                    <object><a href="{% url 'event_booking' content.content_object.slug %}" class="button button--small mr0">{% trans "Reserve" %}</a></object>
+                </div>
+            {% endif %}
+        {% endfor %}
+    {% endif %}
+{% endblock %}
index 366bd0ec8afa3885b59bd5e45ed29df5bc249889..94cf2eccf2a99cc8de446baa589734bd25dbc560 100644 (file)
@@ -1,76 +1,31 @@
 {% load i18n pages_tags mezzanine_tags media_tags organization_tags %}
 
-<a class="article-box" href="{{ content.content_object.get_absolute_url }}" title="{{ content.content_object.title }}">
+<a class="article-box" href="{% block url %}{% endblock %}" title="{% block metatitle %}{% endblock %}">
     <div class="article-box__header">
-        <figure class="article-box__image">
-            {% with content.content_object.images.all|get_type:'card' as images %}
-                {% if images %}
-                    <img src="{{ MEDIA_URL }}{% thumbnail images.first.file 427 286 %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" alt="" />
-                {% endif %}
-            {% endwith %}
-        </figure>
-        {% if content.content_type.model == 'article' %}
-            <div class="article-box__tags">
-                <div class="tag tag--small tag--category">
-                    {% trans 'News' %}
-                </div>
-                {% if content.content_object.department %}
-                    <div class="tag tag--small dashed dashed--gray">
-                      {{ content.content_object.department.name }}
-                    </div>
-                {% endif %}
-            </div>
-        {% elif content.content_type.model == 'event' %}
-        <div class="article-box__tags">
 
-            {% if content.content_object.departments.first %}
-                {% with content.content_object.departments.first as department %}
-                    <div class="tag tag--small dashed">
-                      {{ department.department.name }}
-                    </div>
-                {% endwith %}
-            {% endif %}
-            {% if content.content_object.category %}
-                <div class="tag tag--small tag--category">
-                    {{ content.content_object.category }}
-                </div>
-            {% endif %}
-        </div>
-            {% if content.content_object.prices.all.0|floatformat != '0' and content.content_object.prices.all|length > 0 %}
-                {% for price in content.content_object.prices.all %}
-                    {% if forloop.first %}
-                        <div class="article-box__btn">
-                            <object><a href="{% url 'event_booking' content.content_object.slug %}" class="button button--small mr0">{% trans "Reserve" %}</a></object>
-                        </div>
-                    {% endif %}
-                {% endfor %}
-            {% endif %}
-        {% endif %}
+        {% block image %}
+        {% endblock %}
+
+        {% block tags %}
+        {% endblock %}
+
+        {% block btn %}
+        {% endblock %}
+
     </div>
 
     <div class="article-box__content tal">
-        <h3 class="article-box__title">{{ content.content_object.title }}</h3>
+        <h3 class="article-box__title">
+            {% block title %}
+            {% endblock %}
+        </h3>
         <div class="article-box__subtitle">
-            {% if content.content_type.model == 'article' %}
-                {{ content.content_object.publish_date|date:"d.m.y" }}
-                {% for category in content.content_object.categories.all %}
-                    {% if forloop.first %} | {% endif %}
-                    {% if not forloop.first %}, {% endif %}
-                    <strong>{{ category }}</strong>
-                {% endfor %}
-            {% elif content.content_type.model == 'event' %}
-                {% with content.content_object as event %}
-                    <strong>
-                        {% include 'agenda/includes/event_date.html' %}
-                    </strong>
-                {% endwith %}
-                {% if content.content_object.location %}
-                     <br />{{ content.content_object.location }}
-                {% endif %}
-            {% endif %}
+            {% block subtitle %}
+            {% endblock %}
         </div>
         <div class="article-box__desc">
-             {{ content.content_object.description|richtext_filters|safe|truncatechars_html:200 }}
+             {% block content %}
+             {% endblock %}
         </div>
     </div>
 </a>
index ce869ede1b0bb56a84a29e35db9aade9404f628d..d23387b2b35bf754e6b13d20ff5e8ac5d15b1190 100644 (file)
             </div>
             <div class="row tac">
                 {% for content in dynamic_content %}
-                    {% if content.content_model == "article" %}
-                        <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
-                            {% include 'magazine/article/includes/article_card.html' %}
-                        </div>
-                    {% else %}
                     <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
-                        {% include "core/inc/generic_card.html" %}
+                        {% if content.content_type.model == "article" %}
+                            {% with content.content_object as article %}
+                                {% include "magazine/article/includes/article_card.html" %}
+                            {% endwith %}
+                        {% elif content.content_type.model == "event" %}
+                            {% with content.content_object as event %}
+                                {% include "agenda/includes/event_card.html" %}
+                            {% endwith %}
+                        {% elif content.content_type.model == "custompage" %}
+                            {% with content.content_object as page %}
+                                {% include "pages/includes/page_card.html" %}
+                            {% endwith %}
+                        {% endif %}
                     </div>
-                    {%endif%}
                 {% endfor %}
             </div>
         </div>
index dc977b146cd0aca73da310bc7f4d93d2749d8fa9..a360724eddbe69e2859d56a58a78c21c922e24f9 100644 (file)
@@ -4,8 +4,14 @@
             <div class="col-xs-4">
                 {% if content.content_type.model == "brief" %}
                     {% include "magazine/brief/inc/brief_card.html" %}
-                {% else %}
-                    {% include "core/inc/generic_card.html" %}
+                {% elif content.content_type.model == "article" %}
+                    {% with content.content_object as article %}
+                        {% include "magazine/article/includes/article_card.html" %}
+                    {% endwith %}
+                {% elif content.content_type.model == "event" %}
+                    {% with content.content_object as event %}
+                        {% include "agenda/includes/event_card.html" %}
+                    {% endwith %}
                 {% endif %}
             </div>
         {% endfor %}
index d2b08876ac660b9eb94c7cea2c9d41edd574ad5e..8fa7a1d071aafb15bbd671734e3270564363ee79 100644 (file)
                 </div>
                 <div class="row tac">
                     {% for content in article.dynamic_content_articles.all %}
-                        {% if content.content_model == "article" %}
-                            <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
-                                {% include 'magazine/article/includes/article_card.html' %}
-                            </div>
-                        {% else %}
-                            <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
-                                {% include "core/inc/generic_card.html" %}
-                            </div>
-                        {% endif %}
+                        <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
+                            {% include 'magazine/article/includes/article_card.html' %}
+                        </div>
                     {% endfor %}
                 </div>
             </div>
index 1e30eb5adf71f2dce947c287947208c55c290992..ef3a2e379c7a63fd18a6602e994850f4cd8b1867 100644 (file)
@@ -1,38 +1,50 @@
+{% extends "core/inc/generic_card.html" %}
 {% load i18n pages_tags mezzanine_tags media_tags organization_tags %}
 
-<a class="article-box" href="{% url 'magazine-article-detail' article.slug %}">
-    <div class="article-box__header">
-        <figure class="article-box__image">
-            {% with article.images.all|get_type:'card' as images %}
-                {% if images %}
-                    <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" />
-                {% endif %}
-            {% endwith %}
-        </figure>
-        <div class="article-box__tags">
-            <div class="tag tag--small tag--category">
-                {% trans 'News' %}
-            </div>
-            {% if article.department %}
-                <div class="tag tag--small dashed dashed--gray">
-                  {{ article.department.name }}
-                </div>
+{% block metatitle %}
+    {{ article.title }}
+{% endblock %}
+
+{% block title %}
+    {{ article.title }}
+{% endblock %}
+
+{% block url %}
+    {% url 'magazine-article-detail' article.slug %}
+{% endblock %}
+
+{% block image %}
+    <figure class="article-box__image">
+        {% with article.images.all|get_type:'card' as images %}
+            {% if images %}
+                <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" />
             {% endif %}
-        </div>
-    </div>
+        {% endwith %}
+    </figure>
+{% endblock %}
 
-    <div class="article-box__content tal">
-        <h3 class="article-box__title">{{ article.title }}</h3>
-        <div class="article-box__subtitle">
-            {{ article.publish_date|date:"DATE_FORMAT" }}
-            {% for category in article.categories.all %}
-                {% if forloop.first %} | {% endif %}
-                {% if not forloop.first %}, {% endif %}
-                <strong>{{ category }}</strong>
-            {% endfor %}
-        </div>
-        <div class="article-box__desc">
-             {{ article.content|richtext_filters|safe|truncatechars_html:200 }}
+{% block tags %}
+    <div class="article-box__tags">
+        <div class="tag tag--small tag--category">
+            {% trans 'News' %}
         </div>
+        {% if article.department %}
+            <div class="tag tag--small dashed dashed--gray">
+              {{ article.department.name }}
+            </div>
+        {% endif %}
     </div>
-</a>
+{% endblock %}
+
+{% block content %}
+    {{ article.description|richtext_filters|safe|truncatechars_html:200 }}
+{% endblock %}
+
+{% block subtitle %}
+    {{ article.publish_date|date:"DATE_FORMAT" }}
+    {% for category in article.categories.all %}
+        {% if forloop.first %} | {% endif %}
+        {% if not forloop.first %}, {% endif %}
+        <strong>{{ category }}</strong>
+    {% endfor %}
+{% endblock %}
index c3a96b4b807a4db5563947359dfc37fe6f0c1f5d..b9f485048e701efb63915de8615b8a6eaba47230 100644 (file)
@@ -63,7 +63,7 @@
         <div class="row">
             {% for article in articles %}
                 <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
-                    {% include 'core/inc/generic_card.html' %}
+                    {% include 'magazine/article/includes/article_card.html' %}
                 </div>
             {% endfor %}
         </div>
index 49c1f476aab8988364e44da40b2532e9fda580d2..279678063739026fbac415af40c85042169b66be 100644 (file)
@@ -43,7 +43,7 @@
             <div class="page__childrens">
                 {% for object in childrens %}
                     {% if object.in_menus.0 %}
-                      {% include "pages/includes/page_card.html" %}
+                      {% include "pages/includes/page_box.html" %}
                     {% endif %}
                 {% endfor %}
             </div>
diff --git a/app/templates/pages/includes/page_box.html b/app/templates/pages/includes/page_box.html
new file mode 100644 (file)
index 0000000..39f4cdf
--- /dev/null
@@ -0,0 +1,18 @@
+{% load mezzanine_tags organization_tags %}
+<a href="{{ object.get_absolute_url }}" title="{{ object.title }}" class="page-box">
+    <div class="page-box__image">
+      {% with object.get_content_model.images.all|get_type:'card' as images %}
+       {% if images %}
+        <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 900 400 %}" />
+       {% endif %}
+      {% endwith %}
+    </div>
+    <div class="page-box__content">
+        <div>
+            <h2 class="page-box__title">{{ object.title }}</h2>
+            <div class="page-box__subtitle">
+                {{ object.get_content_model.sub_title }}
+            </div>
+        </div>
+    </div>
+</a>
index 39f4cdf68a2117ca7ecb7e8622a617a1d3b1cd6f..7a900714881d29b142e3c014c031781f9c1178d0 100644 (file)
@@ -1,18 +1,32 @@
-{% load mezzanine_tags organization_tags %}
-<a href="{{ object.get_absolute_url }}" title="{{ object.title }}" class="page-box">
-    <div class="page-box__image">
-      {% with object.get_content_model.images.all|get_type:'card' as images %}
-       {% if images %}
-        <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 900 400 %}" />
-       {% endif %}
-      {% endwith %}
-    </div>
-    <div class="page-box__content">
-        <div>
-            <h2 class="page-box__title">{{ object.title }}</h2>
-            <div class="page-box__subtitle">
-                {{ object.get_content_model.sub_title }}
-            </div>
-        </div>
-    </div>
-</a>
+{% extends "core/inc/generic_card.html" %}
+{% load i18n pages_tags mezzanine_tags media_tags organization_tags %}
+
+{% block metatitle %}
+    {{ page.title }}
+{% endblock %}
+
+{% block title %}
+    {{ page.title }}
+{% endblock %}
+
+{% block url %}
+    {{ page.get_absolute_url }}
+{% endblock %}
+
+{% block image %}
+    {% with page.images.all|get_type:'card' as images %}
+        {% if images %}
+            <figure class="article-box__image">
+                <img src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 top=0.5 left=article.photo_alignment|get_photo_alignment %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" />
+            </figure>
+        {% endif %}
+    {% endwith %}
+{% endblock %}
+
+{% block content %}
+    {{ page.description|richtext_filters|safe|truncatechars_html:200 }}
+{% endblock %}
+
+{% block subtitle %}
+    {{ page.sub_title }}
+{% endblock %}
index 5401ab0069318b9c5123ea460d4139db7be08978..c5545de64b9802817d8ecc56c16899cd99d67258 100644 (file)
                 {% include "core/inc/block.html" %}
             {% endwith %}
         {% endblock %}
+        {% block related_project %}
+        {% endblock %}
+        {% block logo %}
+        {% endblock %}
+    </div>
+
+    <div>
         {% block page_related_content %}
             {% with page.dynamic_content_pages.all as dynamic_content %}
                 {% include "core/inc/related_content.html" %}
             {% endwith %}
         {% endblock %}
-        {% block related_project %}
-        {% endblock %}
-        {% block logo %}
-        {% endblock %}
     </div>
+
 {% endblock %}
index b22e1097cc1109234f37cc41e888a44b3a80ea4b..f047bfb471ca7acefe830dabba786a6d0bc8ab9c 100644 (file)
@@ -43,7 +43,7 @@
             <div class="page__childrens">
                 {% for children in childrens %}
                     {% with children as object %}
-                        {% include "pages/includes/page_card.html" %}
+                        {% include "pages/includes/page_box.html" %}
                     {% endwith %}
                 {% endfor %}
             </div>