]> git.parisson.com Git - mezzo.git/commitdiff
Templating : symplifying blocks call
authorEmilie <zawadzki@ircam.fr>
Wed, 26 Oct 2016 15:49:28 +0000 (17:49 +0200)
committerEmilie <zawadzki@ircam.fr>
Wed, 26 Oct 2016 15:49:28 +0000 (17:49 +0200)
app/templates/pages/custompage.html
app/templates/pages/departmentpage.html
app/templates/pages/page.html
app/templates/pages/teampage.html

index 60d781f7400fa1a5f60b59033861c6d2d41c6ceb..406bdf5be6be147f3cb3dd6a536c226829d89ece 100644 (file)
 {% 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 %}
-        <h1 class="dotted">{{ page.custompage.title }}</h1>
-    {% 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 %}
-            <div class="chapo">
-                {{ page.custompage.sub_title }}
-            </div>
+    {% block page_title %}
+        {% editable page.custompage.title %}
+            <h1 class="dotted">{{ page.custompage.title }}</h1>
         {% 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 %}
-            <div class="page__childrens">
-                {% for object in childrens %}
-                    {% if object.in_menus.0 %}
-                      {% include "pages/includes/page_box.html" %}
-                    {% endif %}
-                {% endfor %}
-            </div>
+        {% if page.custompage.sub_title %}
+            {% editable page.custompage.sub_title %}
+                <div class="chapo">
+                    {{ page.custompage.sub_title }}
+                </div>
+            {% 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 %}
+                <div class="page__childrens">
+                    {% for child in childrens %}
+                        {% if child.in_menus.0 %}
+                          {% with child as object %}
+                            {% include "pages/includes/page_box.html" %}
+                          {% endwith %}
+                        {% endif %}
+                    {% endfor %}
+                </div>
+            {% 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 %}
-            <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
-                <div class="white-bg pb2">
-                    <div class="container">
-                        <div class="row" data-summary-content>
-                            <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
-                                <ul class="partners-list">
-                                    {% include 'core/inc/logo.html' %}
-                                </ul>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        {% 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 %}
index a47829e8c0e9f52820f6c88c241576eceff78d41..c3a459d98d8398d42b3ec1a8ec4433f50caa059e 100644 (file)
@@ -11,7 +11,7 @@
 
 {% block page_title %}
 
-    {% editable page.departmentpage.title %}
+    {% editable page.departmentpage.sub_title %}
         <h1 class="dashed">{{ page.departmentpage.sub_title }}</h1>
     {% endeditable %}
 
 
 {% 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 %}
         </div>
     {% 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 %}
-            <div class="white-bg">
-                <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
-                    <div class="container">
-                        <div class="row" data-summary-content>
-                            <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
-                                <ul class="partners-list">
-                                    {% include 'core/inc/logo.html' %}
-                                </ul>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        {% endif %}
-    {% endwith %}
-{% endblock %}
index c645fab1d30880982709dc8e236f8a870576dd52..e86c36eac6616e9d27737e86f95cda0ceadac805 100644 (file)
             {% 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 %}
+                        <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
+                            <div class="white-bg pb2">
+                                <div class="container">
+                                    <div class="row" data-summary-content>
+                                        <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
+                                            <ul class="partners-list">
+                                                {% include 'core/inc/logo.html' %}
+                                            </ul>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    {% endif %}
+                {% endwith %}
             {% endblock %}
 
         </div>
index 1126e7460cdeb2b536a679f894421c43e237b9a8..f262eadfb29a6b7103fe7355479d4367230e305d 100644 (file)
@@ -14,8 +14,8 @@
 {% endblock %}
 
 {% block page_title %}
-    {% editable page.teampage.title %}
-        <h1 class="dotted">{{ page.teampage.title }}</h1>
+    {% editable page.title %}
+        <h1 class="dotted">{{ page.title }}</h1>
     {% endeditable %}
 {% endblock %}
 
 
 {% 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 %}
 {% 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 %}
-            <div class="page__block{% if block.background_color %} page__block--{{ block.background_color }}{% endif %}">
-                <div class="white-bg pb2">
-                    <div class="container">
-                        <div class="row" data-summary-content>
-                            <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2">
-                                <ul class="partners-list">
-                                    {% include 'core/inc/logo.html' %}
-                                </ul>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        {% endif %}
-    {% endwith %}
-{% endblock %}