gmaps key, small fixes

This commit is contained in:
sanj 2010-10-26 03:40:23 +02:00
parent 4834083b57
commit 194a8babca
4 changed files with 26 additions and 4 deletions

View File

@ -5,6 +5,7 @@ from django.shortcuts import get_object_or_404
from oxdjango.shortcuts import render_to_json_response from oxdjango.shortcuts import render_to_json_response
from django.core.mail import send_mail from django.core.mail import send_mail
from models import * from models import *
from settings import GOOGLE_MAPS_API_KEY as gkey
QUESTIONS = { QUESTIONS = {
'1problems': 'What problems do flyover and skywalk projects create?', '1problems': 'What problems do flyover and skywalk projects create?',
@ -24,7 +25,7 @@ def geojson(request):
def index(request): def index(request):
events = Event.objects.all().order_by('start_time') events = Event.objects.all().order_by('start_time')
return render_to_response('rizk.html', {'events': events}) return render_to_response('rizk.html', { 'events': events, 'google_key': gkey })
def flyover(request): def flyover(request):
i = request.GET['id'] i = request.GET['id']

View File

@ -77,6 +77,14 @@ a img {
color: red; color: red;
} }
.event {
cursor: pointer;
}
.eventSelected {
color: blue;
}
.videoCategory { .videoCategory {
background: #ff6066; background: #ff6066;
} }

View File

@ -90,7 +90,14 @@ $(function() {
$('.event').click(function(e) { $('.event').click(function(e) {
// e.stopPropagation(); // e.stopPropagation();
if ($(this).hasClass('eventSelected')) {
return false;
} else {
$('.eventSelected').removeClass('eventSelected');
$(this).addClass('eventSelected');
}
var eventId = $(this).data('id'); var eventId = $(this).data('id');
$('#media').html("Loading...");
$.getJSON("eventMedia", {'id': eventId}, function(data) { $.getJSON("eventMedia", {'id': eventId}, function(data) {
// console.log(data); // console.log(data);
displayMedia(data); displayMedia(data);
@ -109,7 +116,13 @@ function displayMedia(data) {
} }
function onFeatureSelect(f) { function onFeatureSelect(f) {
if (currentlySelectedFeature == f) {
return false;
} else {
currentlySelectedFeature = f;
}
var id = f.feature.attributes.id; var id = f.feature.attributes.id;
$('#media').html("Loading...");
$.getJSON("locationMedia", {'id': f.feature.attributes.id }, function(data) { $.getJSON("locationMedia", {'id': f.feature.attributes.id }, function(data) {
displayMedia(data); displayMedia(data);
}); });

View File

@ -11,7 +11,7 @@
<script type="text/javascript" src="/static/js/jquery.js"></script> <script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/jquery.colorbox-min.js"></script> <script type="text/javascript" src="/static/js/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="/static/js/openlayers/OpenLayers.js"></script> <script type="text/javascript" src="/static/js/openlayers/OpenLayers.js"></script>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAsn1j-ZGGtRgZ9aMJPCZbRxTEwe8r4EmncxniwLCEI2F-aeUoNRTBAUi3uvVAsZpLkcO78Ryd18Hfaw'></script> <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key={{ google_key }}'></script>
<script type="text/javascript" src="/static/js/rizk.js"></script> <script type="text/javascript" src="/static/js/rizk.js"></script>
@ -77,8 +77,8 @@
<div id="timeline"> <div id="timeline">
{% for e in events %} {% for e in events %}
<div class="event" data-id="{{ e.id }}" id="event_{{ e.id }}"> <div class="event" data-id="{{ e.id }}" id="event_{{ e.id }}">
{{ e.name }} <br /> <div class="eventName">{{ e.name }}</div> <br />
{{ e.start_time }} - {{ e.end_time }} <div class="eventDate">{{ e.start_time }} - {{ e.end_time }}</div>
<div class="eventDescription"> <div class="eventDescription">
{{ e.description }} {{ e.description }}
</div> </div>