Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
681 B

10 years ago
module NavigationHelpers
def path_to(path)
path = path.to_sym
case path
10 years ago
when /^landing$/i
path = :home
10 years ago
when /^registration$/i
path = "/conferences/#{@last_conference.slug}/register/"
when /^(workshops|stats|broadcast)$/i
path = "/conferences/#{@last_conference.slug}/#{path}/"
10 years ago
end
if path.is_a?(Symbol)
begin
path = Rails.application.routes.url_helpers.send("#{path}_path".to_sym)
10 years ago
rescue Object => e
raise "Can't find mapping from \"#{path}\" to a path."
10 years ago
end
end
if path.blank?
raise "Can't find mapping from \"#{page_name}\" to a path."
end
return path
10 years ago
end
end
World(NavigationHelpers)