2011-05-31 11:12:02 +00:00
|
|
|
class InfoWindowController < ApplicationController
|
|
|
|
def index
|
|
|
|
@hydrant = Hydrant.find_by_id(params[:hydrant_id])
|
2011-08-29 21:51:44 +00:00
|
|
|
if params[:flash]
|
|
|
|
params[:flash].each do |key, message|
|
|
|
|
flash.now[key.to_sym] = message
|
|
|
|
end
|
|
|
|
end
|
2011-05-31 11:12:02 +00:00
|
|
|
if @hydrant.adopted?
|
|
|
|
if user_signed_in? && current_user.id == @hydrant.user_id
|
|
|
|
render("users/thank_you")
|
|
|
|
else
|
|
|
|
render("users/profile")
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if user_signed_in?
|
|
|
|
render("hydrants/adopt")
|
|
|
|
else
|
|
|
|
render("sessions/new")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|