Fixed locale not found contact form

This commit is contained in:
Godwin
2016-07-19 19:16:15 -07:00
parent 32a0f02db2
commit 553e412685
3 changed files with 17 additions and 8 deletions
+14 -6
View File
@@ -216,13 +216,21 @@ module ApplicationHelper
content_tag(:span, text.html_safe, id: id, class: 'screen-reader-text')
end
def url_for_locale(locale)
new_params = params.merge({action: (params[:_original_action] || params[:action])})
new_params.delete(:_original_action)
def url_for_locale(locale, url = nil)
unless url.present?
new_params = params.merge({action: (params[:_original_action] || params[:action])})
new_params.delete(:_original_action)
if Rails.env.development? || Rails.env.test?
url = url_for(new_params.merge({lang: locale.to_s}))
else
url = url_for(new_params)
end
end
return url_for(new_params.merge({lang: locale.to_s})) if Rails.env.development? || Rails.env.test?
return "https://preview-#{locale.to_s}.bikebike.org#{url_for(new_params)}" if Rails.env.preview?
"https://#{locale.to_s}.bikebike.org#{url_for(new_params)}"
return url if Rails.env.development? || Rails.env.test?
return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview?
"https://#{locale.to_s}.bikebike.org#{url}"
end
def registration_steps(conference = @conference)