diff --git a/config/locales/en.yml b/config/locales/en.yml index a0617927..b103c866 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -77,3 +77,7 @@ en: email: Email phone: Phone message: Message + + routes: + contact: contact-us + thank_you: thank-you \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 35a5b4cf..5d9ca5e1 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -78,3 +78,7 @@ fr: email: E-mail phone: Téléphone message: Message + + routes: + contact: nous-joindre + thank_you: merci \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 4b5c55ca..9f4d129b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,13 +1,15 @@ Refinery::Core::Engine.routes.draw do # Frontend routes namespace :inquiries, :path => '' do - get Refinery::Inquiries.page_path_new, :to => 'inquiries#new', :as => 'new_inquiry' + localizable do + get Refinery::Inquiries.page_path_new, :to => 'inquiries#new', :as => 'new_inquiry' - resources :contact, :path => Refinery::Inquiries.post_path, :only => [:create], - :as => :inquiries, :controller => 'inquiries' + resources :contact, :path => Refinery::Inquiries.post_path, :only => [:create], + :as => :inquiries, :controller => 'inquiries' - resources :contact, :path => '', :only => [], :as => :inquiries, :controller => 'inquiries' do - get :thank_you, :path => Refinery::Inquiries.page_path_thank_you, :on => :collection + resources :contact, :path => '', :only => [], :as => :inquiries, :controller => 'inquiries' do + get :thank_you, :path => Refinery::Inquiries.page_path_thank_you, :on => :collection + end end end diff --git a/lib/refinery/inquiries.rb b/lib/refinery/inquiries.rb index 75eb98e0..6eafc211 100644 --- a/lib/refinery/inquiries.rb +++ b/lib/refinery/inquiries.rb @@ -1,6 +1,8 @@ require 'refinerycms-core' require 'refinerycms-settings' +require File.expand_path('../inquiries/extensions', __FILE__) + module Refinery autoload :InquiriesGenerator, 'generators/refinery/inquiries/inquiries_generator' diff --git a/lib/refinery/inquiries/extensions.rb b/lib/refinery/inquiries/extensions.rb new file mode 100644 index 00000000..610800eb --- /dev/null +++ b/lib/refinery/inquiries/extensions.rb @@ -0,0 +1 @@ +require File.expand_path('../extensions/mapper', __FILE__) diff --git a/lib/refinery/inquiries/extensions/mapper.rb b/lib/refinery/inquiries/extensions/mapper.rb new file mode 100644 index 00000000..26ab60d4 --- /dev/null +++ b/lib/refinery/inquiries/extensions/mapper.rb @@ -0,0 +1,17 @@ +require 'action_dispatch' + +module ActionDispatch + module Routing + class Mapper + def localizable + if defined? localized + localized do + yield + end + else + yield + end + end + end + end +end