This commit is contained in:
sanj 2010-09-20 04:16:09 +05:30
parent 52ca10a126
commit 7ced7b88b1
3 changed files with 54 additions and 150 deletions

View File

@ -112,6 +112,10 @@ class Video(models.Model):
youtube_id = self.get_youtube_id()
info = youtube.getMovieInfo(youtube_id)
info['title'] = '' #Nasty, to avoid UnicodeDecodeError's when trying to do json.dumps on some video titles. FIXME.
#this is just ugly -- this shud be fixed by oxweb -- please remove when necessary:
info['thumbnail'] = "http://img.youtube.com/vi/%s/0.jpg" % (info['id'][:-22],)
ret = {
'info': info,
'flyover': {
@ -171,6 +175,17 @@ class Text(models.Model):
def __unicode__(self):
return self.text + " - " + self.category.name
def get_dict(self):
ret = {
'text': self.text,
'flyover': {
'id': self.flyover.id,
'name': self.flyover.name
}
}
return ret
class TextCategory(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
@ -178,4 +193,18 @@ class TextCategory(models.Model):
def __unicode__(self):
return self.name
def get_dict(self):
texts = []
flyovers = []
for t in Text.objects.filter(category=self):
texts.append(t.get_dict())
flyovers.append(t.flyover.geojson_as_dict())
return {
'texts': texts,
'flyovers': {
'type': 'FeatureCollection',
'features': flyovers
}
}
# Create your models here.

View File

@ -161,11 +161,13 @@ $(function() {
map.zoomToExtent(maxExtent);
// console.log(maxExtent);
switch(type.toLowerCase()) {
case "image":
var html = tmpl("tmpl_images", {'images': json.images});
$('#media').html(html);
$('.imageWrapper a').colorbox();
break;
case "video":
var html = tmpl("tmpl_videos", {'videos': json.videos});
$('#media').html(html);
@ -181,6 +183,11 @@ $(function() {
var embedCode = data.info.embed;
$.colorbox({html: embedCode});
});
case "text":
var html = tmpl("tmpl_texts", {'texts': json.texts});
$('#media').html(html);
default:
$.noop();
}

View File

@ -1,152 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
width: 100%;
height: 100%;
background: #999;
background: -moz-radial-gradient(45px 45px 45deg, circle cover,
#ABAE71 0%, #CDD53F 100%, #E6F215 95%);
background: -webkit-gradient(radial, 45px 45px 45deg, circle cover,
#ABAE71 0%, #CDD53F 100%, #E6F215 95%);
}
#wrapper {
width: 100%;
height: 100%;
}
a img {
border: 0px;
}
#categories {
position: absolute;
top: 10px;
width: 60%;
left: 0px;
text-align: center;
}
#categories table {
height: 200px;
width: 60%;
margin-left: 20%;
-moz-box-shadow: 0px 0px 1em;
-webkit-box-shadow: 0px 0px 1em;
box-shadow: 0px 0px 1em;
}
#categories table tr {
}
#categories table tr td {
cursor: pointer;
}
.selected {
background: #000 !important;
color: #fff !important;
}
.imageCategory {
background: #ffd055;
}
.imageWrapper {
float: left;
width: 120px;
height: 120px;
text-align: center;
}
.imagesWrapper {
overflow: auto;
margin-top: 10px;
}
.videoCategory {
background: #ff6066;
}
.textCategory {
background: #69fd6c;
}
.audioCategory {
background: #7d69fd;
}
#map {
position: absolute;
top: 220px;
bottom: 10px;
right: 40%;
left: 10px;
-moz-box-shadow: 0px 0px 1em;
-webkit-box-shadow: 0px 0px 1em;
box-shadow: 0px 0px 1em;
}
#buttons {
position: absolute;
right: 2%;
top: 1%;
height: 3%;
width: 20%;
}
#buttons .navButton {
width: 8%;
padding: 2px;
text-align: center;
border: 1px solid #fff;
background: #6BDCE1;
text-decoration: none;
}
.navSelected {
background: #fff !important;
border: 1px solid #68dce1 !important;
}
#media {
background: #fff;
position: absolute;
right: 2%;
width: 36%;
height: 90%;
top: 5%;
bottom: 5%;
-moz-box-shadow: 0px 0px 1.5em;
-webkit-box-shadow: 0px 0px 1.5em;
box-shadow: 0px 0px 1.5em;
}
.mapSelect {
width: 100px;
height: 100px;
}
.navContent {
display: none;
}
.contentWrapper {
height: 96%;
margin-top: 2%;
margin-bottom: 2%;
overflow: auto;
width: 94%;
margin-left: auto;
margin-right: auto;
}
</style>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="keywords" content="Flyovers, Mumbai, Construction, Traffic, overpass, skywalk" />
<meta name="title" content="Vertical Urbanism" />
<meta name="description" content="This site maps the landscapes of elevated road highways flyovers and elevated pedestrian walkways skywalks across the Mumbai Metropolitan Region in Western India." />
<link rel="stylesheet" type="text/css" href="/static/css/vurbanism.css" />
<title>Vertical Urbanism: Flyovers in Mumbai</title>
<link rel="stylesheet" type="text/css" href="/static/css/colorbox.css" />
<script type="text/javascript" src="/static/js/jquery.js"></script>
@ -176,7 +35,7 @@ a img {
<div class="videosWrapper">
<% for (var i=0; i<videos.length;i++) { var vid = videos[i]; %>
<div class="videoWrapper">
<a href="#" class="flyoverImage" title="<%= vid.info.description %>" data-id="<%= vid.flyover.id %>" rel="group_<%= vid.id %>">
<a href="#" class="flyoverVideo flyoverImage" title="<%= vid.info.description %>" data-id="<%= vid.flyover.id %>" rel="group_<%= vid.id %>">
<img src="<%= vid.info.thumbnail %>" alt="<%= vid.info.description %>" />
</a>
</div>
@ -185,6 +44,15 @@ a img {
</div>
</script>
<script type="text/html" id="tmpl_texts">
<div class="textsWrapper">
<% for (var i=0; i<texts.length;i++) { var txt = texts[i]; %>
<p class="textWrapper" data-id="<%= txt.flyover.id %>">
<%= txt.text %>
</p>
<% } %>
</div>
</script>
<div id="wrapper">
<div id="categories">
@ -205,19 +73,19 @@ a img {
<td class="imageCategory" data-id="4">Unfinished</td>
<td class="imageCategory" data-id="12">Construction</td>
<td class="videoCategory" data-id="2">Construction</td>
<td class="textCategory" data-id="">Text1</td>
<td class="textCategory" data-id="6">Media</td>
</tr>
<tr>
<td class="imageCategory" data-id="2">Regulation</td>
<td class="imageCategory" data-id="10">Fencing</td>
<td class="videoCategory" data-id="4">In The Way</td>
<td class="textCategory" data-id="">Text2</td>
<td class="textCategory" data-id="5">Technical</td>
</tr>
<tr>
<td class="imageCategory" data-id="14">Greenspace</td>
<td class="imageCategory" data-id="8">Posters</td>
<td class="videoCategory" data-id="1">Routes</td>
<td class="textCategory" data-id="">Text3</td>
<td class="textCategory" data-id="4">Stories</td>
</tr>
<tr>
<td class="imageCategory" data-id="5">Life underneath</td>