Procházet zdrojové kódy

Add support for location open/close preview

Thibaud Colas před 1 měsícem
rodič
revize
99e6906ebd
1 změnil soubory, kde provedl 12 přidání a 3 odebrání
  1. 12 3
      bakerydemo/templates/locations/location_page.html

+ 12 - 3
bakerydemo/templates/locations/location_page.html

@@ -30,9 +30,18 @@
                                 as a Wagtail API usage example and to allow for
                                 caching of the whole page without the status.
                             {% endcomment %}
-                            <location-status url="{% url 'wagtailapi:pages:detail' page.pk %}">
-                                Please wait...
-                            </location-status>
+                            {% if request.is_preview %}
+                                {% if page.is_open %}
+                                    This location is currently open.
+                                {% else %}
+                                    Sorry, this location is currently closed.
+                                {% endif %}
+                            {% else %}
+                                <location-status url="{% url 'wagtailapi:pages:detail' page.pk %}">
+                                    Please wait…
+                                </location-status>
+                            {% endif %}
+
 
                             <h2 class="location__meta-title">Address</h2>
                             <address>{{ page.address|linebreaks }}</address>