summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/blog/urls.py14
-rw-r--r--app/blog/views.py64
-rw-r--r--app/guide/urls.py7
-rw-r--r--app/lib/pagination/templatetags/pagination_tags.py6
-rw-r--r--app/lib/pagination/tests.py2
-rw-r--r--app/locations/urls.py5
-rw-r--r--app/locations/views.py14
-rw-r--r--app/photos/urls.py12
-rw-r--r--app/photos/views.py22
-rw-r--r--app/projects/models/code.py2
-rw-r--r--app/projects/urls.py16
-rw-r--r--config/base_urls.py20
-rw-r--r--design/templates/archives/map.html23
-rw-r--r--design/templates/archives/map_data.html145
14 files changed, 143 insertions, 209 deletions
diff --git a/app/blog/urls.py b/app/blog/urls.py
index 57a3e7a..6bd6538 100644
--- a/app/blog/urls.py
+++ b/app/blog/urls.py
@@ -1,15 +1,13 @@
-from django.conf.urls.defaults import *
-from django.views.generic.list_detail import object_list
-from django.views.generic.simple import redirect_to
-
+from django.conf.urls import *
+from django.views.generic.base import RedirectView
from blog.models import Entry
-
+from blog.views import BlogEntryListView
urlpatterns = patterns('',
(r'(?P<slug>[-\w]+)/(?P<page>\d+)/$', 'blog.views.entry_list_by_area'),
- (r'(?P<page>\d+)/$', 'blog.views.entry_list'),
- (r'(?P<slug>[-\w]+)/$', redirect_to, {'url': '/writing/%(slug)s/1/'}),
- (r'', redirect_to, {'url': '/writing/1/'}),
+ (r'(?P<page>\d+)/$', BlogEntryListView.as_view()),
+ (r'(?P<slug>[-\w]+)/$', RedirectView.as_view(url="/writing/%(slug)s/1/")),
+ (r'', RedirectView.as_view(url="/writing/1/")),
)
diff --git a/app/blog/views.py b/app/blog/views.py
index e23acff..67b6f41 100644
--- a/app/blog/views.py
+++ b/app/blog/views.py
@@ -1,22 +1,16 @@
from django.shortcuts import render_to_response,get_object_or_404
from django.template import RequestContext
-from django.views.generic.date_based import object_detail
-from django.views.generic.list_detail import object_list
from django.http import Http404
from django.conf import settings
+from django.views.generic import ListView
-
-from blog.models import Entry, Topic
+from blog.models import Entry
from locations.models import Region, Country
from photos.models import Photo, PhotoGallery
-#from chunks.models import Chunk
def home(request):
- qs = Entry.objects.filter(status__exact=1).select_related()[:4]
- #gallery = PhotoGallery.objects.latest()
context = {
- 'object_list': qs,
- #'gallery': gallery
+ 'object_list': Entry.objects.filter(status__exact=1).select_related()[:4]
}
return render_to_response('archives/homepage.html', context, context_instance = RequestContext(request))
@@ -33,56 +27,40 @@ def entry_detail(request, year, month, day, slug):
"""
List of all writing
"""
-def entry_list(request,page):
- request.page_url = '/writing/%d/'
- request.page = int(page)
- try:
- is_build = request.POST['builder']
- extra_context={
- 'page':page,
- 'MEDIA_URL': settings.BAKED_MEDIA_URL
- }
- except KeyError:
- extra_context={'page':page}
- qs = Entry.objects.filter(status__exact=1).order_by('-pub_date').select_related()
- return object_list(request, queryset=qs, template_name='archives/writing.html',extra_context=extra_context)
+class BlogEntryListView(ListView):
+ template_name="archives/writing.html"
+ model = Entry
+ def get_context_data(self, **kwargs):
+ context = super(BlogEntryListView, self).get_context_data(**kwargs)
+ context.update({
+ 'page': self.kwargs['page']
+ })
+ self.request.page_url = '/writing/%d/'
+ self.request.page = self.kwargs['page']
+ return context
"""
-List of all writing
+Grabs entries by region or country
"""
-def topic_list(request,slug,page):
- request.page_url = '/topics/'+slug+'/%d/'
- request.page = int(page)
- topic = Topic.objects.get(slug=slug)
- qs = Entry.objects.filter(status__exact=1,topics=topic).order_by('-pub_date').select_related()
- return object_list(request, queryset=qs, template_name='archives/topics.html',extra_context={'page':page})
-"""
-Grabs entries by region or country
-"""
def entry_list_by_area(request,slug,page):
request.page_url = '/writing/'+slug+'/%d/'
request.page = int(page)
try:
region = Region.objects.get(slug__exact=slug)
qs = Entry.objects.filter(status__exact=1,region = region).order_by('-pub_date')
- except KeyError:
+ except:
region = Country.objects.get(slug__exact=slug)
qs = Entry.objects.filter(status__exact=1,location__state__country = region).order_by('-pub_date')
if not region:
raise Http404
- try:
- is_build = request.POST['builder']
- extra_context={
- 'region': region,
- 'MEDIA_URL': settings.BAKED_MEDIA_URL
- }
- except:
- extra_context={'region': region,}
- return object_list(request, queryset=qs, template_name='archives/writing.html',
- extra_context=extra_context)
+ context = {
+ 'region': region,
+ 'object_list': qs,
+ }
+ return render_to_response("archives/writing.html", context, context_instance=RequestContext(request))
"""
def about(request):
diff --git a/app/guide/urls.py b/app/guide/urls.py
index 75a24e5..52222fd 100644
--- a/app/guide/urls.py
+++ b/app/guide/urls.py
@@ -1,5 +1,6 @@
-from django.conf.urls.defaults import *
-from django.views.generic.simple import redirect_to
+from django.conf.urls import *
+from django.views.generic.base import RedirectView
+
urlpatterns = patterns('',
(r'location/(?P<location>[-\w]+)/(?P<slug>[-\w]+)/$', 'guide.views.guide_detail'),
@@ -7,5 +8,5 @@ urlpatterns = patterns('',
(r'location/$', 'guide.views.location_list'),
(r'(?P<page>\d+)/$', 'guide.views.guide_list'),
(r'(?P<slug>[-\w]+)/$', 'guide.views.guide_detail'),
- (r'', redirect_to, {'url': '/travel-guide/1/'}),
+ (r'', RedirectView.as_view(url="/travel-guide/1/")),
)
diff --git a/app/lib/pagination/templatetags/pagination_tags.py b/app/lib/pagination/templatetags/pagination_tags.py
index ef9bf5e..dd47009 100644
--- a/app/lib/pagination/templatetags/pagination_tags.py
+++ b/app/lib/pagination/templatetags/pagination_tags.py
@@ -218,8 +218,10 @@ def paginate(context, window=DEFAULT_WINDOW):
if 'use_page_path' in context:
to_return['request'] = context['request']
to_return['use_page_path'] = context['use_page_path']
- to_return['prev_page'] = page_obj.previous_page_number()
- to_return['next_page'] = page_obj.next_page_number()
+ if page_obj.has_previous():
+ to_return['prev_page'] = page_obj.previous_page_number()
+ if page_obj.has_next():
+ to_return['next_page'] = page_obj.next_page_number()
getvars = context['request'].GET.copy()
if 'page' in getvars:
diff --git a/app/lib/pagination/tests.py b/app/lib/pagination/tests.py
index 837e55c..ba55c03 100644
--- a/app/lib/pagination/tests.py
+++ b/app/lib/pagination/tests.py
@@ -49,4 +49,4 @@ u'\\n<div class="pagination">...
>>> t.render(Context({'var': range(21), 'request': RequestProxy()}))
u'\\n<div class="pagination">...
>>>
-""" \ No newline at end of file
+"""
diff --git a/app/locations/urls.py b/app/locations/urls.py
index c49e684..0a2a462 100644
--- a/app/locations/urls.py
+++ b/app/locations/urls.py
@@ -1,7 +1,8 @@
+
from django.conf.urls.defaults import *
-from django.views.generic.simple import redirect_to,direct_to_template
urlpatterns = patterns('',
(r'data/(?P<id>\d+)/$', 'locations.views.data_json'),
- (r'^$', direct_to_template, {'template': 'archives/map.html'}),
+ (r'^$', 'locations.views.map_list'),
)
+
diff --git a/app/locations/views.py b/app/locations/views.py
index f360429..234d867 100644
--- a/app/locations/views.py
+++ b/app/locations/views.py
@@ -4,13 +4,23 @@ from django.template import RequestContext
from blog.models import Entry
from locations.models import Location, Country, Region, Route
-def list_view(request):
+def map_list(request):
context = {
'object_list' : Entry.objects.filter(status__exact=1),
'country_list' : Country.objects.filter(visited=True).exclude(name='default'),
+ 'route_list' : Route.objects.all(),
'region_list' : Region.objects.all()
}
return render_to_response('archives/map.html', context, context_instance=RequestContext(request))
+
+def map_data(request):
+ context = {
+ 'object_list' : Entry.objects.filter(status__exact=1),
+ 'route_list' : Route.objects.all(),
+ 'country_list' : Country.objects.filter(visited=True).exclude(name='default'),
+ 'region_list' : Region.objects.all()
+ }
+ return render_to_response('archives/map_data.html', context, context_instance=RequestContext(request))
from projects.shortcuts import render_to_geojson
@@ -22,4 +32,4 @@ def data_json(request, id):
geom_attribute='geometry',
mimetype = 'application/json',
pretty_print=True
- ) \ No newline at end of file
+ )
diff --git a/app/photos/urls.py b/app/photos/urls.py
index d917d85..9ae065d 100644
--- a/app/photos/urls.py
+++ b/app/photos/urls.py
@@ -1,13 +1,11 @@
-from django.conf.urls.defaults import *
-from django.views.generic import list_detail
-from django.views.generic.simple import redirect_to
-
+from django.conf.urls import *
+from django.views.generic.base import RedirectView
urlpatterns = patterns('',
(r'data/(?P<slug>[-\w]+)/$', 'photos.views.photo_json'),
(r'galleries/(?P<slug>[-\w]+)/$', 'photos.views.gallery'),
(r'(?P<page>\d+)/$', 'photos.views.gallery_list'),
- (r'(?P<slug>[-\w]+)/$', redirect_to, {'url': '/photos/%(slug)s/1/'}),
- (r'', redirect_to, {'url': '/photos/1/'}),
-) \ No newline at end of file
+ (r'(?P<slug>[-\w]+)/$', RedirectView.as_view(url="/photos/%(slug)s/1/")),
+ (r'', RedirectView.as_view(url="/photos/1/")),
+)
diff --git a/app/photos/views.py b/app/photos/views.py
index 7d10841..0c413e0 100644
--- a/app/photos/views.py
+++ b/app/photos/views.py
@@ -1,9 +1,8 @@
from django.shortcuts import render_to_response,get_object_or_404
from django.template import RequestContext
-from django.views.generic.list_detail import object_list
from django.http import Http404,HttpResponse
from django.core import serializers
-from django.conf import settings
+
from photos.models import Photo,PhotoGallery
from locations.models import Country, Region
@@ -13,16 +12,11 @@ from locations.models import Country, Region
def gallery_list(request,page):
request.page_url = '/photos/%d/'
request.page = int(page)
- qs = PhotoGallery.objects.all()
- try:
- is_build = request.POST['builder']
- extra_context= {
- 'page':page,
- 'MEDIA_URL': settings.BAKED_MEDIA_URL
+ context = {
+ 'object_list': PhotoGallery.objects.all(),
+ 'page':page,
}
- except KeyError:
- extra_context={'page':page,}
- return object_list(request, queryset=qs, template_name='archives/photos.html',extra_context=extra_context)
+ return render_to_response("archives/photos.html", context, context_instance = RequestContext(request))
def gallery(request,slug):
context = {
@@ -49,10 +43,10 @@ def gallery_list_by_area(request,slug,page):
if not region:
raise Http404
context = {
- 'region': region,
+ 'object_list': qs,
'country_list': Country.objects.filter(visited=True),
'region_list': Region.objects.all(),
+ 'region': region,
'page': page
}
- return object_list(request, queryset=qs, template_name='archives/photos.html',
- extra_context=context)
+ return render_to_response("archives/photos.html", context, context_instance = RequestContext(request))
diff --git a/app/projects/models/code.py b/app/projects/models/code.py
index 62179dc..19de428 100644
--- a/app/projects/models/code.py
+++ b/app/projects/models/code.py
@@ -1,7 +1,7 @@
import datetime
from django.db import models
-from utils import markdown2 asfaccount.coms markdown
+from utils import markdown2 as markdown
PUB_STATUS = (
(0, 'Draft'),
(1, 'Published'),
diff --git a/app/projects/urls.py b/app/projects/urls.py
index f4d692c..bd7c13d 100644
--- a/app/projects/urls.py
+++ b/app/projects/urls.py
@@ -1,19 +1,15 @@
-from django.conf.urls.defaults import *
-from django.views.generic.list_detail import object_list
-from django.views.generic.simple import redirect_to,direct_to_template
-from django.views.generic import list_detail
-
+from django.conf.urls import *
+from django.views.generic import ListView
from projects.models.base import Project
-projects = {
- 'queryset': Project.objects.filter(status__exact=1).order_by('-pub_date'),
-}
urlpatterns = patterns('',
(r'data/(?P<id>\d+)/$', 'projects.views.data_json'),
(r'gifs/(?P<slug>[-\w]+)/$', 'projects.views.gif_detail'),
- (r'code/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', 'projects.views.code_entry_detail'),
(r'(?P<slug>[-\w]+)/$', 'projects.views.detail'),
- (r'^$',list_detail.object_list, dict(projects, template_name='archives/projects.html')),
+ (r'^$', ListView.as_view(
+ queryset=Project.objects.filter(status__exact=1).order_by('-pub_date'),
+ template_name = "archives/projects.html",
+ )),
)
diff --git a/config/base_urls.py b/config/base_urls.py
index 201a621..b0959ff 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -1,7 +1,6 @@
-from django.conf.urls.defaults import *
+from django.conf.urls import *
from django.contrib import admin
-from django.views.generic import list_detail
-from django.views.generic.simple import redirect_to,direct_to_template
+from django.views.generic import TemplateView
from django.contrib.sitemaps import FlatPageSitemap
from django.conf import settings
@@ -25,27 +24,26 @@ feeds = {
}
urlpatterns = patterns('',
+ (r'^media/js/mainmap.js$', 'locations.views.map_data'),
(r'^media/admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT+'/admin'}),
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)
# old page redirects
urlpatterns += patterns('',
- (r'^2003/nov/02/take-me-your-leader-ii/$', direct_to_template, {'template': 'static/oldcontent.html'}),
- (r'^2003/aug/07/take-me-your-leader/$', direct_to_template, {'template': 'static/oldcontent.html'}),
- (r'^2004/jan/07/david-foster-wallace-infinity/$', direct_to_template, {'template': 'static/oldcontent.html'}),
+ (r'^2003/nov/02/take-me-your-leader-ii/$', TemplateView.as_view(template_name='static/oldcontent.html')),
+ (r'^2003/aug/07/take-me-your-leader/$', TemplateView.as_view(template_name='static/oldcontent.html')),
+ (r'^2004/jan/07/david-foster-wallace-infinity/$', TemplateView.as_view(template_name='static/oldcontent.html')),
)
urlpatterns += patterns('',
- (r'^admin/doc/', include('django.contrib.admindocs.urls')),
- #(r'^admin/filebrowser/', include('filebrowser.urls')),
(r'^admin/build/.*', 'builder.views.do_build'),
(r'^admin/', include(admin.site.urls),),
(r'^grappelli/', include('grappelli.urls')),
#(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
- (r'^robots.txt$', direct_to_template, {'template': 'archives/robots.html'}),
- (r'^googleb11655cd59dacf3c.html$', direct_to_template, {'template': 'static/gverify.html'}),
- #(r'^contact/', direct_to_template, {'template': 'details/contact.html'}),
+ (r'^robots.txt$', TemplateView.as_view(template_name='archives/robots.html')),
+ (r'^googleb11655cd59dacf3c.html$', TemplateView.as_view(template_name='static/gverify.html')),
+ #(r'^contact/', TemplateView.as_view(template_name='details/contact.html')),
(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
(r'^writing/', include('blog.urls')),
(r'^projects/', include('projects.urls')),
diff --git a/design/templates/archives/map.html b/design/templates/archives/map.html
index 3c644eb..c36817a 100644
--- a/design/templates/archives/map.html
+++ b/design/templates/archives/map.html
@@ -9,14 +9,21 @@
Google Maps code
==============================================#}
{% block extrahead %}
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
+ <!--[if lte IE 8]>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" />
+ <![endif]-->
+ <script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>
+
+ <style>
+ #map-canvas img{ border: none;}
+ </style>
+
-<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
-<script type="text/javascript" src="{{MEDIA_URL}}js/mainmap.min.js"></script>
{% endblock %}
-{%block bodyid%}id="map" {%endblock%}
-{% block bodyevents %}onload="initialize()"{% endblock %}
+{%block bodyid%}id="map"{%endblock%}
{% block primary %}<ul class="bl" id="breadcrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<li><a href="/" itemprop="url" title="luxagraf homepage"><span itemprop="title">Home</span></a> &rarr;</li>
@@ -24,7 +31,10 @@ Google Maps code
</ul>
<section>
<h1 class="hide">Browse luxagraf by map</h1>
- <div id="map-canvas"></div>
+ <div id="map-canvas">
+ <div id="map-inner-canvas" style="width: 100%; height: 100%; border: none !important;"></div>
+ </div>
+
<div class="map-legend">
<h4>Trips</h4>
<ul>
@@ -47,4 +57,7 @@ Google Maps code
</ul>
</div>
</section>
+ <!--<script type="text/javascript" src="{{MEDIA_URL}}js/mainmap.min.js"></script>-->
+<script type="text/javascript" src="{{MEDIA_URL}}js/leaflet-providers.js"></script>
+<script type="text/javascript" src="{{MEDIA_URL}}js/mainmap.js"></script>
{% endblock %}
diff --git a/design/templates/archives/map_data.html b/design/templates/archives/map_data.html
index a58de05..aa1bbe7 100644
--- a/design/templates/archives/map_data.html
+++ b/design/templates/archives/map_data.html
@@ -1,111 +1,56 @@
{% load typogrify %}
{% load truncateletters %}
-{% load slugify_under %}
- // center on a country
- function focusCountry(latitude, longitude, zoom) {
- map.setZoom(zoom);
- map.panTo(new google.maps.LatLng(latitude, longitude));
- };
-
- {% for route in route_list %}
- var {{route.template_var_name}} = [
- {% for point in route.geometry.coords%}
- new google.maps.LatLng({{point.1}}, {{point.0}}){% if forloop.last%}{%else%},{%endif%}
- {% endfor %}
- ];
- {% endfor %}
- function showRoute(route, zoom, latitude, longitude) {
- var routePath = new google.maps.Polyline({
- path: eval(route),
- strokeColor: "#FF0000",
- strokeOpacity: 1.0,
- strokeWeight: 2
- });
- map.setZoom(zoom);
- map.panTo(new google.maps.LatLng(latitude, longitude));
- routePath.setMap(map);
- return false;
- };
-var map;
-function initialize() {
+var map = L.map('map-inner-canvas')
- //custom marker
- var image = new google.maps.MarkerImage('http://luxagraf.net/media/img/marker-entry.png',
- new google.maps.Size(15, 26),
- new google.maps.Point(0, 0),
- new google.maps.Point(7, 26)
- );
- //custom marker shadow
- var shadow = new google.maps.MarkerImage('http://luxagraf.net/media/img/shadow.png',
- new google.maps.Size(37, 34),
- new google.maps.Point(0,0),
- new google.maps.Point(8, 34)
- );
-
-
+// center on a country
+function focusCountry(latitude, longitude, zoom) {
+ map.panTo(new L.LatLng(latitude, longitude));
+ map.setZoom(zoom);
+};
+
+{% for route in route_list %}
+var {{route.template_var_name}} = L.polygon([
+{% for point in route.geometry.coords%}
+ [{{point.1}}, {{point.0}}]{% if forloop.last%}{%else%},{%endif%}
+{% endfor %}
+ ]);
+ {% endfor %}
+
+function showRoute(route, zoom, latitude, longitude) {
+ map.panTo(new L.LatLng(latitude, longitude));
+ map.setZoom(zoom);
+ eval(route).addTo(map);
+ return false;
+};
//check for a permalink
- var location = window.location.hash;
//find a centerpoint
var pts = new Array();
- {%for c in country_list%}pts[{{forloop.counter0}}] = ["#{{c.slug}}", {{c.lat}},{{c.lon}},{{c.zoom_level}}];{% endfor %}
- {%for c in region_list%}pts[pts.length] = ["#{{c.slug}}", {{c.lat}},{{c.lon}},{{c.zoom_level}}];{% endfor %}
- if (location.length>1) {
- for (i=0;i<pts.length;i++) {
- if (location == pts[i][0]) {
- centerCoord = new google.maps.LatLng(pts[i][1],pts[i][2]);
- zoom = pts[i][3];
- break;
- } else {
- centerCoord = new google.maps.LatLng(19.311143,2.460938);
- zoom = 2;
- }
+ {%for c in country_list%}pts[{{forloop.counter0}}] = ["#{{c.slug}}", {{c.lat}},{{c.lon}},{{c.zoom_level}}];
+ {% endfor %}
+ {%for c in region_list%}pts[pts.length] = ["#{{c.slug}}", {{c.lat}},{{c.lon}},{{c.zoom_level}}];
+ {% endfor %}
+if (window.location.hash) {
+ for (var i=0; i < pts.length; i++) {
+ if (window.location.hash == pts[i][0]) {
+ var centerCoord = new L.LatLng(pts[i][1],pts[i][2]);
+ var zoom = pts[i][3];
+ break;
+ } else {
+ var centerCoord = new L.LatLng(19.311143,2.460938);
+ var zoom = 2;
}
- } else {
- centerCoord = new google.maps.LatLng(19.311143,2.460938);
- zoom = 2;
}
- //set up map options
- var mapOptions = {
- zoom: zoom,
- center: centerCoord,
- mapTypeId: google.maps.MapTypeId.TERRAIN,
- disableDefaultUI: true,
- navigationControl: true,
- navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}
- };
- //create map
- map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
-
-
- //loop through and set up markers/info windows
+} else {
+ centerCoord = new L.LatLng(19.311143,2.460938);
+ zoom = 2;
+}
+//Set center
+map.setView(centerCoord, zoom);
+L.tileLayer.provider('Esri.WorldTopoMap', {maxZoom: 18,attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Tiles © Esri and the GIS User Community'}).addTo(map);
- {% for entry in object_list %}
- var marker_{{entry.title|truncatewords:2|slugify_under}} = new google.maps.Marker({
- position: new google.maps.LatLng({{entry.latitude}}, {{entry.longitude}}),
- map: map,
- shadow: shadow,
- icon: image
- });
-
- var c_{{entry.title|truncatewords:2|slugify_under}} = '<div class="infowin"><h4>{{entry.title}}<\/h4><span class="date blok">{{entry.pub_date|date:"F j, Y"}} ({% if entry.location.state.country.name == "United States" %}{{entry.location.name|smartypants|safe}}, {{entry.location.state.name}}){%else%}{{entry.location.name|smartypants|safe}}, {{entry.location.state.country.name}}){%endif%}<\/span><p><img src="{{entry.get_thumbnail_url}}" height="100" alt="{{ entry.title }}" style="float: left; border: #000 10px solid; margin-right: 8px; margin-bottom: 4px; height: 100px;" \/>{{entry.dek|escapejs}} <a href="{{entry.get_absolute_url}}">Read it &raquo;<\/a><\/p><\/div>';
-
- google.maps.event.addListener(marker_{{entry.title|truncatewords:2|slugify_under}}, 'click', function() {
- openWin(c_{{entry.title|truncatewords:2|slugify_under}},marker_{{entry.title|truncatewords:2|slugify_under}});
- });
+//loop through and set up markers/info windows
+{% for entry in object_list %}
+L.marker([{{entry.latitude}}, {{entry.longitude}}]).bindPopup('<div class="infowin"><h4>{{entry.title}}<\/h4><span class="date blok">{{entry.pub_date|date:"F j, Y"}} ({% if entry.location.state.country.name == "United States" %}{{entry.location.name|smartypants|safe}}, {{entry.location.state.name}}){%else%}{{entry.location.name|smartypants|safe}}, {{entry.location.state.country.name}}){%endif%}<\/span><p><img src="{{entry.get_thumbnail_url}}" height="100" alt="{{ entry.title }}" style="float: left; border: #000 10px solid; margin-right: 8px; margin-bottom: 4px; height: 100px;" \/>{{entry.dek|escapejs}} <a href="{{entry.get_absolute_url}}">Read it &raquo;<\/a><\/p><\/div>').addTo(map);
+{% endfor %}
- {% endfor %}
- // create an empty info window instance, set max width
- var infowindow = new google.maps.InfoWindow({
- content: ' ',
- maxWidth: 400
- });
- //function to handle click event and display single info window
- function openWin(content, marker) {
- infowindow.close();
- infowindow.setContent(content);
- infowindow.open(map,marker);
- };
-
-
-}