Add created/changed datetime support, and improve metadata on stores.

* Added schema.org metadata for stores.
This commit is contained in:
2013-04-11 18:11:58 +01:00
parent f3a2e2c8bd
commit 934062aa46
4 changed files with 259 additions and 72 deletions

View File

@@ -9,7 +9,7 @@
{% block style %}
<style type="text/css" xmlns="http://www.w3.org/1999/html">
.vcard ul {
.store-details ul {
list-style-type: none;
}
#map-canvas-store {
@@ -45,69 +45,76 @@ $(document).ready(function(){initialize_map_store()});
{% endblock %}
{% block content %}
<div class="page-header">
<h1>{{ store.name }}</h1>
</div>
<div class="row-fluid">
<div class="span8">
{% if store.long_description %}
{{ store.long_description|markdown }}
{% else %}
<p>No description / write up available for this store at the moment.</p>
{% endif %}
<p>{% flag_button %}</p>
{% if store.brands.count %}
<h3>Brands Stocked</h3>
<ul>
{% for brand in store.brands.all %}
<li>{% if brand.website %}<a href="{{ brand.website }}">{{ brand }}</a>{% else %}{{ brand }}{% endif %}</li>
{% endfor %}
</ul>
{% endif %}
<div itemscope itemtype="http://schema.org/Place">
<div class="page-header">
<h1 itemtype="name">{{ store.name }}</h1>
</div>
<div class="span4">
{% if user.is_authenticated and not store.editor or user.is_superuser %}
<p>
{% switch claim_support %}{% if not store.editor %}<a href="{% url "store-claim" store.slug %}" class="btn btn-small">Claim Store</a>{% endif %}{% endswitch %}
{% if is_editor %}<a href="{% url "store-update" store.slug %}" class="btn btn-small">Edit Store</a>{% endif %}
{% if user.is_superuser %}<a href="{% url "admin:stores_store_change" store.pk %}" class="btn btn-small">Edit in Admin</a>{% endif %}
</p>
{% endif %}
{% if store.chain %}<p><b>Chain</b>: <a href="{% url "chain-detail" store.chain.slug %}">{{ store.chain }}</a></p>{% endif %}
<p><b>Type</b>: {{ store.get_store_type_display }}</p>
<div class="vcard">
<h3>Address</h3>
<ul class="adr">
<li class="fn">{{ store.name }}</li>
<li class="street-address">{{ store.address.address1 }}</li>
{% if store.address.address2 %}<li>{{ store.address.address2 }}</li>{% endif %}
{% if store.address.address3 %}<li>{{ store.address.address3 }}</li>{% endif %}
<li class="locality">{{ store.address.city }}</li>
{% if store.address.county %}<li class="region">{{ store.address.county }}</li>{% endif %}
<li class="postal-code">{{ store.address.postcode }}</li>
<li class="country-name">{{ store.address.country }}</li>
</ul>
<h3>Contact Details</h3>
<div class="row-fluid">
<div class="span8">
{% if store.long_description %}
<div itemprop="description">
{{ store.long_description|markdown }}
</div>
{% else %}
<p>No description / write up available for this store at the moment.</p>
{% endif %}
<p>{% flag_button %}</p>
{% if store.brands.count %}
<h3>Brands Stocked</h3>
<ul>
{% if store.website %}<li>Website: <a class="url" target="_new" href="{{ store.website }}">{{ store.website }}</a></li>{% endif %}
{% if store.email %}<li>Email: <a class="email" href="mailto:{{ store.email }}">{{ store.email }}</a></li>{% endif %}
{% if store.phone %}<li>Phone: <span class="tel">{{ store.phone }}</span></li>{% endif %}
{% for link in store.links.all %}
<li>{{ link.to_html|safe }}</li>
{% for brand in store.brands.all %}
<li>{% if brand.website %}<a href="{{ brand.website }}">{{ brand }}</a>{% else %}{{ brand }}{% endif %}</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="span4">
{% if user.is_authenticated and not store.editor or user.is_superuser %}
<p>
{% switch claim_support %}{% if not store.editor %}<a href="{% url "store-claim" store.slug %}" class="btn btn-small">Claim Store</a>{% endif %}{% endswitch %}
{% if is_editor %}<a href="{% url "store-update" store.slug %}" class="btn btn-small">Edit Store</a>{% endif %}
{% if user.is_superuser %}<a href="{% url "admin:stores_store_change" store.pk %}" class="btn btn-small">Edit in Admin</a>{% endif %}
</p>
{% endif %}
{% if store.chain %}<p><b>Chain</b>: <a href="{% url "chain-detail" store.chain.slug %}">{{ store.chain }}</a></p>{% endif %}
<p><b>Type</b>: {{ store.get_store_type_display }}</p>
<div class="store-details">
<h3>Address</h3>
<ul itemscope itemtype="http://schema.org/PostalAddress">
<li itemprop="name">{{ store.name }}</li>
<li itemprop="streetAddress">{{ store.address.address1 }}</li>
{% if store.address.address2 %}<li>{{ store.address.address2 }}</li>{% endif %}
{% if store.address.address3 %}<li>{{ store.address.address3 }}</li>{% endif %}
<li itemprop="addressLocality">{{ store.address.city }}</li>
{% if store.address.county %}<li itemprop="addressRegion">{{ store.address.county }}</li>{% endif %}
<li itemprop="postalCode">{{ store.address.postcode }}</li>
<li itemprop="addressCountry">{{ store.address.country }}</li>
</ul>
<div id="map-canvas-store" style="width: 300px; height: 300px;" class="map">
<noscript>
<img alt="Map of {{ store.address.full_address }}" src="https://maps.google.com/maps/api/staticmap?center={{ store.address.geo_latitude }},{{ store.address.geo_longitude }}&zoom=16&markers={{ store.address.geo_latitude }},{{ store.address.geo_longitude }}&size=300x300&sensor=false">
</noscript>
<h3>Contact Details</h3>
<ul itemscope itemtype="http://schema.org/ContactPoint">
{% if store.website %}<li>Website: <a target="_new" href="{{ store.website }}">{{ store.website }}</a></li>{% endif %}
{% if store.email %}<li>Email: <a itemprop="email" href="mailto:{{ store.email }}">{{ store.email }}</a></li>{% endif %}
{% if store.phone %}<li>Phone: <span itemprop="telephone">{{ store.phone }}</span></li>{% endif %}
{% for link in store.links.all %}
<li>{{ link.to_html|safe }}</li>
{% endfor %}
</ul>
<div id="map-canvas-store" style="width: 300px; height: 300px;" class="map">
<noscript>
<img alt="Map of {{ store.address.full_address }}" src="https://maps.google.com/maps/api/staticmap?center={{ store.address.geo_latitude }},{{ store.address.geo_longitude }}&zoom=16&markers={{ store.address.geo_latitude }},{{ store.address.geo_longitude }}&size=300x300&sensor=false">
</noscript>
</div>
<p class="muted">Last Updated: {{ store.changed }}</p>
<p class="hidden" itemprop="geocoordinates"><span class="latitude">{{ store.address.geo_latitude }}</span>, <span class="longitude">{{ store.address.geo_longitude }}</span></p>
</div>
</div>
{% flag_form store %}
</div>
{% flag_form store %}
</div>
{% endblock %}