From: Emilie Date: Wed, 26 Oct 2016 15:49:28 +0000 (+0200) Subject: Templating : symplifying blocks call X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c56e5b32a447f48a91271a5cb2fb6ae527c59915;p=mezzo.git Templating : symplifying blocks call --- diff --git a/app/templates/pages/custompage.html b/app/templates/pages/custompage.html index 60d781f7..406bdf5b 100644 --- a/app/templates/pages/custompage.html +++ b/app/templates/pages/custompage.html @@ -1,121 +1,93 @@ {% extends "pages/page.html" %} {% load i18n mezzanine_tags keyword_tags pages_tags organization_tags %} -{% block page_class %} - custompage -{% endblock %} - -{% block body_class %} - {% with page.get_ascendants|last as top_level_parent %} - {% if top_level_parent.get_content_model.weaving_css_class %} - pattern pattern-bg {{ top_level_parent.get_content_model.weaving_css_class }} - {% endif %} - {% endwith %} -{% endblock %} - -{% block page_title %} - {% editable page.custompage.title %} -

{{ page.custompage.title }}

- {% endeditable %} -{% endblock %} - -{% block page_content %} + {% with page.custompage as object %} + {% block page_class %} + custompage + {% endblock %} + + {% block body_class %} + {% with page.get_ascendants|last as top_level_parent %} + {% if top_level_parent.get_content_model.weaving_css_class %} + pattern pattern-bg {{ top_level_parent.get_content_model.weaving_css_class }} + {% endif %} + {% endwith %} + {% endblock %} - {% if page.custompage.sub_title %} - {% editable page.custompage.sub_title %} -
- {{ page.custompage.sub_title }} -
+ {% block page_title %} + {% editable page.custompage.title %} +

{{ page.custompage.title }}

{% endeditable %} - {% endif %} + {% endblock %} - {% if page.custompage.content %} - {% editable page.custompage.content %} - {{ page.custompage.content|richtext_filters|safe }} - {% endeditable %} - {% endif %} + {% block page_content %} - {% if page.get_ascendants|length == 1 %} - {% children_pages page.id as childrens %} - {% if childrens %} -
- {% for object in childrens %} - {% if object.in_menus.0 %} - {% include "pages/includes/page_box.html" %} - {% endif %} - {% endfor %} -
+ {% if page.custompage.sub_title %} + {% editable page.custompage.sub_title %} +
+ {{ page.custompage.sub_title }} +
+ {% endeditable %} {% endif %} - {% endif %} -{% endblock %} + {% if page.custompage.content %} + {% editable page.custompage.content %} + {{ page.custompage.content|richtext_filters|safe }} + {% endeditable %} + {% endif %} -{% block page_audio %} - {% with page.custompage as object %} - {{ block.super }} - {% endwith %} -{% endblock %} + {% if page.get_ascendants|length == 1 %} + {% children_pages page.id as childrens %} + {% if childrens %} +
+ {% for child in childrens %} + {% if child.in_menus.0 %} + {% with child as object %} + {% include "pages/includes/page_box.html" %} + {% endwith %} + {% endif %} + {% endfor %} +
+ {% endif %} + {% endif %} -{% block page_slider %} - {% with page.custompage as object %} - {{ block.super }} - {% endwith %} -{% endblock %} + {% endblock %} -{% block page_video %} - {% with page.custompage as object %} - {{ block.super }} - {% endwith %} -{% endblock %} + {% block page_audio %} + {% with page.custompage as object %} + {{ block.super }} + {% endwith %} + {% endblock %} -{% block page_person_list %} - {% for page_custom_person_list_block_inline in page.custompage.page_custom_person_list_block_inlines.all %} - {% with page_custom_person_list_block_inline.person_list_block as person_list_block %} - {% with "network/inc/person/list_"|add:person_list_block.style|add:"_style.html" as template %} - {% include template %} - {% endwith %} + {% block page_slider %} + {% with page.custompage as object %} + {{ block.super }} {% endwith %} - {% endfor %} -{% endblock %} - -{% block page_sub_content %} - {% with page.custompage.blocks.all as blocks %} - {% include "core/inc/block.html" %} - {% endwith %} -{% endblock %} - -{% block page_related_content %} - {{ block.super }} -{% endblock %} - -{% block products %} - {% if page.custompage.product_lists.all|length > 0 %} - {% for page_product_list in page.custompage.product_lists.all %} - {% with page_product_list.list as list %} - {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %} - {% include template %} + {% endblock %} + + {% block page_video %} + {% with page.custompage as object %} + {{ block.super }} + {% endwith %} + {% endblock %} + + {% block page_person_list %} + {% for page_custom_person_list_block_inline in page.custompage.page_custom_person_list_block_inlines.all %} + {% with page_custom_person_list_block_inline.person_list_block as person_list_block %} + {% with "network/inc/person/list_"|add:person_list_block.style|add:"_style.html" as template %} + {% include template %} + {% endwith %} {% endwith %} - {% endwith %} {% endfor %} - {% endif %} -{% endblock %} + {% endblock %} -{% block logo %} - {% with page.custompage.images.all|get_type:'logo' as images %} - {% if images %} -
-
-
-
-
-
    - {% include 'core/inc/logo.html' %} -
