inherited_resources_helpers 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,16 +9,18 @@ module InheritedResources
9
9
  define_method(:"link_to_#{action}") do |*args|
10
10
  options = args.extract_options!
11
11
  options[:class] = [action, options[:class]].compact.join(' ')
12
+ scope = options.key?(:scope) ? options.delete(:scope) : 'actions'
12
13
 
13
14
  if action == :destroy
14
- model = args.last.class.respond_to?(:model_name) ? args.last : controller.resource
15
- name = model.class.model_name.human
16
- options.reverse_merge!(:method => :delete, :confirm => t(:'.confirm_destroy', :model_name => name))
15
+ model = args.last.class.respond_to?(:model_name) ? args.last : controller.resource
16
+ name = model.class.model_name.human
17
+ confirm = t(:'.confirmations.destroy', :model_name => name)
18
+ options.reverse_merge!(:method => :delete, :confirm => confirm)
17
19
  end
18
20
 
19
21
  link_text = args.shift if args.first.is_a?(String)
20
22
  link_text = t(args.shift) if args.first.is_a?(Symbol)
21
- link_text ||= t(:".#{action}")
23
+ link_text ||= t(:".#{[scope, action].compact.join('.')}")
22
24
 
23
25
  url = if args.first.is_a?(String)
24
26
  args.first
@@ -32,3 +34,4 @@ module InheritedResources
32
34
  end
33
35
  end
34
36
  end
37
+
@@ -64,6 +64,8 @@ module InheritedResources
64
64
  alias :destroy_url :show_url
65
65
  alias :destroy_path :show_path
66
66
 
67
+ alias :parent_path :show_parent_path
68
+
67
69
  protected
68
70
 
69
71
  def normalize_resources_for_url(args, &default)
@@ -1,3 +1,3 @@
1
1
  module InheritedResourcesHelpers
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.14'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inherited_resources_helpers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 13
10
- version: 0.0.13
9
+ - 14
10
+ version: 0.0.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-21 00:00:00 +02:00
18
+ date: 2010-11-03 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency