From: Jérémy Fabre Date: Mon, 17 Oct 2016 12:53:01 +0000 (+0200) Subject: Card templates full refactoring X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=577016e14b4c06fba91c58c8a4e638a6c8694a31;p=mezzo.git Card templates full refactoring --- diff --git a/app/templates/agenda/includes/event_card.html b/app/templates/agenda/includes/event_card.html index 76cd1405..45490b3e 100644 --- a/app/templates/agenda/includes/event_card.html +++ b/app/templates/agenda/includes/event_card.html @@ -1,51 +1,66 @@ -{% load i18n future mezzanine_tags event_tags keyword_tags disqus_tags organization_tags %} - -{% block event_list_event_title %} -
- {% ifchanged event.start.month %} -

{{ event.start|date:'F' }}

- {% endifchanged %} - {% with event.images.all|get_type:'card' as images %} - {% if images %} - {% block event_list_event_featured_image %} - - - - {% 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 %} +
+ {% with event.images.all|get_type:'card' as images %} + {% if images %} + + {% endif %} + {% endwith %} +
+{% endblock %} + +{% block tags %} +
+ {% if event.departments.first %} + {% with event.departments.first as department %} +
+ {{ department.department.name }} +
+ {% endwith %} + {% endif %} + {% if event.category %} +
+ {{ event.category }} +
+ {% endif %} +
+{% endblock %} + +{% block content %} + {{ event.description|richtext_filters|safe|truncatechars_html:200 }} +{% endblock %} + +{% block subtitle %} + + {% include 'agenda/includes/event_date.html' %} + + {% if event.location %} +
{{ event.location }} {% endif %} - {% endwith %} -

- {{ event.title }} -

