Skip to content

Commit

Permalink
working mockup for pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
shearn89 committed Oct 9, 2011
1 parent 522fac6 commit 796c740
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
7 changes: 4 additions & 3 deletions main.rb
Expand Up @@ -5,16 +5,17 @@

# set :database => 'mysql://appathon:appathon@appathon.cdmwtnbgpare.eu-west-1.rds.amazonaws.com:3306/appathon'
# DB = Sequel.mysql 'appathon', :user => 'appathon', :password => 'appathon', :host => 'mysql://appathon.cdmwtnbgpare.eu-west-1.rds.amazonaws.com', :port => '3306'
#DB = Sequel.connect('mysql://appathon:appathon@appathon.cdmwtnbgpare.eu-west-1.rds.amazonaws.com:3306/appathon')
DB = Sequel.connect('mysql://appathon:appathon@appathon.cdmwtnbgpare.eu-west-1.rds.amazonaws.com:3306/appathon')

get '/' do
@coords = ["55.9449704019074,-3.193202018737793","55.9518396,-3.1647041"]
erb :index
end

get '/app' do
@coords = ["55.9449704019074,-3.193202018737793","55.9518396,-3.1647041"]
erb :app
# @coords = ["55.9449704019074,-3.193202018737793","55.9518396,-3.1647041"]
@coords = {"51.450402, 0.195193" => 13,"51.450, 0.196193" => 8, "51.459, 0.197"=> 18, "51.449, 0.1955" => 10, "51.451, 0.196" => 8, "51.460, 0.190" => 1, "51.453, 0.190" => 24, "51.452, 0.193"=>3, "51.4525, 0.192"=> 10}
erb :app
end

def get_crimes_and_format
Expand Down
7 changes: 3 additions & 4 deletions public/js/map.js
Expand Up @@ -11,9 +11,8 @@ function initialize() {
// Try HTML5 geolocation
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);

// var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var pos = new google.maps.LatLng('51.455402, 0.194193');
var infowindow = new google.maps.InfoWindow({
map: map,
position: pos,
Expand All @@ -40,7 +39,7 @@ function handleNoGeolocation(errorFlag) {

var options = {
map: map,
position: new google.maps.LatLng(51.50131,-0.124862),
position: new google.maps.LatLng(55.455402, 0.194193),
content: 'Location not found, using static position'
};

Expand Down
17 changes: 14 additions & 3 deletions views/layout.erb
Expand Up @@ -10,7 +10,6 @@
<script type="text/javascript" src="js/cufon.js"></script>
<script type="text/javascript" src="js/jquery.main.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="js/map.js"></script>
</head>
<body>
<div id="wrapper">
Expand Down Expand Up @@ -74,9 +73,21 @@ function handleNoGeolocation(errorFlag) {

var options = {
map: map,
position: new google.maps.LatLng(51.50131,-0.124862),
content: 'Location not found, using static position'
position: new google.maps.LatLng(51.455402, 0.194193),
content: 'You are here.'
};
marker_you = new google.maps.Marker({
position: new google.maps.LatLng(51.455402, 0.194193),
map: map,
title: 'You are here.'
});
<% @coords.each do |k,v| %>
marker = new google.maps.Marker({
position: new google.maps.LatLng(<%= k %>),
map: map,
title: <%= '"'+ v.to_s + ' crimes"'%>
});
<% end %>

var infowindow = new google.maps.InfoWindow(options);
map.setCenter(options.position);
Expand Down

0 comments on commit 796c740

Please sign in to comment.