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.

37 lines
1.3 KiB

11 years ago
module NavigationHelpers
def path_to(page_name)
append_root = false
case page_name
when /^landing$/i
path = :root
when /^confirmation$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/confirm/#{@last_registration.confirmation_token}"
when /^pay registration$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/pay-registration/#{@last_registration.confirmation_token}"
when /^confirm paypal$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/paypal-confirm/#{@last_registration.payment_confirmation_token}"
when /^cancel paypal$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/paypal-cancel/#{@last_registration.confirmation_token}"
when /^translation list$/i
path = '/translations/'
when /^(.+) translations?$/i
path = '/translations/' + get_language_code(Regexp.last_match(1))
when /^organization list$/i
path = '/organizations/'
end
11 years ago
if path.is_a?(Symbol)
begin
path = self.send((path.to_s + '_url').to_sym).gsub(/^http:\/\/.+?(\/.*)$/, '\1')
rescue Object => e
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"#{path}_url\n" +
"Now, go and add a mapping in #{__FILE__}"
end
end
path
end
11 years ago
end
World(NavigationHelpers)