Browse Source

Fixed contact form

development
LinguaFrancaTranslator 8 years ago
parent
commit
f917c20581
  1. 9
      app/helpers/application_helper.rb
  2. 2
      app/views/application/_contact.html.haml
  3. 2
      db/schema.rb

9
app/helpers/application_helper.rb

@ -217,15 +217,18 @@ module ApplicationHelper
end
def url_for_locale(locale, url = nil)
return url unless locale.present?
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)
return url_for(new_params.merge({lang: locale.to_s}))
end
subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s
return url_for(new_params.merge(host: "#{subdomain}.bikebike.org"))
end
return url if Rails.env.development? || Rails.env.test?

2
app/views/application/_contact.html.haml

@ -1,6 +1,6 @@
- contact_reason ||= nil
- locale ||= nil
= form_tag (locale.present? ? contact_send_url : url_for_locale(locale, contact_send_url)), class: 'contact-form' do
= form_tag (locale.present? ? contact_send_url : url_for_locale(locale, contact_send_path)), class: 'contact-form' do
= emailfield :email, nil, big: true, required: true unless logged_in?
- if contact_reason.present?
= hidden_field_tag :reason, contact_reason

2
db/schema.rb

@ -290,7 +290,7 @@ ActiveRecord::Schema.define(version: 20160708042511) do
t.integer "translator_id"
t.string "key"
t.text "value"
t.date "created_at"
t.datetime "created_at"
end
create_table "translations", force: :cascade do |t|

Loading…
Cancel
Save