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
|
15
|
-
name
|
16
|
-
|
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
|
+
|
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:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
18
|
+
date: 2010-11-03 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|