mirror of
https://github.com/nikdoof/vapemap.git
synced 2025-12-13 22:42:14 +00:00
Split out online and retail store sections.
This commit is contained in:
76
app/stores/templates/stores/store_online_list.html
Normal file
76
app/stores/templates/stores/store_online_list.html
Normal file
@@ -0,0 +1,76 @@
|
||||
{% extends "base.html" %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %}
|
||||
Stores
|
||||
{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
<style type="text/css" xmlns="http://www.w3.org/1999/html">
|
||||
#map-canvas-stores {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
|
||||
<script type="text/javascript" src="{% static "js/gmap.js" %}"></script>
|
||||
<script type="text/javascript">
|
||||
var stores = [
|
||||
{% for store in store_list %}{% if store.address.geo_latitude %}['{{ store }}', {{ store.address.geo_latitude }}, {{ store.address.geo_longitude }}, {{ store.store_type }}, '{% url "store-detail" store.slug %}'],{% endif %}
|
||||
{% endfor %}
|
||||
];
|
||||
$(document).ready(function(){initialize_map(stores, document.getElementById("map-canvas-stores"))});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-header">
|
||||
<h1>Stores</h1>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span7">
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<form method="get">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search" value="{{ search_query }}">
|
||||
</form>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<a href="{% url "store-create" %}" class="btn btn-small pull-right">Submit A Store</a>
|
||||
</div>
|
||||
</div>
|
||||
{% if store_list.count %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Country</th><th>Website</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for store in store_list %}
|
||||
<tr>
|
||||
<td><a href="{% url "store-detail" store.slug %}">{{ store }}</a></td>
|
||||
<td>{{ store.address.country }}</td>
|
||||
<td><a href="{{ store.website }}">Website</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% include "stores/paginator.html" %}
|
||||
{% else %}
|
||||
{% if search_query %}
|
||||
<p>No results found for the search "{{ search_query }}".</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="span5">
|
||||
<div id="map-canvas-stores" class="map">
|
||||
<noscript>
|
||||
You need Javascript enabled to view the map.
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -12,6 +12,8 @@ urlpatterns = patterns('',
|
||||
url(r'^chains/(?P<slug>.*)/$', ChainDetailView.as_view(), name='chain-detail'),
|
||||
|
||||
url(r'^stores/$', StoreListView.as_view(), name='store-list'),
|
||||
url(r'^stores/retail/$', RetailStoreListView.as_view(), name='store-retail-list'),
|
||||
url(r'^stores/online/$', OnlineStoreListView.as_view(), name='store-online-list'),
|
||||
url(r'^stores/create/$', StoreCreateView.as_view([AddressForm, StoreForm]), name='store-create'),
|
||||
url(r'^stores/search/$', DistanceSearchView.as_view(), name='store-search'),
|
||||
url(r'^stores/(?P<slug>.*)/claim/$', ClaimCreateView.as_view(target_model=Store), name='store-claim'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from .stores import StoreListView, StoreDetailView, StoreUpdateView, StoreCreateView
|
||||
from .stores import StoreListView, OnlineStoreListView, RetailStoreListView, StoreDetailView, StoreUpdateView, StoreCreateView
|
||||
from .chains import ChainListView, ChainDetailView
|
||||
from .search import DistanceSearchView
|
||||
from .claims import ClaimCreateView
|
||||
|
||||
@@ -27,6 +27,21 @@ class StoreListView(HaystackSearchListMixin, ListView):
|
||||
return qs.filter(active=True).select_related('address', 'address__country')
|
||||
|
||||
|
||||
class OnlineStoreListView(StoreListView):
|
||||
template_name_suffix = '_online_list'
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super(OnlineStoreListView, self).get_queryset()
|
||||
return qs.filter(store_type__in=[Store.STORE_TYPE_ONLINE, Store.STORE_TYPE_BOTH])
|
||||
|
||||
|
||||
class RetailStoreListView(StoreListView):
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super(RetailStoreListView, self).get_queryset()
|
||||
return qs.filter(store_type__in=[Store.STORE_TYPE_ONLINE, Store.STORE_TYPE_BOTH])
|
||||
|
||||
|
||||
class StoreDetailView(EditorCheckMixin, DetailView):
|
||||
model = Store
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
<div class="container">
|
||||
<ul class="nav">
|
||||
<li><a href="{% url "map" %}">Map</a></li>
|
||||
<li><a href="{% url "store-list" %}">Stores</a></li>
|
||||
<li><a href="{% url "store-retail-list" %}">Retail Stores</a></li>
|
||||
<li><a href="{% url "store-online-list" %}">Online Stores</a></li>
|
||||
<li><a href="{% url "chain-list" %}">Chains</a></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
|
||||
Reference in New Issue
Block a user