Skip to content

Commit

Permalink
Implementing detail
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciusteles committed Jul 22, 2010
1 parent 8f7eb9d commit 7e1ca90
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 30 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'rcov'
group :development do
# bundler requires these gems in development
# gem "rails-footnotes"
gem "ruby-debug"
end

group :test do
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/toilets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ def index
end

def show
@toilet = Toilet.all.detect{|toilet| toilet["lat_long"] == params["id"]}
toilet = Toilet.all.detect{|toilet| toilet["lat_long"] == params["lat_long"]}
@toilet = Toilet.parse(toilet)
end

end
6 changes: 6 additions & 0 deletions app/models/toilet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ def self.all
YAML.load(File.read("#{RAILS_ROOT}/db/toilets.yml"))
end

def self.parse(toilet)
result = Toilet.new
result.title = toilet['title']
result
end

end
23 changes: 0 additions & 23 deletions app/views/details.html.haml

This file was deleted.

22 changes: 21 additions & 1 deletion app/views/toilets/show.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
Aqui vai ficar bem feito
#info-window
#siteNotice
%h1#firstHeading.firstHeading
= @toilet.title
%img{ :src => "/images/white-man.png" }
%p#address
= @toilet.address
#tip
= @toilet.tip
#bodyContent
%p
%strong
Horário:
= @toilet.working_hours
%p
%strong
Detalhes:
%br
= "Suporta: #{@toilet.purpose}."
%br
= @toilet.capacity
9 changes: 5 additions & 4 deletions db/toilets.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- lat_long: "-30.059140,-51.175904"
description: "Descrição do banheiro"
title: "Descrição do banheiro"
- lat_long: "30.059047,-51.173013"
description: "Descrição do banheiro2"
title: "Descrição do banheiro2"
- lat_long: "-30.06031,-51.173646"
description: "Descrição do banheiro3"
- lat_long: "-30.055973,-51.174898"
title: "Descrição do banheiro3"
- lat_long: "-30.055973,-51.174898"
title: "Descrição do banheiro4"
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
map: map,
icon: image
});

$.get("/toilets/show?lat_long=" + toilet.latitude + "," + toilet.longitude, function(contentSting) {

var infowindow = new google.maps.InfoWindow({
Expand Down

0 comments on commit 7e1ca90

Please sign in to comment.