i18n_routing 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +4 -0
- data/lib/i18n_routing_rails3.rb +9 -5
- data/spec/i18n_routing/i18n_spec.rb +4 -1
- data/spec/locales/fr.yml +2 -0
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/lib/i18n_routing_rails3.rb
CHANGED
@@ -246,24 +246,28 @@ module I18nRouting
|
|
246
246
|
[:map_method, :member, :collection].each do |m|
|
247
247
|
rfname = "#{m}_without_i18n_routing".to_sym
|
248
248
|
mod.send :define_method, "#{m}_with_i18n_routing".to_sym do |*args, &block|
|
249
|
-
|
249
|
+
|
250
250
|
if @localized_branch and @scope[:i18n_scope_level_resource] and @scope[:i18n_real_resource_name]
|
251
251
|
o = @scope[:scope_level_resource]
|
252
252
|
@scope[:scope_level_resource] = @scope[:i18n_scope_level_resource]
|
253
|
-
|
253
|
+
|
254
254
|
pname = @scope[:path_names] || {}
|
255
|
-
|
255
|
+
i = 1
|
256
|
+
while i < args.size and (String === args[i] or Symbol === args[i])
|
257
|
+
pname[args[i]] = args[i]
|
258
|
+
i += 1
|
259
|
+
end
|
256
260
|
scope(:path_names => I18nRouting.path_names(@scope[:i18n_real_resource_name], {:path_names => pname})) do
|
257
261
|
send(rfname, *args, &block)
|
258
262
|
end
|
259
263
|
@scope[:scope_level_resource] = o
|
260
264
|
return
|
261
265
|
end
|
262
|
-
|
266
|
+
|
263
267
|
send(rfname, *args, &block)
|
264
268
|
|
265
269
|
end
|
266
|
-
|
270
|
+
|
267
271
|
mod.send :alias_method_chain, m, :i18n_routing
|
268
272
|
end
|
269
273
|
end
|
@@ -17,7 +17,7 @@ describe :localized_routes do
|
|
17
17
|
map.localized(I18n.available_locales, :verbose => false) do
|
18
18
|
map.about 'about', :controller => 'about', :action => :show
|
19
19
|
|
20
|
-
map.resources :users, :member => {:level => :get}, :collection => {:groups => :get}
|
20
|
+
map.resources :users, :member => {:level => :get, :one => :get, :two => :get}, :collection => {:groups => :get}
|
21
21
|
map.resource :contact
|
22
22
|
|
23
23
|
map.resources :authors do |m|
|
@@ -68,6 +68,7 @@ describe :localized_routes do
|
|
68
68
|
resources :users do
|
69
69
|
member do
|
70
70
|
get :level
|
71
|
+
get :one, :two
|
71
72
|
end
|
72
73
|
get :groups, :on => :collection
|
73
74
|
end
|
@@ -238,6 +239,8 @@ describe :localized_routes do
|
|
238
239
|
routes.send(:level_user_path, 42).should == "/#{I18n.t :users, :scope => :resources}/42/level"
|
239
240
|
I18n.locale = :fr
|
240
241
|
routes.send(:level_user_path, 42).should == "/#{I18n.t :users, :scope => :resources}/42/#{I18n.t :level, :scope => :'routes.users.path_names'}"
|
242
|
+
routes.send(:one_user_path, 42).should == "/#{I18n.t :users, :scope => :resources}/42/#{I18n.t :one, :scope => :'routes.users.path_names'}"
|
243
|
+
routes.send(:two_user_path, 42).should == "/#{I18n.t :users, :scope => :resources}/42/#{I18n.t :two, :scope => :'routes.users.path_names'}"
|
241
244
|
end
|
242
245
|
|
243
246
|
it "custom collection" do
|
data/spec/locales/fr.yml
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 2
|
9
|
+
version: 0.4.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Guillaume Luccisano
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-20 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|