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