i18n_routing 0.3.8 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.0 (September 08, 2010)
2
+
3
+ * Full support for Rails 3.0.0
4
+
1
5
  0.3.8 (August 30, 2010)
2
6
 
3
7
  * Support the first Rails3 official release (but nested resources is still broken)
data/README.rdoc CHANGED
@@ -6,7 +6,7 @@ All necessary informations are available on the wiki: http://wiki.github.com/kwi
6
6
 
7
7
  For any question, use the i18_routing google group: http://groups.google.com/group/i18n-routing
8
8
 
9
- Works with Rails 2.3 and Rails 3.0 ! (nested resources currently do not work on Rails3, will be fixed when Rails3 is released)
9
+ Works with Rails 2.3 and Rails 3.0
10
10
  => Rails3 beta and RC versions are no longer supported !
11
11
 
12
12
  == TODO for next releases (written the 9th of June)
@@ -28,7 +28,7 @@ module I18nRouting
28
28
  options = res.extract_options!
29
29
  r = res.first
30
30
 
31
- resource = type == :resource ? ActionDispatch::Routing::Mapper::SingletonResource.new(r, options.dup) : ActionDispatch::Routing::Mapper::Resource.new(r, options.dup)
31
+ resource = resource_from_params(type, r, options.dup)
32
32
 
33
33
  # Check for translated resource
34
34
  @locales.each do |locale|
@@ -41,6 +41,8 @@ module I18nRouting
41
41
  opts = options.dup
42
42
  opts[:path] = localized_path
43
43
  opts[:controller] ||= r.to_s.pluralize
44
+
45
+ resource = resource_from_params(type, r, opts.dup)
44
46
 
45
47
  res = ["#{locale}_#{r}".to_sym, opts]
46
48
 
@@ -50,8 +52,8 @@ module I18nRouting
50
52
  scope(:constraints => constraints, :path_names => I18nRouting.path_names(resource.name, @scope)) do
51
53
  localized_branch(locale) do
52
54
  send(type, *res) do
55
+
53
56
  # In the resource(s) block, we need to keep and restore some context :
54
-
55
57
  if block
56
58
  old_name = @scope[:i18n_real_resource_name]
57
59
  old = @scope[:scope_level_resource]
@@ -106,7 +108,7 @@ module I18nRouting
106
108
 
107
109
  # Return the aproximate deep in scope level
108
110
  def nested_deep
109
- (@scope and Array === @scope[:blocks] and @scope[:scope_level]) ? @scope[:blocks].size : 0
111
+ (@scope and Array === @scope[:nested_deep] and @scope[:scope_level]) ? @scope[:nested_deep].size : 0
110
112
  end
111
113
 
112
114
  public
@@ -204,14 +206,16 @@ module I18nRouting
204
206
  end
205
207
 
206
208
  def create_globalized_resources(type, *resources, &block)
207
-
208
209
  #puts "#{' ' * nested_deep}Call #{type} : #{resources.inspect} (#{@locales.inspect}) (#{@localized_branch}) (#{@skip_localization})"
209
210
 
211
+ @scope[:nested_deep] ||= []
212
+ @scope[:nested_deep] << 1
213
+
210
214
  cur_scope = nil
211
215
  if @locales
212
216
  localized = localized_resources(type, *resources, &block) if !@skip_localization
213
217
 
214
- ## We do not translate if we are in a translations branch :
218
+ ## We do not translate if we are in a translation branch :
215
219
  return if localized and nested_deep > 0
216
220
 
217
221
  # Set the current standard resource in order to customize url helper :
@@ -227,6 +231,8 @@ module I18nRouting
227
231
  send("#{type}_without_i18n_routing".to_sym, *resources, &block)
228
232
  end
229
233
  end
234
+
235
+ @scope[:nested_deep].pop
230
236
 
231
237
  end
232
238
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- - 8
9
- version: 0.3.8
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
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-08-30 00:00:00 +02:00
17
+ date: 2010-09-09 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency