Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localizable #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ en:
email: Email
phone: Phone
message: Message

routes:
contact: contact-us
thank_you: thank-you
4 changes: 4 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ fr:
email: E-mail
phone: Téléphone
message: Message

routes:
contact: nous-joindre
thank_you: merci
12 changes: 7 additions & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 2 additions & 0 deletions lib/refinery/inquiries.rb
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
1 change: 1 addition & 0 deletions lib/refinery/inquiries/extensions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require File.expand_path('../extensions/mapper', __FILE__)
17 changes: 17 additions & 0 deletions lib/refinery/inquiries/extensions/mapper.rb
Original file line number Diff line number Diff line change
@@ -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