- {{ event.description|slice:":128" }} - {% 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 %} -
- {{ event.description_from_content|safe }} - {% trans "read more" %} -
-{% endcomment %} -{% endblock %} - -{% block booking %} - - {# #} - {# {% trans "Booking" %} #} - Détails - -{% endblock %} - -
+{% 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 %} +
+ {% trans "Reserve" %} +
+ {% endif %} + {% endfor %} + {% endif %} +{% endblock %} diff --git a/app/templates/core/inc/generic_card.html b/app/templates/core/inc/generic_card.html index 366bd0ec..94cf2ecc 100644 --- a/app/templates/core/inc/generic_card.html +++ b/app/templates/core/inc/generic_card.html @@ -1,76 +1,31 @@ {% load i18n pages_tags mezzanine_tags media_tags organization_tags %} - +
-
- {% with content.content_object.images.all|get_type:'card' as images %} - {% if images %} - - {% endif %} - {% endwith %} -
- {% if content.content_type.model == 'article' %} -
-
- {% trans 'News' %} -
- {% if content.content_object.department %} -
- {{ content.content_object.department.name }} -
- {% endif %} -
- {% elif content.content_type.model == 'event' %} -
- {% if content.content_object.departments.first %} - {% with content.content_object.departments.first as department %} -
- {{ department.department.name }} -
- {% endwith %} - {% endif %} - {% if content.content_object.category %} -
- {{ content.content_object.category }} -
- {% endif %} -
- {% 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 %} -
- {% trans "Reserve" %} -
- {% endif %} - {% endfor %} - {% endif %} - {% endif %} + {% block image %} + {% endblock %} + + {% block tags %} + {% endblock %} + + {% block btn %} + {% endblock %} +
-

{{ content.content_object.title }}

+

+ {% block title %} + {% endblock %} +

- {% 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 %} - {{ category }} - {% endfor %} - {% elif content.content_type.model == 'event' %} - {% with content.content_object as event %} - - {% include 'agenda/includes/event_date.html' %} - - {% endwith %} - {% if content.content_object.location %} -
{{ content.content_object.location }} - {% endif %} - {% endif %} + {% block subtitle %} + {% endblock %}
- {{ content.content_object.description|richtext_filters|safe|truncatechars_html:200 }} + {% block content %} + {% endblock %}
diff --git a/app/templates/core/inc/related_content.html b/app/templates/core/inc/related_content.html index ce869ede..d23387b2 100644 --- a/app/templates/core/inc/related_content.html +++ b/app/templates/core/inc/related_content.html @@ -10,15 +10,21 @@
{% for content in dynamic_content %} - {% if content.content_model == "article" %} -
- {% include 'magazine/article/includes/article_card.html' %} -
- {% else %}
- {% 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 %}
- {%endif%} {% endfor %}
diff --git a/app/templates/home/inc/body.html b/app/templates/home/inc/body.html index dc977b14..a360724e 100644 --- a/app/templates/home/inc/body.html +++ b/app/templates/home/inc/body.html @@ -4,8 +4,14 @@
{% 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 %}
{% endfor %} diff --git a/app/templates/magazine/article/article_detail.html b/app/templates/magazine/article/article_detail.html index d2b08876..8fa7a1d0 100644 --- a/app/templates/magazine/article/article_detail.html +++ b/app/templates/magazine/article/article_detail.html @@ -106,15 +106,9 @@
{% for content in article.dynamic_content_articles.all %} - {% if content.content_model == "article" %} -
- {% include 'magazine/article/includes/article_card.html' %} -
- {% else %} -
- {% include "core/inc/generic_card.html" %} -
- {% endif %} +
+ {% include 'magazine/article/includes/article_card.html' %} +
{% endfor %}
diff --git a/app/templates/magazine/article/includes/article_card.html b/app/templates/magazine/article/includes/article_card.html index 1e30eb5a..ef3a2e37 100644 --- a/app/templates/magazine/article/includes/article_card.html +++ b/app/templates/magazine/article/includes/article_card.html @@ -1,38 +1,50 @@ +{% extends "core/inc/generic_card.html" %} {% load i18n pages_tags mezzanine_tags media_tags organization_tags %} - -
-
- {% with article.images.all|get_type:'card' as images %} - {% if images %} - - {% endif %} - {% endwith %} -
-
-
- {% trans 'News' %} -
- {% if article.department %} -
- {{ article.department.name }} -
+{% block metatitle %} + {{ article.title }} +{% endblock %} + +{% block title %} + {{ article.title }} +{% endblock %} + +{% block url %} + {% url 'magazine-article-detail' article.slug %} +{% endblock %} + +{% block image %} +
+ {% with article.images.all|get_type:'card' as images %} + {% if images %} + {% endif %} -
-
+ {% endwith %} + +{% endblock %} -
-

{{ article.title }}

-
- {{ article.publish_date|date:"DATE_FORMAT" }} - {% for category in article.categories.all %} - {% if forloop.first %} | {% endif %} - {% if not forloop.first %}, {% endif %} - {{ category }} - {% endfor %} -
-
- {{ article.content|richtext_filters|safe|truncatechars_html:200 }} +{% block tags %} +
+
+ {% trans 'News' %}
+ {% if article.department %} +
+ {{ article.department.name }} +
+ {% endif %}
-
+{% 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 %} + {{ category }} + {% endfor %} +{% endblock %} diff --git a/app/templates/magazine/topic/topic_detail.html b/app/templates/magazine/topic/topic_detail.html index c3a96b4b..b9f48504 100644 --- a/app/templates/magazine/topic/topic_detail.html +++ b/app/templates/magazine/topic/topic_detail.html @@ -63,7 +63,7 @@
{% for article in articles %}
- {% include 'core/inc/generic_card.html' %} + {% include 'magazine/article/includes/article_card.html' %}
{% endfor %}
diff --git a/app/templates/pages/custompage.html b/app/templates/pages/custompage.html index 49c1f476..27967806 100644 --- a/app/templates/pages/custompage.html +++ b/app/templates/pages/custompage.html @@ -43,7 +43,7 @@
{% for object in childrens %} {% if object.in_menus.0 %} - {% include "pages/includes/page_card.html" %} + {% include "pages/includes/page_box.html" %} {% endif %} {% endfor %}
diff --git a/app/templates/pages/includes/page_box.html b/app/templates/pages/includes/page_box.html new file mode 100644 index 00000000..39f4cdf6 --- /dev/null +++ b/app/templates/pages/includes/page_box.html @@ -0,0 +1,18 @@ +{% load mezzanine_tags organization_tags %} + +
+ {% with object.get_content_model.images.all|get_type:'card' as images %} + {% if images %} + + {% endif %} + {% endwith %} +
+
+
+

{{ object.title }}

+
+ {{ object.get_content_model.sub_title }} +
+
+
+
diff --git a/app/templates/pages/includes/page_card.html b/app/templates/pages/includes/page_card.html index 39f4cdf6..7a900714 100644 --- a/app/templates/pages/includes/page_card.html +++ b/app/templates/pages/includes/page_card.html @@ -1,18 +1,32 @@ -{% load mezzanine_tags organization_tags %} - -
- {% with object.get_content_model.images.all|get_type:'card' as images %} - {% if images %} - - {% endif %} - {% endwith %} -
-
-
-

{{ object.title }}

-
- {{ object.get_content_model.sub_title }} -
-
-
-
+{% 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 %} +
+ +
+ {% endif %} + {% endwith %} +{% endblock %} + +{% block content %} + {{ page.description|richtext_filters|safe|truncatechars_html:200 }} +{% endblock %} + +{% block subtitle %} + {{ page.sub_title }} +{% endblock %} diff --git a/app/templates/pages/page.html b/app/templates/pages/page.html index 5401ab00..c5545de6 100644 --- a/app/templates/pages/page.html +++ b/app/templates/pages/page.html @@ -116,14 +116,18 @@ {% include "core/inc/block.html" %} {% endwith %} {% endblock %} + {% block related_project %} + {% endblock %} + {% block logo %} + {% endblock %} +
+ +
{% 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 %}
+ {% endblock %} diff --git a/app/templates/pages/teampage.html b/app/templates/pages/teampage.html index b22e1097..f047bfb4 100644 --- a/app/templates/pages/teampage.html +++ b/app/templates/pages/teampage.html @@ -43,7 +43,7 @@
{% for children in childrens %} {% with children as object %} - {% include "pages/includes/page_card.html" %} + {% include "pages/includes/page_box.html" %} {% endwith %} {% endfor %}