Răsfoiți Sursa

PEP-8 and template cleanup
- Resolves #88

Scot Hacker 8 ani în urmă
părinte
comite
7c79832caf

+ 0 - 1
bakerydemo/locations/models.py

@@ -8,7 +8,6 @@ from modelcluster.fields import ParentalKey
 
 from wagtail.wagtailcore.fields import StreamField
 from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, StreamFieldPanel
-
 from wagtail.wagtailcore.models import Orderable, Page
 from wagtail.wagtailsearch import index
 from wagtail.wagtailimages.edit_handlers import ImageChooserPanel

+ 0 - 8
bakerydemo/templates/base/home_page.html

@@ -118,11 +118,3 @@
 </div>
 </div>
 {% endblock content %}
-
-HERO
-----
-promo | bread
------
-Blog x3
------
-Location x 6

+ 0 - 2
bakerydemo/templates/blocks/blockquote.html

@@ -1,7 +1,5 @@
 {% load wagtailimages_tags %}
 
-
 <blockquote><p class="text">{{ self.text }}</p>
 <footer><p class="attribute_name">{{ self.attribute_name}}</p></footer>
 </blockquote>
-

+ 5 - 5
bakerydemo/templates/blocks/heading_block.html

@@ -1,3 +1,8 @@
+{% comment %}
+    Content is coming from the StandardBlock StreamField
+    class within `blocks.py`
+{% endcomment %}
+
 {% if self.size == 'h2' %}
         <h2>{{ self.heading_text }}</h2>
 
@@ -8,8 +13,3 @@
         <h4>{{ self.heading_text }}</h4>
 
 {% endif %}
-
-{% comment %}
-    Content is coming from the StandardBlock StreamField
-    class within `blocks.py`
-{% endcomment %}

+ 31 - 30
bakerydemo/templates/blog/blog_page.html

@@ -3,41 +3,42 @@
 
 {% block content %}
 
-{% image self.image fill-1920x600 as hero_img %}
-    {% include "base/include/header-hero.html" %}
+    {% image self.image fill-1920x600 as hero_img %}
+        {% include "base/include/header-hero.html" %}
 
-<div class="container">
-    <div class="row">
-        <div class="col-md-8">
-            {% if page.introduction %}
-                <p class="intro">{{ page.introduction }}</p>
-            {% endif %}
+    <div class="container">
+        <div class="row">
+            <div class="col-md-8">
+                {% if page.introduction %}
+                    <p class="intro">{{ page.introduction }}</p>
+                {% endif %}
 
-            <div class="blog-meta">
-                {% if page.authors %}
-                <div class="blog-avatars">
-                    {% for author in page.authors %}
-                        <div class="author">{% image author.image fill-50x50-c100 class="blog-avatar" %} {{ author.first_name }} {{ author.last_name }}</div>
-                    {% endfor %}
+                <div class="blog-meta">
+                    {% if page.authors %}
+                        <div class="blog-avatars">
+                            {% for author in page.authors %}
+                                <div class="author">{% image author.image fill-50x50-c100 class="blog-avatar" %}
+                                    {{ author.first_name }} {{ author.last_name }}</div>
+                            {% endfor %}
+                        </div>
+                    {% endif %}
+
+                    {% if page.date_published %}
+                        <div class="blog-byline">
+                            {{ page.date_published }}
+                        </div>
+                    {% endif %}
                 </div>
-                {% endif %}
-                
-                {% if page.date_published %}
-                    <div class="blog-byline">
-                        {{ page.date_published }}
-                    </div>
-                {% endif %}
-            </div>
 
-            {{ page.body }}
+                {{ page.body }}
 
-            {% if page.get_tags %}
-                Tagged with:<br />
-                {% for tag in page.get_tags  %}
-                    <a href="{{ tag.url }}" class="btn btn-sm">{{ tag }}</a>
-                {% endfor %}
-            {% endif %}
+                {% if page.get_tags %}
+                    Tagged with:<br />
+                    {% for tag in page.get_tags  %}
+                        <a href="{{ tag.url }}" class="btn btn-sm">{{ tag }}</a>
+                    {% endfor %}
+                {% endif %}
+            </div>
         </div>
     </div>
-</div>
 {% endblock content %}

+ 49 - 52
bakerydemo/templates/breads/bread_page.html

@@ -2,66 +2,63 @@
 {% load wagtailimages_tags %}
 
 {% block content %}
-<div class="container bread-detail">
-    <div class="row">
-        <div class="col-md-12">
-            <div class="col-md-6">
-                <div class="row">
-                    <h1>{{ page.title }}</h1>
-                    
-                    <figure class="hidden-md-up">
-                        {% image page.image width-500 %}
-                    </figure>
-                    
-                    {% if page.introduction %}
-                        <p class="introduction">
-                            {{ page.introduction }}
-                        </p>
-                    {% endif %}
+    <div class="container bread-detail">
+        <div class="row">
+            <div class="col-md-12">
+                <div class="col-md-6">
+                    <div class="row">
+                        <h1>{{ page.title }}</h1>
 
-                    {{ page.body }}
-                </div>
-            </div>
+                        <figure class="hidden-md-up">
+                            {% image page.image width-500 %}
+                        </figure>
 
