Fixed locale not found contact form
This commit is contained in:
parent
32a0f02db2
commit
553e412685
@ -216,13 +216,21 @@ module ApplicationHelper
|
|||||||
content_tag(:span, text.html_safe, id: id, class: 'screen-reader-text')
|
content_tag(:span, text.html_safe, id: id, class: 'screen-reader-text')
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_for_locale(locale)
|
def url_for_locale(locale, url = nil)
|
||||||
new_params = params.merge({action: (params[:_original_action] || params[:action])})
|
unless url.present?
|
||||||
new_params.delete(:_original_action)
|
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 url if Rails.env.development? || Rails.env.test?
|
||||||
return "https://preview-#{locale.to_s}.bikebike.org#{url_for(new_params)}" if Rails.env.preview?
|
return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview?
|
||||||
"https://#{locale.to_s}.bikebike.org#{url_for(new_params)}"
|
"https://#{locale.to_s}.bikebike.org#{url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def registration_steps(conference = @conference)
|
def registration_steps(conference = @conference)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
- contact_reason ||= nil
|
- contact_reason ||= nil
|
||||||
= form_tag contact_send_path, class: 'contact-form' do
|
- locale ||= nil
|
||||||
|
= form_tag (locale.present? ? contact_send_url : url_for_locale(locale, contact_send_url)), class: 'contact-form' do
|
||||||
= emailfield :email, nil, big: true, required: true unless logged_in?
|
= emailfield :email, nil, big: true, required: true unless logged_in?
|
||||||
- if contact_reason.present?
|
- if contact_reason.present?
|
||||||
= hidden_field_tag :reason, contact_reason
|
= hidden_field_tag :reason, contact_reason
|
||||||
|
@ -10,4 +10,4 @@
|
|||||||
=_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale
|
=_'translate.content.change_locale', "Read in #{locale_translation}", vars: {language: locale_translation}, locale: locale
|
||||||
%h2= _'error.locale_not_available.volunteer.title'
|
%h2= _'error.locale_not_available.volunteer.title'
|
||||||
%p= _'error.locale_not_available.volunteer.description'
|
%p= _'error.locale_not_available.volunteer.description'
|
||||||
= render 'contact', cancel_btn: false, contact_reason: :website
|
= render 'contact', cancel_btn: false, contact_reason: :website, locale: :en
|
Loading…
x
Reference in New Issue
Block a user