cocoon 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/cocoon.gemspec +1 -1
- data/lib/cocoon/view_helpers.rb +2 -2
- data/spec/cocoon_spec.rb +8 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.19
|
data/cocoon.gemspec
CHANGED
data/lib/cocoon/view_helpers.rb
CHANGED
@@ -33,7 +33,7 @@ module Cocoon
|
|
33
33
|
# :nodoc:
|
34
34
|
def render_association(association, f, new_object, render_options={}, custom_partial=nil)
|
35
35
|
partial = setup_partial(custom_partial, association)
|
36
|
-
locals = render_options.delete(:locals)
|
36
|
+
locals = render_options.delete(:locals) || {}
|
37
37
|
method_name = f.respond_to?(:semantic_fields_for) ? :semantic_fields_for : (f.respond_to?(:simple_fields_for) ? :simple_fields_for : :fields_for)
|
38
38
|
f.send(method_name, association, new_object, {:child_index => "new_#{association}"}.merge(render_options)) do |builder|
|
39
39
|
partial_options = {:f => builder, :dynamic => true}.merge(locals)
|
@@ -58,7 +58,7 @@ module Cocoon
|
|
58
58
|
association = args[1]
|
59
59
|
html_options = args[2] || {}
|
60
60
|
options = args[3] || {}
|
61
|
-
link_to_add_association(capture(&block), f, association, html_options)
|
61
|
+
link_to_add_association(capture(&block), f, association, html_options, options)
|
62
62
|
else
|
63
63
|
name = args[0]
|
64
64
|
f = args[1]
|
data/spec/cocoon_spec.rb
CHANGED
@@ -45,6 +45,14 @@ describe Cocoon do
|
|
45
45
|
result.to_s.should == '<a href="#" class="floppy disk add_fields" data-association="comment" data-associations="comments" data-template="form<tag>">some long name</a>'
|
46
46
|
end
|
47
47
|
|
48
|
+
it "accepts options and passes them to link_to" do
|
49
|
+
@tester.unstub(:render_association)
|
50
|
+
@tester.should_receive(:render_association).with(anything(), anything(), anything(), anything(), "shared/partial").and_return('partiallll')
|
51
|
+
result = @tester.link_to_add_association( @form_obj, :comments, {:class => 'floppy disk'}, {:partial => "shared/partial"}) do
|
52
|
+
"some long name"
|
53
|
+
end
|
54
|
+
result.to_s.should == '<a href="#" class="floppy disk add_fields" data-association="comment" data-associations="comments" data-template="partiallll">some long name</a>'
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
context "with an irregular plural" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 19
|
10
|
+
version: 1.0.19
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nathan Van der Auwera
|