This repository has been archived on 2026-03-31. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drinkkitcom/templates/locations/view.html

202 lines
5.9 KiB
HTML

{% extends "base.html" %}
{% block extra_head %}
<style type="text/css">
#map {
margin: 10px auto;
width: 98%;
height: 300px;
}
#bert { text-align: center; }
#tip_body {
display: block;
padding: 3px;
width: 95%;
height: 100px;
border-color: #b2b2b2;
margin: 10px auto;
-webkit-border-radius: 2px;
}
#submit_tip { margin-bottom: 10px; }
#tips li, #checkins li {
margin-bottom: 15px;
font-size: 13px;
}
.comment_header {
display: block;
border-bottom: 1px dotted #555;
padding-bottom: 2px;
margin-bottom: 2px;
}
#tips strong { font-size: 14px; }
#checkins span strong { font-size: 14px; color: #ff8070;}
#location_details { position: relative; }
.pointers { font-weight: bold; color: #666; }
#checkin_here_link, #checked_in_already {
position: absolute;
top: 5px;
right: 8px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
text-decoration: none;
color: #fff;
font-weight: bold;
padding: 3px 7px !important;
font-size: 12px;
}
#checked_in_already { padding: 3px !important; font-size: 11px !important; top: 5px; /* I'm tired, hush */ }
#checkin_here_link {
background-color: #ff4500;
border: 1px solid #ff4500;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ff9f7b), to(#ff4500));
}
#checked_in_already {
background-color: #cdcdcd;
border: 1px solid #8f8f8f;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f2f2f2), to(#cdcdcd));
color: #888;
}
#annotations { padding-bottom: 0px !important; }
#annotations li {
margin-bottom: 10px;
font-size: 12px;
}
#annoations strong { display: block; }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
var geocoder, map;
function generateMap() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng({{ location.geometry.x }}, {{ location.geometry.y }});
var opts = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
document.getElementById("bad_browser_map").style.display = "none";
map = new google.maps.Map(document.getElementById("map"), opts);
{% if location.street_address %}
/*
Since we happen to have an address stored, we'll geocode it instead of using the stored/reported
GPS coordinates, as that'll be more accurate overall. We can still use the GPS coordinates to center
the map ahead of time, though, which we do above (see: opts/center).
*/
geocoder.geocode({'address': "{{ location.address_for_geocode}},Washington,DC"}, function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
{% else %}
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: '{{ location.name }}'
});
{% endif %}
}
</script>
{% endblock %}
{% block content %}
<h2>{{ location.name }}</h2>
<div id="location_details">
<ul id="annotations">
<li><strong>Category:</strong> {{ location.category|default:"Not Specified :(" }}</li>
<li><strong>Address:</strong> {{ location.street_address|default:"Not Specified :(" }}</li>
</ul>
{% if user.is_authenticated %}
{% if allow_checkin %}
<a href="/locations/{{ location.id }}/checkin/" id="checkin_here_link">Check In Here</a>
{% else %}
<div id="checked_in_already">Already Checked In</div>
{% endif %}
{% endif %}
</div>
<h2>Map of the area</h2>
<div id="map">
{% if location.street_address %}
<img id="bad_browser_map" src="http://maps.google.com/maps/api/staticmap?center={{ location.address_for_geocode}},Washington,DC&sensor=true&zoom=16&size=300x300">
{% else %}
<img id="bad_browser_map" src="http://maps.google.com/maps/api/staticmap?center={{ location.geometry.x }},{{ location.geometry.y }}&sensor=true&zoom=16&size=300x300">
{% endif %}
</div>
<script type="text/javascript">
try { generateMap(); } catch(e) { /* Bad browser, most likely. Oh well, they still got a static map. ;P */ }
</script>
<h2>Recently checked in here</h2>
{% if recent_checkins %}
<ul id="checkins">
{% for checkin in recent_checkins %}
<li class="top_level">
<h3>{{ checkin.user.username }} <span class="checkin_list_timestamp">{{ checkin.timestamp|timesince }} ago</span></h3>
<a href="/redditor/{{ checkin.user.username }}/" class="anchored_action button">View User</a>
<ul>
<li><strong>Identify by:</strong> {{ checkin.identify_by }}</li>
<li><strong>Should be there for:</strong> {{ checkin.estimated_time_here }}</li>
</ul>
</li>
{% endfor %}
</ul>
{% else %}
<p class="none_yet">No checkins yet. You could be the first!</p>
{% endif %}
<div style="clear: both;"><!-- It's 5AM and I have better things to do with my time... like sleep. --></div>
{% if user.is_authenticated %}
<h2>Leave a Tip or Todo</h2>
<form action="/locations/{{ location.id }}/add_tip/" method="post" id="bert">
{% csrf_token %}
<textarea name="tip_body" id="tip_body"></textarea>
<input type="submit" value="Post Tip" id="submit_tip" class="button large rounded_6px">
</form>
{% endif %}
<h2>Tips &amp; Todos from Redditors</h2>
{% if location.tip_set.all %}
<ul id="tips">
{% for tip in location.tip_set.all %}
<li>
<span class="comment_header"><strong>{{ tip.user.username }}</strong> <em>{{ tip.timestamp|timesince }} ago</em></span>
{{ tip.tip }}
</li>
{% endfor %}
</ul>
{% else %}
<p class="none_yet">No tips yet. Be the first and add one!</p>
{% endif %}
{% endblock %}