Changeset 1478
- Timestamp:
- 09/08/07 18:18:52 (1 year ago)
- Files:
-
- where-you-app/site/app/controllers/hood_controller.rb (modified) (1 diff)
- where-you-app/site/app/views/hood/index.rhtml (modified) (2 diffs)
- where-you-app/site/app/views/hood/whats_my_hood.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
where-you-app/site/app/controllers/hood_controller.rb
r1477 r1478 18 18 res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } 19 19 20 # FIXME: check well-formedness of response21 22 20 @json = JSON.parse(res.body) 23 @neighborhood = @json["neighborhoods"][0]["name"] 24 return 25 if @json.has_key? 'neighborhoods' 26 @json = "fuckballs" 27 else 28 @json = "shitballs" 29 end 21 if @json.has_key? "neighborhoods" 22 if @json["neighborhoods"].length > 0 23 @neighborhood = @json["neighborhoods"][0]["name"] 24 @yelp_hood_url = @json["neighborhoods"][0]["url"] 25 else 26 @neighborhood = "ACTUALLY, YELP HAS NO IDEA WHERE YOU ARE. ISN'T THAT GAY?" 27 @yelp_hood_url = "http://www.youtube.com/watch?v=4NE-5jG6tvk" 28 end 29 end 30 30 31 31 end where-you-app/site/app/views/hood/index.rhtml
r1477 r1478 1 1 <script type="text/javascript"> 2 function populate_default( field_name, value ) { 3 document.forms[0][field_name].value = value; 2 function use_test_loc( lat, lng ) { 3 document.forms[0]["lat"].value = lat; 4 document.forms[0]["long"].value = lng; 4 5 } 5 6 </script> 6 7 7 8 <div class="main" id="<%= @controller.controller_name %>"> 8 <h 1>What Choo Know About My Hood?</h1>9 <h2><a href="http://www.youtube.com/watch?v=4NE-5jG6tvk">Whachoo Know About My Hood?</a></h2> 9 10 10 11 <pre> … … 12 13 13 14 <form method="POST"> 14 <label>lat 15 No GPS? Try some example places: <br /> 16 <a href="javascript:use_test_loc(40.719816, -73.985082);">L.E.S.</a>, 17 <a href="javascript:use_test_loc(37.785615, -122.415082);">loin</a>, 18 <a href="javascript:use_test_loc(37.783266, -122.393670);">SOMA</a>, 19 <a href="javascript:use_test_loc(37.474177, -122.264304);">pac heights</a>, 20 <a href="javascript:use_test_loc(37.802728, -122.405582);">telegraph hill</a>, 21 <a href="javascript:use_test_loc(37.756085, -122.418851);">the mission</a>, 22 <a href="javascript:use_test_loc(37.783789, -122.482768);">da richmond</a> 23 <label>lat: 15 24 <input name="lat" value="<%= params[:lat] %>" /> 16 <a href="javascript:populate_default('lat','<%= @default_lat %>');">click to use an example latitude: <%= @default_lat %></a>17 25 </label> 18 <label>long 26 <label>long: 19 27 <input name="long" value="<%= params[:long] %>" /> 20 <a href="javascript:populate_default('long','<%= @default_long %>');">click to use example longitude: <%= @default_long %></a>21 28 </label> 22 <input type="submit" value="where i'm at? (via geocode)"/> 29 <p/> 30 <input type="submit" value="Where i'm at?"/> 23 31 </form> 24 32 25 33 <% if @neighborhood %> 26 34 <div class="response"> 27 <h 1>neighborhood:</h1>28 @neighborhood: <%= @neighborhood %>35 <h2>neighborhood:</h2> 36 <h1>You're in: <%= link_to @neighborhood, @yelp_hood_url %></h1> 29 37 </div> 30 38 <% end %> where-you-app/site/app/views/hood/whats_my_hood.sh
r1475 r1478 12 12 coords="lat=37.785615&long=-122.415082" # Lahore Karahi, the dirty loin: 612 O'farrell St 13 13 14 # LES: (40.719816, -73.985082) 15 14 16 yelp_webservice_ID="Fc6e-WNOcF8aJCx-ZboOFQ" 15 17