-            <div class="col-md-5 col-md-offset-1">
-                <div class="row">
-                    <figure class="hidden-md-down">
-                        {% image page.image width-500 %}
-                    </figure>
-                    <ul class="bread-meta">
-                        {% if page.origin %}
-                            <li>
-                                <h4>Origin</h4>
-                                <p>{{ page.origin }}</p>
-                            </li>
-                        {% endif %}
-                        {% if page.bread_type %}
-                            <li>
-                                <h4>Type</h4>
-                                <p>{{ page.bread_type }}</p>
-                            </li>      
+                        {% if page.introduction %}
+                            <p class="introduction">
+                                {{ page.introduction }}
+                            </p>
                         {% endif %}
-                        {% with ingredients=page.ingredients.all %}
-                            {% if ingredients %}
+
+                        {{ page.body }}
+                    </div>
+                </div>
+
+                <div class="col-md-5 col-md-offset-1">
+                    <div class="row">
+                        <figure class="hidden-md-down">
+                            {% image page.image width-500 %}
+                        </figure>
+                        <ul class="bread-meta">
+                            {% if page.origin %}
                                 <li>
-                                    <h4>Ingredients</h4>
-                                    <ul>
-                                        {% for ingredient in ingredients %}
-                                            <li>
-                                                {{ ingredient.name }}
-                                            </li>
-                                        {% endfor %}
-                                    </ul>
+                                    <h4>Origin</h4>
+                                    <p>{{ page.origin }}</p>
                                 </li>
                             {% endif %}
-                        {% endwith %}
-                    </ul>
+                            {% if page.bread_type %}
+                                <li>
+                                    <h4>Type</h4>
+                                    <p>{{ page.bread_type }}</p>
+                                </li>
+                            {% endif %}
+                            {% with ingredients=page.ingredients.all %}
+                                {% if ingredients %}
+                                    <li>
+                                        <h4>Ingredients</h4>
+                                        <ul>
+                                            {% for ingredient in ingredients %}
+                                                <li>
+                                                    {{ ingredient.name }}
+                                                </li>
+                                            {% endfor %}
+                                        </ul>
+                                    </li>
+                                {% endif %}
+                            {% endwith %}
+                        </ul>
+                    </div>
                 </div>
             </div>
         </div>
-
-
-        </div>
     </div>
-</div>
 {% endblock content %}

+ 26 - 28
bakerydemo/templates/breads/breads_index_page.html

@@ -2,27 +2,27 @@
 {% load wagtailcore_tags navigation_tags wagtailimages_tags %}
 
 {% block content %}
-<div class="container">
-    <div class="row">
-        <div class="col-md-12">
-            <h1>{{ page.title }}</h1>
-            <p>{{ page.introduction}}</p>
+    <div class="container">
+        <div class="row">
+            <div class="col-md-12">
+                <h1>{{ page.title }}</h1>
+                <p>{{ page.introduction}}</p>
+            </div>
         </div>
     </div>
-</div>
 
-<div class="container">
-    <div class="row bread-list">
-    {% for bread in breads %}
+    <div class="container">
+        <div class="row bread-list">
+        {% for bread in breads %}
             <div class="col-xs-12 col-md-6 bread-list-item">
-            
                 <div class="row">
                     <div class="col-xs-4 col-sm-4 image">
-                    <a href="{% pageurl bread %}">
-                        {% image bread.image fill-180x180-c100 as image %}
-                                        <img src="{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}" alt="{{ image.alt }}" class="" />
-                        </div>
-                    </a>
+                        <a href="{% pageurl bread %}">
+                            {% image bread.image fill-180x180-c100 as image %}
+                            <img src="{{ image.url }}" width="{{ image.width }}"
+                                height="{{ image.height }}" alt="{{ image.alt }}" class="" />
+                        </a>
+                    </div>
                     <div class="col-xs-6 col-sm-7">
                         <a href="{% pageurl bread %}">
                             <h2>{{ bread.title }}</h2>
@@ -32,25 +32,23 @@
                             <li><span>Origin</span> {{ bread.origin }}</li>
                         {% endif %}
                         {% if bread.bread_type %}
-                            <li><span>Type</span> {{ bread.bread_type }}</li>        
+                            <li><span>Type</span> {{ bread.bread_type }}</li>
                         {% endif %}
                         </ul>
                     </div>
                 </div>
-            </a>
             </div>
-    {% endfor %}
+        {% endfor %}
+        </div>
     </div>
-</div>
 
-
-{% if breads.paginator.count > 1 %}
-<div class="container">
-    <div class="row">
-        <div class="col-md-12">
-        {% include "includes/pagination.html" with subpages=breads %}
+    {% if breads.paginator.count > 1 %}
+        <div class="container">
+            <div class="row">
+                <div class="col-md-12">
+                {% include "includes/pagination.html" with subpages=breads %}
+                </div>
+            </div>
         </div>
-    </div>
-</div>
-{% endif %}
+    {% endif %}
 {% endblock content %}

+ 1 - 0
bakerydemo/templates/includes/header.html

@@ -1,4 +1,5 @@
 {% load navigation_tags %}
+
 <div class="header clearfix" role="banner">
     <div class="container">
         <div class="row">