-
-
-
-
-
- {% endif %} - {% endwith %} -{% endblock %} + {% block page_sub_content %} + {% with page.custompage.blocks.all as blocks %} + {% include "core/inc/block.html" %} + {% endwith %} + {% endblock %} + + {% block page_related_content %} + {{ block.super }} + {% endblock %} +{% endwith %} diff --git a/app/templates/pages/departmentpage.html b/app/templates/pages/departmentpage.html index a47829e8..c3a459d9 100644 --- a/app/templates/pages/departmentpage.html +++ b/app/templates/pages/departmentpage.html @@ -11,7 +11,7 @@ {% block page_title %} - {% editable page.departmentpage.title %} + {% editable page.departmentpage.sub_title %}

{{ page.departmentpage.sub_title }}

{% endeditable %} @@ -34,34 +34,26 @@ {% endblock %} -{% block page_link %} - {% with page.departmentpage.links.all as links %} - {% if links %} - {% include 'core/inc/link.html' %} - {% endif %} - {% endwith %} -{% endblock %} - {% block page_audio %} - {% with page.departmentpage as object %} + {% with page as object %} {{ block.super }} {% endwith %} {% endblock %} {% block page_slider %} - {% with page.departmentpage as object %} + {% with page as object %} {{ block.super }} {% endwith %} {% endblock %} {% block page_video %} - {% with page.departmentpage as object %} + {% with page as object %} {{ block.super }} {% endwith %} {% endblock %} {% block page_sub_content %} - {% with page.departmentpage.blocks.all as blocks %} + {% with page.blocks.all as blocks %} {% include "core/inc/block.html" %} {% endwith %} {% endblock %} @@ -89,35 +81,3 @@ {% endif %} {% endblock %} - -{% block products %} - {% if page.departmentpage.product_lists.all|length > 0 %} - {% for page_product_list in page.departmentpage.product_lists.all %} - {% with page_product_list.list as list %} - {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %} - {% include template %} - {% endwith %} - {% endwith %} - {% endfor %} - {% endif %} -{% endblock %} - -{% block logo %} - {% with page.departmentpage.images.all|get_type:'logo' as images %} - {% if images %} -
-
-
-
-
-
    - {% include 'core/inc/logo.html' %} -
-
-
-
-
-
- {% endif %} - {% endwith %} -{% endblock %} diff --git a/app/templates/pages/page.html b/app/templates/pages/page.html index c645fab1..e86c36ea 100644 --- a/app/templates/pages/page.html +++ b/app/templates/pages/page.html @@ -121,12 +121,38 @@ {% endblock %} {% block products %} + {% if page.product_lists.all|length > 0 %} + {% for page_product_list in page.product_lists.all %} + {% with page_product_list.list as list %} + {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %} + {% include template %} + {% endwith %} + {% endwith %} + {% endfor %} + {% endif %} {% endblock %} {% block page_sub_content_2 %} {% endblock %} {% block logo %} + {% with page.images.all|get_type:'logo' as images %} + {% if images %} +
+
+
+
+
+
    + {% include 'core/inc/logo.html' %} +
+
+
+
+
+
+ {% endif %} + {% endwith %} {% endblock %} diff --git a/app/templates/pages/teampage.html b/app/templates/pages/teampage.html index 1126e746..f262eadf 100644 --- a/app/templates/pages/teampage.html +++ b/app/templates/pages/teampage.html @@ -14,8 +14,8 @@ {% endblock %} {% block page_title %} - {% editable page.teampage.title %} -

{{ page.teampage.title }}

+ {% editable page.title %} +

{{ page.title }}

{% endeditable %} {% endblock %} @@ -50,34 +50,26 @@ {% endblock %} -{% block page_link %} - {% with page.teampage.links.all as links %} - {% if links %} - {% include 'core/inc/link.html' %} - {% endif %} - {% endwith %} -{% endblock %} - {% block page_audio %} - {% with page.teampage as object %} + {% with page as object %} {{ block.super }} {% endwith %} {% endblock %} {% block page_slider %} - {% with page.teampage as object %} + {% with page as object %} {{ block.super }} {% endwith %} {% endblock %} {% block page_video %} - {% with page.teampage as object %} + {% with page as object %} {{ block.super }} {% endwith %} {% endblock %} {% block page_sub_content %} - {% with page.teampage.blocks.all|slice:'1' as blocks %} + {% with page.blocks.all|slice:'1' as blocks %} {% include "core/inc/block.html" %} {% endwith %} {% endblock %} @@ -120,40 +112,7 @@ {% endblock %} {% block page_sub_content_2 %} - {% with page.teampage.blocks.all|slice:'1:' as blocks %} + {% with page.blocks.all|slice:'1:' as blocks %} {% include "core/inc/block.html" %} {% endwith %} {% endblock %} - -{% block products %} - {% if page.teampage.product_lists.all|length > 0 %} - {% for page_product_list in page.teampage.product_lists.all %} - {% with page_product_list.list as list %} - {% with "shop/includes/product_list_"|add:list.style|add:"_style.html" as template %} - {% include template %} - {% endwith %} - {% endwith %} - {% endfor %} - {% endif %} -{% endblock %} - - -{% block logo %} - {% with page.teampage.images.all|get_type:'logo' as images %} - {% if images %} -
-
-
-
-
-
    - {% include 'core/inc/logo.html' %} -
-
-
-
-
-
- {% endif %} - {% endwith %} -{% endblock %}