diff options
Diffstat (limited to 'design/templates/bin')
-rw-r--r-- | design/templates/bin/country_sidebar.html | 6 | ||||
-rw-r--r-- | design/templates/bin/map_entry_list.html | 111 | ||||
-rw-r--r-- | design/templates/bin/map_sidebar.html | 23 | ||||
-rw-r--r-- | design/templates/bin/recent_entries.html | 13 | ||||
-rw-r--r-- | design/templates/bin/regions_sidebar.html | 6 |
5 files changed, 159 insertions, 0 deletions
diff --git a/design/templates/bin/country_sidebar.html b/design/templates/bin/country_sidebar.html new file mode 100644 index 0000000..03570da --- /dev/null +++ b/design/templates/bin/country_sidebar.html @@ -0,0 +1,6 @@ +<ul> + {%for country in country_list %} + <li><a href="/writing/{{country.slug}}/1/" title="See all writing from {{country.name|title}}">{{country.name}}</a></li> + </li> + {% endfor %} +</ul>
\ No newline at end of file diff --git a/design/templates/bin/map_entry_list.html b/design/templates/bin/map_entry_list.html new file mode 100644 index 0000000..a58de05 --- /dev/null +++ b/design/templates/bin/map_entry_list.html @@ -0,0 +1,111 @@ +{% 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() { + + //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) + ); + + + //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; + } + } + } 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 + + {% 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 »<\/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}}); + }); + + {% 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); + }; + + +} diff --git a/design/templates/bin/map_sidebar.html b/design/templates/bin/map_sidebar.html new file mode 100644 index 0000000..e61852f --- /dev/null +++ b/design/templates/bin/map_sidebar.html @@ -0,0 +1,23 @@ +{% load truncateletters %}{% load slugify_under %}<div class="map-legend"> + <h4>Trips</h4> + <ul> + {% for route in route_list %} + <li><a onclick="showRoute('{{route.template_var_name}}', {{route.zoom}}, '{{route.geometry.centroid.y}}','{{route.geometry.centroid.x}}');" href="#" title="show {{route.name}} on map">{{route.name}}</a></li> + {% endfor %} + </ul> + <h4>Regions</h4> + <ul> + {%for region in region_list %} + <li><a href="#{{region.slug}}" onclick="focusCountry({{region.lat}}, {{region.lon}}, {{region.zoom_level}});" title="See all writing from {{region.name|title}}">{{region.name}}</a></li> + {% endfor %} + </ul> + + <h4>Countries</h4> + <ul> + <li><a onclick="focusCountry(19.311143,2.460938,2);" href="#" title="view all countries">All</a></li> + {%for country in country_list %} + <li><a href="#{{country.slug}}" onclick="focusCountry({{country.lat}}, {{country.lon}}, {{country.zoom_level}});" title="See all writing from {{country.name|title}}">{{country.name}}</a></li> + {% endfor %} + </ul> + + </div> diff --git a/design/templates/bin/recent_entries.html b/design/templates/bin/recent_entries.html new file mode 100644 index 0000000..f86d6f2 --- /dev/null +++ b/design/templates/bin/recent_entries.html @@ -0,0 +1,13 @@ +{% load typogrify %}{% for object in object_list %}<article {%if forloop.last %}class="last"{%endif%}> + <h1><a href="{{object.get_absolute_url}}" title="{%if object.title_keywords%}{{object.title_keywords}}{%else%}{{object.title}}{%endif%}">{{object.title|smartypants|widont|safe}}</a></h1> + <p class="dateline bl"> + <span class="location" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">{% if object.location.state.country.name == "United States" %}{{object.location.name|smartypants|safe}}, <a href="/writing/united-states/1/" title="travel writing from the United States">{{object.location.state.name}}</a>{%else%}{{object.location.name|smartypants|safe}}, <a href="/writing/{{object.location.state.country.slug}}/1/" title="travel writing from {{object.location.state.country.name}}">{{object.location.state.country.name}}</a>{%endif%} + <meta itemprop="latitude" content="{{object.latitude}}" /> + <meta itemprop="longitude" content="{{object.longitude}}" /> + </span> + <time datetime="{{object.pub_date|date:'c'}}" pubdate>{{object.pub_date|date:"m/d/y"}}</time> + </p> + {%if object.thumbnail%}<a class="permalink" href="{{object.get_absolute_url}}" title="{{object.title}}"><img src="{{object.get_thumbnail_url}}" alt="{{ object.title }}" class="post-image" width="{{object.thumb_width}}" height="{{object.thumb_height}}" /></a>{%endif%} + <p class="hyphenate">{{object.dek|safe}}</p> + </article> + {% endfor %} diff --git a/design/templates/bin/regions_sidebar.html b/design/templates/bin/regions_sidebar.html new file mode 100644 index 0000000..ce14e68 --- /dev/null +++ b/design/templates/bin/regions_sidebar.html @@ -0,0 +1,6 @@ +<ul> + {%for region in region_list %} + <li><a href="/writing/{{region.slug}}/1/" title="See all writing from {{region.name|title}}">{{region.name}}</a></li> + </li> + {% endfor %} +</ul>
\ No newline at end of file |