Browse Source

Fix location maps by bubbling head-extra up through base.html

Scot Hacker 8 năm trước cách đây
mục cha
commit
8fb66fc8fc

+ 3 - 3
bakerydemo/locations/models.py

@@ -79,7 +79,7 @@ class LocationsIndexPage(Page):
 
 class LocationPage(Page):
     """
-    Detail for a specific location
+    Detail for a specific bakery location.
     """
 
     address = models.TextField()
@@ -93,11 +93,11 @@ class LocationPage(Page):
     lat_long = models.CharField(
         max_length=36,
         help_text="Comma separated lat/long. (Ex. 64.144367, -21.939182) \
-                   Right click Google Maps and click 'What\'s Here'",
+                   Right click Google Maps and select 'What\'s Here'",
         validators=[
             RegexValidator(
                 regex='^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$',
-                message='Lat Long must be a comma separated numeric lat and long',
+                message='Lat Long must be a comma-separated numeric lat and long',
                 code='invalid_lat_long'
             ),
         ]

+ 4 - 1
bakerydemo/templates/base.html

@@ -12,11 +12,14 @@
     {# Header contains the main_navigation block #}
 {% endblock header %}
 
+{% block head-extra %}
+{% endblock head-extra %}
+
 {% block messages %}
     {% include "includes/messages.html" %}
 {% endblock messages %}
 
-    <content> 
+    <content>
         {% block content-header %}
         {% endblock content-header %}
 

+ 1 - 1
bakerydemo/templates/base/home_page.html

@@ -6,7 +6,7 @@
 
     <div class="image">
         {% image page.image width-500 as photo %}
-              <img src="{{ photo.url }}" width="{{ photo.width }}" height="{{ photo.height }}" alt="{{ photo.alt }}" />
+        <img src="{{ photo.url }}" width="{{ photo.width }}" height="{{ photo.height }}" alt="{{ photo.alt }}" />
     </div>
 {% endblock content-header %}
 

+ 6 - 6
bakerydemo/templates/locations/location_page.html

@@ -26,10 +26,13 @@
 {% endblock content-header %}
 
 {% block content-body %}
-    <p>{{ page.address }}</p>
-    <p>{{ page.lat_long }}</p>
-
+    <p>{{ page.address|linebreaks }}</p>
     <div id="map" class="maps embed-container"></div>
+
+    {% for hours in page.opening_hours %}
+        <li>{{ hours }}</li>
+    {% endfor %}
+
     <script>
       var map;
       function initMap() {
@@ -52,7 +55,4 @@
     </script>
     <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD31CT9P9KxvNUJOwDq2kcFEIG8ADgaFgw&callback=initMap" async defer></script>
 
-    {% for hours in page.opening_hours %}
-        <li>{{ hours }}</li>
-    {% endfor %}
 {% endblock content-body %}