Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tidying up after the event

  • Loading branch information...
commit 9523dd254397e0dc9de454d7112ed190226e84bc 1 parent 0ea41d1
Matt J Williams authored
View
13 README
@@ -0,0 +1,13 @@
+A web app that allows users to plan a pub crawl and then participate in it.
+Built on the Foursquare API.
+
+Hacked together in one weekend as part of the Foursquare Global Hackathon,
+Sept 17th & 18th 2011.
+
+Authors:
+Matt Williams
+Martin Chorley
+Chris Jones
+Konrad Borowiecki
+Joel
+
View
80 webbackend/web_backend_proj/frontendapp/templates/createcrawl.html
@@ -14,6 +14,21 @@
<!-- Le styles -->
+
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-6238402-3']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+
<link href="{{STATIC_URL}}css/bootstrap.min.css" rel="stylesheet">
<link href="{{STATIC_URL}}css/fourcrawl.css" rel="stylesheet">
<script type="text/javascript" src="{{STATIC_URL}}js/jquery-1.6.4.min.js"></script>
@@ -43,7 +58,7 @@
$(document).ready(function(){
var client_id = 'RT1TB51QQTKDMYM0UYTJVLPFVMP0YUVNSQS3MCGUIPV50GY0';
- var callback_url = 'http://localhost/~martin/createcrawl.html';
+ var callback_url = 'https://fourcrawl.nomovingparts.net/createcrawl/';
var initialLocation;
var cardiff = new google.maps.LatLng(51.481307,-3.18049860);
@@ -166,7 +181,7 @@
infowindow.close()
infowindow = new google.maps.InfoWindow({
maxHeight: 400,
- content: "<div style='background-image:url(images/bar.png);background-repeat:no-repeat;padding:0 10px 10px 42px;'><h3>" + venue['name'] + "</h3><span>" + venue['location']['address'] + "</span></div><button id='" + venue['id'] + "'style='display:block' class='btn success addvenue'>Add place</button>"
+ content: "<div style='background-image:url({{STATIC_URL}}images/bar.png);background-repeat:no-repeat;padding:0 10px 10px 42px;'><h3>" + venue['name'] + "</h3><span>" + venue['location']['address'] + "</span></div><button id='" + venue['id'] + "'style='display:block' class='btn success addvenue'>Add place</button>"
});
infowindow.open(marker.get('map'), marker);
@@ -235,9 +250,6 @@
drawRoute();
tellDistances();
}
- else {
- alert('' + status + ' ' + waypoints.length);
- }
});
}
@@ -292,31 +304,55 @@
//When you click on a link with class of poplight and the href starts with a #
$('a.submitcrawl').click(function() {
-
+ var user_foursq_id;
+
if( selectedvenues.length == 0 ){
alert("Pro-tip: select some venues first, before submitting them ;-)")
}
else {
- selectedVenueIDs = [];
-
- var foursq_id;
-
- for (i in selectedvenues) {
- selectedVenueIDs.push(selectedvenues[i]['id']);
- }
-
- $.getJSON('https://api.foursquare.com/v2/users/self?oauth_token=' + token, {}, function(data) {
- foursq_id = data['response']['user']['id'];
- });
-
-
- }});
+ selectedVenueIDs = [];
+
+ for (i in selectedvenues) {
+ selectedVenueIDs.push(selectedvenues[i]['id']);
+ }
+
+ $.getJSON('https://api.foursquare.com/v2/users/self?oauth_token=' + token, {}, function(data) {
+ user_foursq_id = addUser(data['response']['user']['id']);
+ create_crawl_url='https://fourcrawl.nomovingparts.net/api/crawl/create/';
+ params={
+ 'name' : 'some_name',
+ 'description' : 'some_description',
+ 'startdatetime' : '316371508',
+ 'duration' : '40',
+ 'leader' : user_foursq_id,
+ }
+ $.post(create_crawl_url, params, function(data){
+ crawl_id=data;
+ add_venue_url = 'https://fourcrawl.nomovingparts.net/api/crawl/' + crawl_id +'/add_venue/';
+ for(v in selectedVenueIDs) {
+ params = {'venue_id' : selectedVenueIDs[v],
+ 'index' : v}
+ $.post(add_venue_url, params)
+ window.location.href = "/viewcrawl/";
+ }
+
+ });
+ });
+
+ function addUser(user_foursq_id) {
+ create_url='https://fourcrawl.nomovingparts.net/api/user/create/';
+ params={ 'foursq_id' : user_foursq_id };
+ $.post(create_url, params);
+ return user_foursq_id;
+ }
+ }
+ });
$('a.logout[href^=#]').click(function() {
token="";
- window.location.href = "/~martin/";
+ window.location.href = "/";
return true;
});
@@ -441,4 +477,4 @@
</div>
</body>
-</html>
+</html>
View
154 webbackend/web_backend_proj/frontendapp/templates/home.html
@@ -1 +1,153 @@
-
+
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+
+ <meta charset="utf-8">
+ <title>Fourcrawl</title>
+ <meta name="description" content="Fourcrawl - the foursquare pub crawl manager">
+ <meta name="author" content="">
+
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+
+ <!-- Le styles -->
+
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-6238402-3']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+
+ <link href="{{STATIC_URL}}css/bootstrap.min.css" rel="stylesheet">
+ <link href="{{STATIC_URL}}css/fourcrawl.css" rel="stylesheet">
+ <script type="text/javascript" src="{{STATIC_URL}}js/jquery-1.6.4.min.js"></script>
+ <script type="text/javascript" src="{{STATIC_URL}}js/jquery.ba-bbq.min.js"></script>
+ <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
+
+ <style type="text/css">
+ body {
+ padding-top: 60px;
+ }
+ </style>
+
+ <script type="text/javascript">
+
+ $(document).ready(function() {
+
+ //When you click on a link with class of poplight and the href starts with a #
+ $('a.poplight[href^=#]').click(function() {
+ var popID = $(this).attr('rel'); //Get Popup Name
+ var popURL = $(this).attr('href'); //Get Popup href to define size
+
+ //Pull Query & Variables from href URL
+ var query= popURL.split('?');
+ var dim= query[1].split('&');
+ var popWidth = dim[0].split('=')[1]; //Gets the first query string value
+
+ //Fade in the Popup and add close button
+ $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="images/close.png" class="btn_close" title="Close Window" alt="Close" /></a>');
+
+ //Define margin for center alignment (vertical horizontal) - we add 80px to the height/width to accomodate for the padding and border width defined in the css
+ var popMargTop = ($('#' + popID).height() + 80) / 2;
+ var popMargLeft = ($('#' + popID).width() + 80) / 2;
+
+ //Apply Margin to Popup
+ $('#' + popID).css({
+ 'margin-top' : -popMargTop,
+ 'margin-left' : -popMargLeft
+ });
+
+ //Fade in Background
+ $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
+ $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies
+
+ return false;
+ });
+
+ //Close Popups and Fade Layer
+ $('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
+ $('#fade , .popup_block').fadeOut(function() {
+ $('#fade, a.close').remove(); //fade them both out
+ });
+ return false;
+ });
+
+
+
+ });
+
+ </script>
+
+ </head>
+
+ <body>
+
+ <div class="topbar">
+ <div class="fill">
+ <div class="container">
+ <a class="brand" href="#" style="color:#008dcb">four<span style="color:#f89406" class="italics">crawl</span></a>
+ <ul class="nav">
+ <li><a href="#?w=500" rel="about" class="poplight">About</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="container">
+
+ <!-- Main hero unit for a primary marketing message or call to action -->
+ <div class="hero-unit" style="margin-bottom:0;padding:20px 0 1px 20px;">
+ <h1><img src="{{STATIC_URL}}images/fourcrawl.png" alt="fourcrawl"/></h1>
+
+ <p style="padding-left: 20px">Fourcrawl is probably the best pub crawl mapping and planning system in the world. We say probably, as we've not actually
+ looked for another, but you should believe us as we're pro's.</p>
+
+
+ </div>
+
+ <div class="hero-unit" style="margin:0;padding:0;">
+ <img src="{{STATIC_URL}}images/intro_map.png" width="939" height="292"/>
+ </div>
+
+ <div class="hero-unit" style="margin-top:0;padding-top:0px;">
+
+ <p style="text-align:center;margin-bottom:20px;">Want to begin / have a play? Simply login with your foursquare account below.</p>
+
+ <div style="padding-left:20px;text-align:center">
+ <p><a href="/createcrawl/" class="btn primary large">Sign in with foursquare</a>
+ <a style="padding-left:20px;" href="https://foursquare.com/signup/">Don't have a foursquare account?</a></p>
+ </div>
+
+ </div>
+
+
+ <footer>
+ <p>&copy; some guys from a foursquare hack event in Cardiff... yeah</p>
+ </footer>
+
+ </div> <!-- /container -->
+
+
+ <!-- about popup -->
+
+ <div id="about" class="popup_block">
+ <h2>About</h2>
+ <p>Fourcrawl was developed over one weekend by a collection of individuals taking part in the global foursquare hack-a-thon.</p>
+ <p></p>
+ </div>
+
+
+ </body>
+</html>
View
47 webbackend/web_backend_proj/frontendapp/templates/viewcrawl.html
@@ -14,11 +14,25 @@
<!-- Le styles -->
+
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-6238402-3']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+
<link href="{{STATIC_URL}}css/bootstrap.min.css" rel="stylesheet">
<link href="{{STATIC_URL}}css/fourcrawl.css" rel="stylesheet">
<script type="text/javascript" src="{{STATIC_URL}}js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.ba-bbq.min.js"></script>
- <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<style type="text/css">
@@ -30,37 +44,20 @@
<script type="text/javascript">
$(document).ready(function() {
- function listCrawls() {
var list_url='https://fourcrawl.nomovingparts.net/api/crawl/list/';
listHtml = '<ul>';
- $.getJSON(list_url, {}, function(data) {
+ $.get(list_url, {}, function(data) {
for(i in data) {
- listHtml += '<div class=\"crawlslist\" id=' + i + '>' + data[i]['name'] + '</div>'
+ listHtml += '<div class=\"crawlslist\" id=' + i + '><p>' + data[i]['name'] + '</p></div>'
}
- }, 'json');
- listHtml += '</ul>';
- $("#listofcrawls").html(listHtml);
- }
+ listHtml += '</ul>';
+ $("#listofcrawls").html(listHtml);
+ });
$(".crawlslist").click(function(){
showCrawl($(this).attr('id'));
});
-
- function showCrawl(crawl_id) {
- var list_url='https://fourcrawl.nomovingparts.net/api/crawl/' + crawl_id + '/list/';
- crawlHtml = ''
- $.getJSON(list_url, {}, function(data) {
- crawlHtml += '<div id=\"crawldata\">
- <p class=\"name\">' + data['name'] + '</p>
- <p class=\"description\">' + data['description'] + '</p>
- <p class=\"start date & time\">' + data['startdatetime'] + '</p>
- <p class=\"duration\">' + data['duration'] + '</p>
- <p class=\"venues\">' + data['venues'] + '</p>
- </div>'
- });
- $("#crawlinfo").html(crawlHtml);
- }
});
</script>
@@ -68,7 +65,7 @@
<body>
<div id="container">
-
+ <p>Crawls:</p>
<div class="row">
<div class="span6 offset2">
<div id="listofcrawls">
@@ -83,4 +80,4 @@
</div>
</body>
-</html>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.