]> git.parisson.com Git - mezzo.git/commitdiff
Add a generic block template (see custompage.html)
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 25 Aug 2016 16:17:00 +0000 (18:17 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 25 Aug 2016 16:17:00 +0000 (18:17 +0200)
app/templates/core/inc/block.html [new file with mode: 0644]
app/templates/pages/custompage.html

diff --git a/app/templates/core/inc/block.html b/app/templates/core/inc/block.html
new file mode 100644 (file)
index 0000000..b404dcc
--- /dev/null
@@ -0,0 +1,27 @@
+{% load i18n mezzanine_tags keyword_tags pages_tags organization_tags %}
+{% if blocks %}
+    <div class="white-bg">
+        <div class="container">
+            <div class="row">
+                <div class="col-sm-12">
+                    <hr class="mt0" />
+                    {% for block in blocks %}
+                        <div class="row" data-summary-content>
+                            <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2 white-bg">
+                                {% if not forloop.first and block.with_separator %}
+                                    <hr />
+                                {% endif %}
+                                <h2 class="dotted">{{ block.title }}</h2>
+                                {% if block.content %}
+                                     {{ block.content|richtext_filters|safe }}
+                                {% else %}
+                                    {% lorem 3 p %}
+                                {% endif %}
+                            </div>
+                        </div>
+                    {% endfor %}
+                </div>
+            </div>
+        </div>
+    </div>
+{% endif %}
index f71622a1a61855b7cabf3901bb7bf3c2b3a6c50a..c2674c9350ecc9f29dd519a23622583d840c27bd 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "pages/page.html" %}
-{% load i18n mezzanine_tags keyword_tags  pages_tags organization_tags %}
+{% load i18n mezzanine_tags keyword_tags pages_tags organization_tags %}
 
 {% block meta_title %}{{ page.meta_title }}{% endblock %}
 
 {% endblock %}
 
 {% block page_sub_content %}
-    {% if page.custompage.blocks.all %}
-        <div class="white-bg">
-            <div class="container">
-                <div class="row">
-                    <div class="col-sm-12">
-                        <hr class="mt0" />
-                        {% for pageblock in page.custompage.blocks.all %}
-                            <div class="row" data-summary-content>
-                                <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2 white-bg">
-                                    {% if not forloop.first and pageblock.with_separator %}
-                                        <hr />
-                                    {% endif %}
-                                    <h2 class="dotted">{{ pageblock.title }}</h2>
-                                    {% if pageblock.content %}
-                                         {{ pageblock.content|richtext_filters|safe }}
-                                    {% else %}
-                                        {% lorem 3 p %}
-                                    {% endif %}
-                                </div>
-                            </div>
-                        {% endfor %}
-                    </div>
-                </div>
-            </div>
-        </div>
-    {% endif %}
+   {% with page.custompage.blocks.all as blocks %}
+     {% include "core/inc/block.html" %}
+  {% endwith %}
 {% endblock %}