Skip to content

Commit

Permalink
Lat/Lon decimal fix, remove kml before render, updated index and info…
Browse files Browse the repository at this point in the history
…window
  • Loading branch information
kunaldi committed Jan 9, 2012
1 parent 718f9f2 commit 1e0691e
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 36 deletions.
8 changes: 6 additions & 2 deletions app/assets/javascripts/main.js.erb
Expand Up @@ -11,6 +11,7 @@ $(function() {

var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var isWindowOpen = false;
var sidewalks_kml;
var activeObjectId;
var activeMarker;
var activeInfoWindow = new google.maps.InfoWindow({
Expand Down Expand Up @@ -51,9 +52,12 @@ $(function() {
});

function renderKML(lat, lng) {
console.debug("Rendering sidewalks of [%s, %s]", lat, lng);
console.info("Rendering sidewalks of [%s, %s]", lat, lng);
var url = 'http://167.165.233.18/sidewalks.kml?lat=' + lat + '&lng=' + lng;
var sidewalks_kml = new google.maps.KmlLayer(url, {suppressInfoWindows: true, map: map});
if (sidewalks_kml != undefined) {
sidewalks_kml.setMap(null);
}
sidewalks_kml = new google.maps.KmlLayer(url, {suppressInfoWindows: true, map: map});

google.maps.event.addListener(sidewalks_kml, 'click', function(e) {
isWindowOpen = true;
Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/application.css
Expand Up @@ -444,3 +444,12 @@ ul.actions_menu li:hover {
position:relative;
top:1px;
}
div.legend {
width: 50px;
height: 15px;
}
.red {color: #bb0000;}
.blue {color: #0000bb;}
.green {color: #00bb00;}
.yellow {color: #bbbb00;}
.white {color: #bbbbbb;}
8 changes: 4 additions & 4 deletions app/helpers/sidewalks_helper.rb
@@ -1,13 +1,13 @@
module SidewalksHelper
def format_color(s)
if s.cleared
'#linestyle_blue'
"#cleared"
elsif s.num_adopted > 0
'#linestyle_yellow'
"#adopted"
elsif s.need_help
'#linestyle_red'
"#needs_help"
else
'#linestyle_white'
"#unclear"
end
end
end
4 changes: 4 additions & 0 deletions app/models/user.rb
Expand Up @@ -4,6 +4,10 @@ class User < ActiveRecord::Base
validates_presence_of :first_name, :last_name
has_many :sidewalk_claims

def short_name
"#{first_name} #{last_name.chr}."
end

def fullname
first_name + ' ' + last_name
end
Expand Down
48 changes: 28 additions & 20 deletions app/views/main/index.html.haml
Expand Up @@ -16,25 +16,33 @@
%div{:id => key}
= message

#scrollup.font_1
%div.headline
"Adopt-a-sidewalk" near your home by "claiming" it on a map.
%br
%br
By doing this, you let neighbors know you can help clear snow.
%div.headline
You can see at-a-glance which sidewalks are claimed and connect with your less-abled neighbors to help keep their sidewalks clear.
%div.headline
You can enlist your friends to help on Facebook and Twitter.
%div.headline
To sign up for our text messaging service, text the word "Chicago" to "311311" for all major cell phone carriers.
%br
%br
Message and data rates may apply.
%div.headline
= image_tag "logos/ChicagoShovelsHOME.jpg"
%div.headline
= image_tag "logos/SignUpSMSAlerts.jpg"
.font_1
%p
Welcome to Chicago Shovel's Adopt-a-Sidewalk!
%p
You may know that you're required to shovel the sidewalk in front of your home or business,
but how about helping others out?
%p
Claim the sidewalks that you'll shovel this winter.
Share supplies like snowblowers, shovels and salt with your neighbors.
Ask for help if you need an extra hand this winter.
Let everyone know you've cleared your sidewalk.
%p
Don't see your sidewalk on this map?
Help add your sidewalk by letting us know here.

%p
Sidewalk colors
%p
.red= 'Needs help'
.blue= 'Cleared'
.yellow= 'Adopted'
.white= 'Uncleared'

= image_tag "logos/ChicagoShovelsHOME.jpg"
= image_tag "logos/SignUpSMSAlerts.jpg"
= image_tag "logos/SignUpSMSAlerts.jpg"
= image_tag "logos/SignUpSMSAlerts.jpg"

#register
%p#register-text
Expand Down Expand Up @@ -66,7 +74,7 @@
= render :partial => 'facebook_button'
= render :partial => 'twitter_button'

#osw_widget{:style => "position: absolute; left: 20px; bottom: 0px; z-index: 9999"}
#xosw_widget{:style => "position: absolute; left: 20px; bottom: 0px; z-index: 9999"}

#feedback
= link_to t("links.terms"), '/tos'
Expand Down
8 changes: 4 additions & 4 deletions app/views/sidewalk_claims/show.html.haml
Expand Up @@ -34,9 +34,9 @@
- if @shoveled_by_me
%li.snowed
%a{:href => "#", :id => "snowed_link", :data => {:moid => @my_sidewalk.id}}
%h1 Snowed?
%h1 Shoveled?
.btn_image
.label It snowed again, this sidewalk needs to be shoveled.
.label Unclear.
- else
%li.shoveled
%a{:href => "#", :id => "shoveled_link", :data => {:moid => @my_sidewalk.id}}
Expand All @@ -53,7 +53,7 @@
%a{:href => "#", :id => "share_link"}
%h1 Share
.btn_image
.label I need supplies or have some to share.
.label I need supplies or can share.

- else
#need_register.link_1
Expand All @@ -70,4 +70,4 @@
- else
%h1= 'Adopted by'
#people_list
= @claims.map{|c| c.user.fullname}.join(', ')
= @claims.map{|c| c.user.short_name}.join(', ')
8 changes: 4 additions & 4 deletions app/views/sidewalks/index.kml.erb
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="linestyle_red">
<Style id="needs_help">
<LineStyle>
<width>4</width>
</LineStyle>
Expand All @@ -10,7 +10,7 @@
</PolyStyle>
</Style>

<Style id="linestyle_white">
<Style id="unclear">
<LineStyle>
<width>4</width>
</LineStyle>
Expand All @@ -19,7 +19,7 @@
</PolyStyle>
</Style>

<Style id="linestyle_yellow">
<Style id="adopted">
<LineStyle>
<width>4</width>
</LineStyle>
Expand All @@ -28,7 +28,7 @@
</PolyStyle>
</Style>

<Style id="linestyle_blue">
<Style id="cleared">
<LineStyle>
<width>4</width>
</LineStyle>
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20120108164400_add_sidewalk_attributes.rb
@@ -1,8 +1,8 @@
class AddSidewalkAttributes < ActiveRecord::Migration
def change
change_table :chicagosidewalks do |t|
t.integer :lat, :default => nil, :precision => 16, :scale => 14
t.integer :lon, :default => nil, :precision => 16, :scale => 14
t.decimal :lat, :default => nil, :precision => 16, :scale => 14
t.decimal :lon, :default => nil, :precision => 16, :scale => 14
t.boolean :cleared
t.boolean :need_help
t.string :zipcode
Expand Down

0 comments on commit 1e0691e

Please sign in to comment.