cocoon 1.2.6 → 1.2.7
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/.travis.yml +1 -1
- data/Gemfile +3 -3
- data/README.markdown +58 -23
- data/VERSION +1 -1
- data/cocoon.gemspec +15 -15
- data/gemfiles/Gemfile.rails-3.2.13 +3 -3
- data/lib/cocoon/view_helpers.rb +19 -16
- data/spec/cocoon_spec.rb +97 -51
- data/spec/generators/install_generator_spec.rb +4 -6
- data/spec/integration/navigation_spec.rb +2 -2
- data/spec/support/i18n.rb +3 -0
- data/spec/support/shared_examples.rb +11 -11
- metadata +53 -21
- checksums.yaml +0 -15
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,11 +3,11 @@ source "http://rubygems.org"
|
|
3
3
|
|
4
4
|
group :development, :test do
|
5
5
|
gem "rails", ">=4.0.0"
|
6
|
-
gem "sqlite3"
|
6
|
+
gem "sqlite3", "1.3.8"
|
7
7
|
gem "json_pure"
|
8
8
|
gem "jeweler"
|
9
|
-
gem "rspec-rails", "
|
10
|
-
gem "rspec", "
|
9
|
+
gem "rspec-rails", "~> 3.0.0"
|
10
|
+
gem "rspec", "~> 3.0.0"
|
11
11
|
gem "actionpack", ">=4.0.0"
|
12
12
|
gem "simplecov", :require => false
|
13
13
|
|
data/README.markdown
CHANGED
@@ -68,7 +68,7 @@ Your models are associated like this:
|
|
68
68
|
```ruby
|
69
69
|
class Project < ActiveRecord::Base
|
70
70
|
has_many :tasks
|
71
|
-
accepts_nested_attributes_for :tasks, :
|
71
|
+
accepts_nested_attributes_for :tasks, reject_if: :all_blank, allow_destroy: true
|
72
72
|
end
|
73
73
|
|
74
74
|
class Task < ActiveRecord::Base
|
@@ -83,10 +83,10 @@ named `_task_fields.html`.
|
|
83
83
|
### Strong Parameters Gotcha
|
84
84
|
|
85
85
|
To destroy nested models, rails uses a virtual attribute called `_destroy`.
|
86
|
-
When `_destroy` is set, the nested model will be deleted.
|
86
|
+
When `_destroy` is set, the nested model will be deleted. If the record is persisted, rails performs `id` field lookup to destroy the real record, so if `id` wasn't specified, it will treat current set of parameters like a parameters for a new record.
|
87
87
|
|
88
88
|
When using strong parameters (default in rails 4), you need to explicitly
|
89
|
-
add `:_destroy` to the list of permitted parameters.
|
89
|
+
add both `:id` and `:_destroy` to the list of permitted parameters.
|
90
90
|
|
91
91
|
E.g. in your `ProjectsController`:
|
92
92
|
|
@@ -98,7 +98,7 @@ E.g. in your `ProjectsController`:
|
|
98
98
|
|
99
99
|
## Examples
|
100
100
|
|
101
|
-
Cocoon's default configuration requires `link_to_add_association` and associated partials to
|
101
|
+
Cocoon's default configuration requires `link_to_add_association` and associated partials to
|
102
102
|
be properly wrapped with elements. The examples below illustrate simple layouts.
|
103
103
|
|
104
104
|
Please note these examples rely on the `haml` gem (instead of the default `erb` views).
|
@@ -115,7 +115,7 @@ In our `projects/_form` partial we'd write:
|
|
115
115
|
%h3 Tasks
|
116
116
|
#tasks
|
117
117
|
= f.semantic_fields_for :tasks do |task|
|
118
|
-
= render 'task_fields', :
|
118
|
+
= render 'task_fields', f: task
|
119
119
|
.links
|
120
120
|
= link_to_add_association 'add task', f, :tasks
|
121
121
|
= f.actions do
|
@@ -128,7 +128,7 @@ And in our `_task_fields` partial we'd write:
|
|
128
128
|
.nested-fields
|
129
129
|
= f.inputs do
|
130
130
|
= f.input :description
|
131
|
-
= f.input :done, :
|
131
|
+
= f.input :done, as: :boolean
|
132
132
|
= link_to_remove_association "remove task", f
|
133
133
|
```
|
134
134
|
|
@@ -145,7 +145,7 @@ In our `projects/_form` partial we'd write:
|
|
145
145
|
%h3 Tasks
|
146
146
|
#tasks
|
147
147
|
= f.simple_fields_for :tasks do |task|
|
148
|
-
= render 'task_fields', :
|
148
|
+
= render 'task_fields', f: task
|
149
149
|
.links
|
150
150
|
= link_to_add_association 'add task', f, :tasks
|
151
151
|
= f.submit
|
@@ -156,7 +156,7 @@ In our `_task_fields` partial we write:
|
|
156
156
|
```haml
|
157
157
|
.nested-fields
|
158
158
|
= f.input :description
|
159
|
-
= f.input :done, :
|
159
|
+
= f.input :done, as: :boolean
|
160
160
|
= link_to_remove_association "remove task", f
|
161
161
|
```
|
162
162
|
|
@@ -179,7 +179,7 @@ In our `projects/_form` partial we'd write:
|
|
179
179
|
%h3 Tasks
|
180
180
|
#tasks
|
181
181
|
= f.fields_for :tasks do |task|
|
182
|
-
= render 'task_fields', :
|
182
|
+
= render 'task_fields', f: task
|
183
183
|
.links
|
184
184
|
= link_to_add_association 'add task', f, :tasks
|
185
185
|
= f.submit
|
@@ -216,7 +216,7 @@ This should be called within the form builder.
|
|
216
216
|
- html_options: extra html-options (see [`link_to`](http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to)
|
217
217
|
There are some special options, the first three allow to control the placement of the new link-data:
|
218
218
|
- `data-association-insertion-traversal` : the jquery traversal method to allow node selection relative to the link. `closest`, `next`, `children`, etc. Default: absolute selection
|
219
|
-
- `data-association-insertion-node` : the jquery selector of the node
|
219
|
+
- `data-association-insertion-node` : the jquery selector of the node. Default: parent node
|
220
220
|
- `data-association-insertion-method` : jquery method that inserts the new data. `before`, `after`, `append`, `prepend`, etc. Default: `before`
|
221
221
|
- `data-association-insertion-position` : old method specifying where to insert new data.
|
222
222
|
- this setting still works but `data-association-insertion-method` takes precedence. may be removed in a future version.
|
@@ -233,21 +233,21 @@ Optionally, you can omit the name and supply a block that is captured to render
|
|
233
233
|
Inside the `html_options` you can add an option `:render_options`, and the containing hash will be handed down to the form builder for the inserted
|
234
234
|
form.
|
235
235
|
|
236
|
-
When using Twitter Bootstrap and SimpleForm together, `simple_fields_for` needs the option
|
236
|
+
When using Twitter Bootstrap and SimpleForm together, `simple_fields_for` needs the option `wrapper: 'inline'` which can
|
237
237
|
be handed down as follows:
|
238
238
|
|
239
|
-
(Note: In certain newer versions of simple_form, the option to use is
|
239
|
+
(Note: In certain newer versions of simple_form, the option to use is `wrapper: 'bootstrap'`.)
|
240
240
|
|
241
241
|
```haml
|
242
242
|
= link_to_add_association 'add something', f, :something,
|
243
|
-
:
|
243
|
+
render_options: { wrapper: 'inline' }
|
244
244
|
```
|
245
245
|
|
246
246
|
To specify locals that needed to handed down to the partial:
|
247
247
|
|
248
248
|
```haml
|
249
249
|
= link_to_add_association 'add something', f, :something,
|
250
|
-
:
|
250
|
+
render_options: {locals: { sherlock: 'Holmes' }}
|
251
251
|
```
|
252
252
|
|
253
253
|
#### :partial
|
@@ -256,7 +256,7 @@ To override the default partial name, e.g. because it shared between multiple vi
|
|
256
256
|
|
257
257
|
```haml
|
258
258
|
= link_to_add_association 'add something', f, :something,
|
259
|
-
:
|
259
|
+
partial: 'shared/something_fields'
|
260
260
|
```
|
261
261
|
|
262
262
|
#### :wrap_object
|
@@ -289,7 +289,7 @@ To use this:
|
|
289
289
|
|
290
290
|
```haml
|
291
291
|
= link_to_add_association('add something', @form_obj, :comments,
|
292
|
-
:
|
292
|
+
wrap_object: Proc.new {|comment| CommentDecorator.new(comment) })
|
293
293
|
```
|
294
294
|
|
295
295
|
Note that the `:wrap_object` expects an object that is _callable_, so any `Proc` will do. So you could as well use it to do some fancy extra initialisation (if needed).
|
@@ -298,8 +298,8 @@ E.g.
|
|
298
298
|
|
299
299
|
|
300
300
|
```haml
|
301
|
-
= link_to_add_association('add something', @form_obj, :comments,
|
302
|
-
:
|
301
|
+
= link_to_add_association('add something', @form_obj, :comments,
|
302
|
+
wrap_object: Proc.new { |comment| comment.name = current_user.name; comment })
|
303
303
|
```
|
304
304
|
|
305
305
|
#### :force_non_association_create
|
@@ -317,7 +317,7 @@ Example use:
|
|
317
317
|
|
318
318
|
```haml
|
319
319
|
= link_to_add_association('add something', @form_obj, :comments,
|
320
|
-
:
|
320
|
+
force_non_association_create: true)
|
321
321
|
```
|
322
322
|
|
323
323
|
By default `:force_non_association_create` is `false`.
|
@@ -335,9 +335,11 @@ It takes three parameters:
|
|
335
335
|
|
336
336
|
Optionally you could also leave out the name and supply a block that is captured to give the name (if you want to do something more complicated).
|
337
337
|
|
338
|
-
Optionally, you can add an html option called `wrapper_class` to use a different wrapper div instead of `.nested-
|
338
|
+
Optionally, you can add an html option called `wrapper_class` to use a different wrapper div instead of `.nested-fields`.
|
339
339
|
The class should be added without a preceding dot (`.`).
|
340
340
|
|
341
|
+
> Note: the javascript behind the generated link relies on the presence of a wrapper class (default `.nested-fields`) to function correctly.
|
342
|
+
|
341
343
|
Example:
|
342
344
|
```haml
|
343
345
|
= link_to_remove_association('remove this', @form_obj,
|
@@ -370,7 +372,7 @@ If in your view you have the following snippet to select an `owner`:
|
|
370
372
|
```haml
|
371
373
|
#owner
|
372
374
|
#owner_from_list
|
373
|
-
= f.association :owner, :
|
375
|
+
= f.association :owner, collection: Person.all(order: 'name'), prompt: 'Choose an existing owner'
|
374
376
|
= link_to_add_association 'add a new person as owner', f, :owner
|
375
377
|
```
|
376
378
|
|
@@ -465,8 +467,41 @@ For the JavaScript to behave correctly, the partial should start with a containe
|
|
465
467
|
|
466
468
|
There is no limit to the amount of nesting, though.
|
467
469
|
|
470
|
+
## I18n
|
471
|
+
|
472
|
+
As you seen in previous sections, the helper method `link_to_add_association` treats the first parameter as a name. Additionally, if it's skipped and the `form` object is passed as the first one, then **Cocoon** names it using **I18n**.
|
473
|
+
|
474
|
+
It allows to invoke helper methods like this:
|
475
|
+
|
476
|
+
```haml
|
477
|
+
= link_to_add_association form_object, :tasks
|
478
|
+
= link_to_remove_association form_object
|
479
|
+
```
|
480
|
+
|
481
|
+
instead of:
|
482
|
+
|
483
|
+
```haml
|
484
|
+
= link_to_add_association "Add task", form_object, :tasks
|
485
|
+
= link_to_remove_association "remove task", form_object
|
486
|
+
```
|
487
|
+
|
488
|
+
**Cocoon** uses the name of `association` as a translations scope key. If custom translations for association is not present it fallbacks to default name. Example of translations tree:
|
489
|
+
|
490
|
+
```yaml
|
491
|
+
en:
|
492
|
+
cocoon:
|
493
|
+
defaults:
|
494
|
+
add: "Add record"
|
495
|
+
remove: "Remove record"
|
496
|
+
tasks:
|
497
|
+
add: "Add new task"
|
498
|
+
remove: "Remove old task"
|
499
|
+
```
|
500
|
+
|
501
|
+
Note that `link_to_remove_association` does not require `association` name as an argument. In order to get correct translation key, **Cocoon** tableizes `class` name of the target object of form builder (`form_object.object` from previous example).
|
502
|
+
|
468
503
|
## Note on Patches/Pull Requests
|
469
|
-
|
504
|
+
|
470
505
|
* Fork the project.
|
471
506
|
* Make your feature addition or bug fix.
|
472
507
|
* Add tests for it. This is important so I don't break it in a
|
@@ -492,6 +527,6 @@ Copyright (c) 2010 Nathan Van der Auwera. See LICENSE for details.
|
|
492
527
|
|
493
528
|
## Not Related To Apache Cocoon
|
494
529
|
|
495
|
-
Please note that this project is not related to the Apache Cocoon web framework project.
|
530
|
+
Please note that this project is not related to the Apache Cocoon web framework project.
|
496
531
|
|
497
532
|
[Apache Cocoon](http://cocoon.apache.org/), Cocoon, and Apache are either registered trademarks or trademarks of the [Apache Software Foundation](http://www.apache.org/) in the United States and/or other countries.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.7
|
data/cocoon.gemspec
CHANGED
@@ -2,16 +2,14 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: cocoon 1.2.6 ruby lib
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = "cocoon"
|
9
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.7"
|
10
9
|
|
11
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
11
|
s.authors = ["Nathan Van der Auwera"]
|
14
|
-
s.date = "
|
12
|
+
s.date = "2016-01-27"
|
15
13
|
s.description = "Unobtrusive nested forms handling, using jQuery. Use this and discover cocoon-heaven."
|
16
14
|
s.email = "nathan@dixis.com"
|
17
15
|
s.extra_rdoc_files = [
|
@@ -75,24 +73,26 @@ Gem::Specification.new do |s|
|
|
75
73
|
"spec/generators/install_generator_spec.rb",
|
76
74
|
"spec/integration/navigation_spec.rb",
|
77
75
|
"spec/spec_helper.rb",
|
76
|
+
"spec/support/i18n.rb",
|
78
77
|
"spec/support/rails_version_helper.rb",
|
79
78
|
"spec/support/shared_examples.rb"
|
80
79
|
]
|
81
80
|
s.homepage = "http://github.com/nathanvda/cocoon"
|
82
81
|
s.licenses = ["MIT"]
|
83
|
-
s.
|
82
|
+
s.require_paths = ["lib"]
|
83
|
+
s.rubygems_version = "1.8.24"
|
84
84
|
s.summary = "gem that enables easier nested forms with standard forms, formtastic and simple-form"
|
85
85
|
|
86
86
|
if s.respond_to? :specification_version then
|
87
|
-
s.specification_version =
|
87
|
+
s.specification_version = 3
|
88
88
|
|
89
89
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
90
90
|
s.add_development_dependency(%q<rails>, [">= 4.0.0"])
|
91
|
-
s.add_development_dependency(%q<sqlite3>, ["
|
91
|
+
s.add_development_dependency(%q<sqlite3>, ["= 1.3.8"])
|
92
92
|
s.add_development_dependency(%q<json_pure>, [">= 0"])
|
93
93
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
94
|
-
s.add_development_dependency(%q<rspec-rails>, ["
|
95
|
-
s.add_development_dependency(%q<rspec>, ["
|
94
|
+
s.add_development_dependency(%q<rspec-rails>, ["~> 3.0.0"])
|
95
|
+
s.add_development_dependency(%q<rspec>, ["~> 3.0.0"])
|
96
96
|
s.add_development_dependency(%q<actionpack>, [">= 4.0.0"])
|
97
97
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
98
98
|
s.add_development_dependency(%q<nokogiri>, [">= 0"])
|
@@ -104,11 +104,11 @@ Gem::Specification.new do |s|
|
|
104
104
|
s.add_development_dependency(%q<rubinius-developer_tools>, [">= 0"])
|
105
105
|
else
|
106
106
|
s.add_dependency(%q<rails>, [">= 4.0.0"])
|
107
|
-
s.add_dependency(%q<sqlite3>, ["
|
107
|
+
s.add_dependency(%q<sqlite3>, ["= 1.3.8"])
|
108
108
|
s.add_dependency(%q<json_pure>, [">= 0"])
|
109
109
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
110
|
-
s.add_dependency(%q<rspec-rails>, ["
|
111
|
-
s.add_dependency(%q<rspec>, ["
|
110
|
+
s.add_dependency(%q<rspec-rails>, ["~> 3.0.0"])
|
111
|
+
s.add_dependency(%q<rspec>, ["~> 3.0.0"])
|
112
112
|
s.add_dependency(%q<actionpack>, [">= 4.0.0"])
|
113
113
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
114
114
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
@@ -121,11 +121,11 @@ Gem::Specification.new do |s|
|
|
121
121
|
end
|
122
122
|
else
|
123
123
|
s.add_dependency(%q<rails>, [">= 4.0.0"])
|
124
|
-
s.add_dependency(%q<sqlite3>, ["
|
124
|
+
s.add_dependency(%q<sqlite3>, ["= 1.3.8"])
|
125
125
|
s.add_dependency(%q<json_pure>, [">= 0"])
|
126
126
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
127
|
-
s.add_dependency(%q<rspec-rails>, ["
|
128
|
-
s.add_dependency(%q<rspec>, ["
|
127
|
+
s.add_dependency(%q<rspec-rails>, ["~> 3.0.0"])
|
128
|
+
s.add_dependency(%q<rspec>, ["~> 3.0.0"])
|
129
129
|
s.add_dependency(%q<actionpack>, [">= 4.0.0"])
|
130
130
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
131
131
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
@@ -3,11 +3,11 @@ source "http://rubygems.org"
|
|
3
3
|
|
4
4
|
group :development, :test do
|
5
5
|
gem "rails", "~> 3.2.0"
|
6
|
-
gem "sqlite3"
|
6
|
+
gem "sqlite3", "1.3.8"
|
7
7
|
gem "json_pure"
|
8
8
|
gem "jeweler"
|
9
|
-
gem "rspec-rails", "
|
10
|
-
gem "rspec", "
|
9
|
+
gem "rspec-rails", "~> 3.0.0"
|
10
|
+
gem "rspec", "~> 3.0.0"
|
11
11
|
gem "actionpack", "~> 3.2.0"
|
12
12
|
gem "simplecov", :require => false
|
13
13
|
|
data/lib/cocoon/view_helpers.rb
CHANGED
@@ -15,14 +15,16 @@ module Cocoon
|
|
15
15
|
|
16
16
|
def link_to_remove_association(*args, &block)
|
17
17
|
if block_given?
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
link_to_remove_association(capture(&block), *args)
|
19
|
+
elsif args.first.respond_to?(:object)
|
20
|
+
form = args.first
|
21
|
+
association = form.object.class.to_s.tableize
|
22
|
+
name = I18n.translate("cocoon.#{association}.remove", default: I18n.translate('cocoon.defaults.remove'))
|
23
|
+
|
24
|
+
link_to_remove_association(name, *args)
|
22
25
|
else
|
23
|
-
name
|
24
|
-
|
25
|
-
html_options = args[2] || {}
|
26
|
+
name, f, html_options = *args
|
27
|
+
html_options ||= {}
|
26
28
|
|
27
29
|
is_dynamic = f.object.new_record?
|
28
30
|
|
@@ -43,7 +45,8 @@ module Cocoon
|
|
43
45
|
def render_association(association, f, new_object, form_name, render_options={}, custom_partial=nil)
|
44
46
|
partial = get_partial_path(custom_partial, association)
|
45
47
|
locals = render_options.delete(:locals) || {}
|
46
|
-
|
48
|
+
ancestors = f.class.ancestors.map{|c| c.to_s}
|
49
|
+
method_name = ancestors.include?('SimpleForm::FormBuilder') ? :simple_fields_for : (ancestors.include?('Formtastic::FormBuilder') ? :semantic_fields_for : :fields_for)
|
47
50
|
f.send(method_name, association, new_object, {:child_index => "new_#{association}"}.merge(render_options)) do |builder|
|
48
51
|
partial_options = {form_name.to_sym => builder, :dynamic => true}.merge(locals)
|
49
52
|
render(partial, partial_options)
|
@@ -67,15 +70,15 @@ module Cocoon
|
|
67
70
|
|
68
71
|
def link_to_add_association(*args, &block)
|
69
72
|
if block_given?
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
link_to_add_association(capture(&block), *args)
|
74
|
+
elsif args.first.respond_to?(:object)
|
75
|
+
association = args.second
|
76
|
+
name = I18n.translate("cocoon.#{association}.add", default: I18n.translate('cocoon.defaults.add'))
|
77
|
+
|
78
|
+
link_to_add_association(name, *args)
|
74
79
|
else
|
75
|
-
name
|
76
|
-
|
77
|
-
association = args[2]
|
78
|
-
html_options = args[3] || {}
|
80
|
+
name, f, association, html_options = *args
|
81
|
+
html_options ||= {}
|
79
82
|
|
80
83
|
render_options = html_options.delete(:render_options)
|
81
84
|
render_options ||= {}
|
data/spec/cocoon_spec.rb
CHANGED
@@ -8,8 +8,8 @@ describe Cocoon do
|
|
8
8
|
|
9
9
|
subject {TestClass.new}
|
10
10
|
|
11
|
-
it {
|
12
|
-
it {
|
11
|
+
it { is_expected.to respond_to(:link_to_add_association) }
|
12
|
+
it { is_expected.to respond_to(:link_to_remove_association) }
|
13
13
|
|
14
14
|
before(:each) do
|
15
15
|
@tester = TestClass.new
|
@@ -20,7 +20,7 @@ describe Cocoon do
|
|
20
20
|
|
21
21
|
context "link_to_add_association" do
|
22
22
|
before(:each) do
|
23
|
-
@tester.
|
23
|
+
allow(@tester).to receive(:render_association).and_return('form<tag>')
|
24
24
|
end
|
25
25
|
|
26
26
|
context "without a block" do
|
@@ -33,6 +33,28 @@ describe Cocoon do
|
|
33
33
|
it_behaves_like "a correctly rendered add link", {}
|
34
34
|
end
|
35
35
|
|
36
|
+
context 'and no name given' do
|
37
|
+
context 'custom translation exists' do
|
38
|
+
before do
|
39
|
+
I18n.backend.store_translations(:en, :cocoon => { :comments => { :add => 'Add comment' } })
|
40
|
+
|
41
|
+
@html = @tester.link_to_add_association(@form_obj, :comments)
|
42
|
+
end
|
43
|
+
|
44
|
+
it_behaves_like "a correctly rendered add link", { text: 'Add comment' }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'uses default translation' do
|
48
|
+
before do
|
49
|
+
I18n.backend.store_translations(:en, :cocoon => { :defaults => { :add => 'Add' } })
|
50
|
+
|
51
|
+
@html = @tester.link_to_add_association(@form_obj, :comments)
|
52
|
+
end
|
53
|
+
|
54
|
+
it_behaves_like "a correctly rendered add link", { text: 'Add' }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
36
58
|
context "and given html options to pass them to link_to" do
|
37
59
|
before do
|
38
60
|
@html = @tester.link_to_add_association('add something', @form_obj, :comments, {:class => 'something silly'})
|
@@ -43,8 +65,8 @@ describe Cocoon do
|
|
43
65
|
|
44
66
|
context "and explicitly specifying the wanted partial" do
|
45
67
|
before do
|
46
|
-
@tester.
|
47
|
-
@tester.
|
68
|
+
allow(@tester).to receive(:render_association).and_call_original
|
69
|
+
expect(@tester).to receive(:render_association).with(anything(), anything(), anything(), "f", anything(), "shared/partial").and_return('partiallll')
|
48
70
|
@html = @tester.link_to_add_association('add something', @form_obj, :comments, :partial => "shared/partial")
|
49
71
|
end
|
50
72
|
|
@@ -52,15 +74,15 @@ describe Cocoon do
|
|
52
74
|
end
|
53
75
|
|
54
76
|
it "gives an opportunity to wrap/decorate created objects" do
|
55
|
-
@tester.
|
56
|
-
@tester.
|
77
|
+
allow(@tester).to receive(:render_association).and_call_original
|
78
|
+
expect(@tester).to receive(:render_association).with(anything(), anything(), kind_of(CommentDecorator), "f", anything(), anything()).and_return('partiallll')
|
57
79
|
@tester.link_to_add_association('add something', @form_obj, :comments, :wrap_object => Proc.new {|comment| CommentDecorator.new(comment) })
|
58
80
|
end
|
59
81
|
|
60
82
|
context "force non association create" do
|
61
83
|
context "default case: create object on association" do
|
62
84
|
before do
|
63
|
-
@tester.
|
85
|
+
expect(@tester).to receive(:create_object).with(anything, :comments , false)
|
64
86
|
@html = @tester.link_to_add_association('add something', @form_obj, :comments)
|
65
87
|
end
|
66
88
|
|
@@ -69,7 +91,7 @@ describe Cocoon do
|
|
69
91
|
|
70
92
|
context "and explicitly specifying false is the same as default" do
|
71
93
|
before do
|
72
|
-
@tester.
|
94
|
+
expect(@tester).to receive(:create_object).with(anything, :comments , false)
|
73
95
|
@html = @tester.link_to_add_association('add something', @form_obj, :comments, :force_non_association_create => false)
|
74
96
|
end
|
75
97
|
it_behaves_like "a correctly rendered add link", {}
|
@@ -77,7 +99,7 @@ describe Cocoon do
|
|
77
99
|
|
78
100
|
context "specifying true will not create objects on association but using the conditions" do
|
79
101
|
before do
|
80
|
-
@tester.
|
102
|
+
expect(@tester).to receive(:create_object).with(anything, :comments , true)
|
81
103
|
@html = @tester.link_to_add_association('add something', @form_obj, :comments, :force_non_association_create => true)
|
82
104
|
end
|
83
105
|
it_behaves_like "a correctly rendered add link", {}
|
@@ -127,8 +149,8 @@ describe Cocoon do
|
|
127
149
|
|
128
150
|
context "and explicitly specifying the wanted partial" do
|
129
151
|
before do
|
130
|
-
@tester.
|
131
|
-
@tester.
|
152
|
+
allow(@tester).to receive(:render_association).and_call_original
|
153
|
+
expect(@tester).to receive(:render_association).with(anything(), anything(), anything(), "f", anything(), "shared/partial").and_return('partiallll')
|
132
154
|
@html = @tester.link_to_add_association( @form_obj, :comments, :class => 'floppy disk', :partial => "shared/partial") do
|
133
155
|
"some long name"
|
134
156
|
end
|
@@ -157,13 +179,13 @@ describe Cocoon do
|
|
157
179
|
end
|
158
180
|
|
159
181
|
it "tttt" do
|
160
|
-
@post.class.reflect_on_association(:people).klass.new.
|
182
|
+
expect(@post.class.reflect_on_association(:people).klass.new).to be_a(Person)
|
161
183
|
end
|
162
184
|
|
163
185
|
context "with extra render-options for rendering the child relation" do
|
164
186
|
context "uses the correct plural" do
|
165
187
|
before do
|
166
|
-
@tester.
|
188
|
+
expect(@tester).to receive(:render_association).with(:people, @form_obj, anything, "f", {:wrapper => 'inline'}, nil)
|
167
189
|
@html = @tester.link_to_add_association('add something', @form_obj, :people, :render_options => {:wrapper => 'inline'})
|
168
190
|
end
|
169
191
|
it_behaves_like "a correctly rendered add link", {association: 'person', associations: 'people' }
|
@@ -173,18 +195,18 @@ describe Cocoon do
|
|
173
195
|
context "passing locals to the partial" do
|
174
196
|
context "when given: passes the locals to the partials" do
|
175
197
|
before do
|
176
|
-
@tester.
|
177
|
-
@form_obj.
|
178
|
-
@tester.
|
198
|
+
allow(@tester).to receive(:render_association).and_call_original
|
199
|
+
expect(@form_obj).to receive(:fields_for) { | association, new_object, options_hash, &block| block.call }
|
200
|
+
expect(@tester).to receive(:render).with("person_fields", {:f=>nil, :dynamic=>true, :alfred=>"Judoka"}).and_return ("partiallll")
|
179
201
|
@html = @tester.link_to_add_association('add something', @form_obj, :people, :render_options => {:wrapper => 'inline', :locals => {:alfred => 'Judoka'}})
|
180
202
|
end
|
181
203
|
it_behaves_like "a correctly rendered add link", {template: 'partiallll', association: 'person', associations: 'people' }
|
182
204
|
end
|
183
205
|
context "if no locals are given it still works" do
|
184
206
|
before do
|
185
|
-
@tester.
|
186
|
-
@form_obj.
|
187
|
-
@tester.
|
207
|
+
allow(@tester).to receive(:render_association).and_call_original
|
208
|
+
expect(@form_obj).to receive(:fields_for) { | association, new_object, options_hash, &block| block.call }
|
209
|
+
expect(@tester).to receive(:render).with("person_fields", {:f=>nil, :dynamic=>true}).and_return ("partiallll")
|
188
210
|
@html = @tester.link_to_add_association('add something', @form_obj, :people, :render_options => {:wrapper => 'inline'})
|
189
211
|
end
|
190
212
|
it_behaves_like "a correctly rendered add link", {template: 'partiallll', association: 'person', associations: 'people' }
|
@@ -196,9 +218,9 @@ describe Cocoon do
|
|
196
218
|
context "overruling the form parameter name" do
|
197
219
|
context "when given a form_name it passes it correctly to the partials" do
|
198
220
|
before do
|
199
|
-
@tester.
|
200
|
-
@form_obj.
|
201
|
-
@tester.
|
221
|
+
allow(@tester).to receive(:render_association).and_call_original
|
222
|
+
expect(@form_obj).to receive(:fields_for) { | association, new_object, options_hash, &block| block.call }
|
223
|
+
expect(@tester).to receive(:render).with("person_fields", {:people_form => nil, :dynamic=>true}).and_return ("partiallll")
|
202
224
|
@html = @tester.link_to_add_association('add something', @form_obj, :people, :form_name => 'people_form')
|
203
225
|
end
|
204
226
|
it_behaves_like "a correctly rendered add link", {template: 'partiallll', association: 'person', associations: 'people' }
|
@@ -208,13 +230,14 @@ describe Cocoon do
|
|
208
230
|
|
209
231
|
context "when using formtastic" do
|
210
232
|
before(:each) do
|
211
|
-
@tester.
|
212
|
-
@form_obj.
|
233
|
+
allow(@tester).to receive(:render_association).and_call_original
|
234
|
+
allow(@form_obj).to receive(:semantic_fields_for).and_return('form<tagzzz>')
|
213
235
|
end
|
214
236
|
context "calls semantic_fields_for and not fields_for" do
|
215
237
|
before do
|
216
|
-
@form_obj.
|
217
|
-
@form_obj.
|
238
|
+
allow(@form_obj).to receive_message_chain(:class, :ancestors) { ['Formtastic::FormBuilder'] }
|
239
|
+
expect(@form_obj).to receive(:semantic_fields_for)
|
240
|
+
expect(@form_obj).to receive(:fields_for).never
|
218
241
|
@html = @tester.link_to_add_association('add something', @form_obj, :people)
|
219
242
|
end
|
220
243
|
it_behaves_like "a correctly rendered add link", {template: 'form<tagzzz>', association: 'person', associations: 'people' }
|
@@ -222,16 +245,17 @@ describe Cocoon do
|
|
222
245
|
end
|
223
246
|
context "when using simple_form" do
|
224
247
|
before(:each) do
|
225
|
-
@tester.
|
226
|
-
@form_obj.
|
248
|
+
allow(@tester).to receive(:render_association).and_call_original
|
249
|
+
allow(@form_obj).to receive(:simple_fields_for).and_return('form<tagxxx>')
|
227
250
|
end
|
228
251
|
it "responds_to :simple_fields_for" do
|
229
|
-
@form_obj.
|
252
|
+
expect(@form_obj).to respond_to(:simple_fields_for)
|
230
253
|
end
|
231
254
|
context "calls simple_fields_for and not fields_for" do
|
232
255
|
before do
|
233
|
-
@form_obj.
|
234
|
-
@form_obj.
|
256
|
+
allow(@form_obj).to receive_message_chain(:class, :ancestors) { ['SimpleForm::FormBuilder'] }
|
257
|
+
expect(@form_obj).to receive(:simple_fields_for)
|
258
|
+
expect(@form_obj).to receive(:fields_for).never
|
235
259
|
@html = @tester.link_to_add_association('add something', @form_obj, :people)
|
236
260
|
end
|
237
261
|
it_behaves_like "a correctly rendered add link", {template: 'form<tagxxx>', association: 'person', associations: 'people' }
|
@@ -257,14 +281,36 @@ describe Cocoon do
|
|
257
281
|
it "is rendered inside a input element" do
|
258
282
|
doc = Nokogiri::HTML(@html)
|
259
283
|
removed = doc.at('input')
|
260
|
-
removed.attribute('id').value.
|
261
|
-
removed.attribute('name').value.
|
262
|
-
removed.attribute('value').value.
|
284
|
+
expect(removed.attribute('id').value).to eq("Post__destroy")
|
285
|
+
expect(removed.attribute('name').value).to eq("Post[_destroy]")
|
286
|
+
expect(removed.attribute('value').value).to eq("false")
|
263
287
|
end
|
264
288
|
|
265
289
|
it_behaves_like "a correctly rendered remove link", {}
|
266
290
|
end
|
267
291
|
|
292
|
+
context 'no name given' do
|
293
|
+
context 'custom translation exists' do
|
294
|
+
before do
|
295
|
+
I18n.backend.store_translations(:en, :cocoon => { :posts => { :remove => 'Remove post' } })
|
296
|
+
|
297
|
+
@html = @tester.link_to_remove_association(@form_obj)
|
298
|
+
end
|
299
|
+
|
300
|
+
it_behaves_like "a correctly rendered remove link", { text: 'Remove post' }
|
301
|
+
end
|
302
|
+
|
303
|
+
context 'uses default translation' do
|
304
|
+
before do
|
305
|
+
I18n.backend.store_translations(:en, :cocoon => { :defaults => { :remove => 'Remove' } })
|
306
|
+
|
307
|
+
@html = @tester.link_to_remove_association(@form_obj)
|
308
|
+
end
|
309
|
+
|
310
|
+
it_behaves_like "a correctly rendered remove link", { text: 'Remove' }
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
268
314
|
context "accepts html options and pass them to link_to" do
|
269
315
|
before do
|
270
316
|
@html = @tester.link_to_remove_association('remove something', @form_obj, {:class => 'add_some_class', :'data-something' => 'bla'})
|
@@ -287,9 +333,9 @@ describe Cocoon do
|
|
287
333
|
it "is rendered inside a input element" do
|
288
334
|
doc = Nokogiri::HTML(@html)
|
289
335
|
removed = doc.at('input')
|
290
|
-
removed.attribute('id').value.
|
291
|
-
removed.attribute('name').value.
|
292
|
-
removed.attribute('value').value.
|
336
|
+
expect(removed.attribute('id').value).to eq("Post__destroy")
|
337
|
+
expect(removed.attribute('name').value).to eq("Post[_destroy]")
|
338
|
+
expect(removed.attribute('value').value).to eq("true")
|
293
339
|
end
|
294
340
|
|
295
341
|
it_behaves_like "a correctly rendered remove link", {class: 'remove_fields dynamic destroyed'}
|
@@ -336,7 +382,7 @@ describe Cocoon do
|
|
336
382
|
|
337
383
|
context "create_object" do
|
338
384
|
it "creates correct association with conditions" do
|
339
|
-
@tester.
|
385
|
+
expect(@tester).not_to receive(:create_object_with_conditions)
|
340
386
|
# in rails4 we cannot create an associated object when the object has not been saved before
|
341
387
|
# I submitted a bug for this: https://github.com/rails/rails/issues/11376
|
342
388
|
if Rails.rails4?
|
@@ -344,16 +390,16 @@ describe Cocoon do
|
|
344
390
|
@form_obj = double(:object => @post, :object_name => @post.class.name)
|
345
391
|
end
|
346
392
|
result = @tester.create_object(@form_obj, :admin_comments)
|
347
|
-
result.author.
|
348
|
-
@form_obj.object.admin_comments.
|
393
|
+
expect(result.author).to eq("Admin")
|
394
|
+
expect(@form_obj.object.admin_comments).to be_empty
|
349
395
|
end
|
350
396
|
|
351
397
|
it "creates correct association for belongs_to associations" do
|
352
398
|
comment = Comment.new
|
353
399
|
form_obj = double(:object => Comment.new)
|
354
400
|
result = @tester.create_object(form_obj, :post)
|
355
|
-
result.
|
356
|
-
comment.post.
|
401
|
+
expect(result).to be_a Post
|
402
|
+
expect(comment.post).to be_nil
|
357
403
|
end
|
358
404
|
|
359
405
|
it "raises an error if cannot reflect on association" do
|
@@ -362,30 +408,30 @@ describe Cocoon do
|
|
362
408
|
|
363
409
|
it "creates an association if object responds to 'build_association' as singular" do
|
364
410
|
object = Comment.new
|
365
|
-
object.
|
366
|
-
@tester.create_object(double(:object => object), :custom_item).
|
411
|
+
expect(object).to receive(:build_custom_item).and_return 'custom'
|
412
|
+
expect(@tester.create_object(double(:object => object), :custom_item)).to eq('custom')
|
367
413
|
end
|
368
414
|
|
369
415
|
it "creates an association if object responds to 'build_association' as plural" do
|
370
416
|
object = Comment.new
|
371
|
-
object.
|
372
|
-
@tester.create_object(double(:object => object), :custom_items).
|
417
|
+
expect(object).to receive(:build_custom_item).and_return 'custom'
|
418
|
+
expect(@tester.create_object(double(:object => object), :custom_items)).to eq('custom')
|
373
419
|
end
|
374
420
|
|
375
421
|
it "can create using only conditions not the association" do
|
376
|
-
@tester.
|
377
|
-
@tester.create_object(@form_obj, :comments, true).
|
422
|
+
expect(@tester).to receive(:create_object_with_conditions).and_return('flappie')
|
423
|
+
expect(@tester.create_object(@form_obj, :comments, true)).to eq('flappie')
|
378
424
|
end
|
379
425
|
end
|
380
426
|
|
381
427
|
context "get_partial_path" do
|
382
428
|
it "generates the default partial name if no partial given" do
|
383
429
|
result = @tester.get_partial_path(nil, :admin_comments)
|
384
|
-
result.
|
430
|
+
expect(result).to eq("admin_comment_fields")
|
385
431
|
end
|
386
432
|
it "uses the given partial name" do
|
387
433
|
result = @tester.get_partial_path("comment_fields", :admin_comments)
|
388
|
-
result.
|
434
|
+
expect(result).to eq("comment_fields")
|
389
435
|
end
|
390
436
|
end
|
391
437
|
|
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'rspec/mocks'
|
3
|
-
require 'rspec/rails/mocks'
|
4
2
|
|
5
3
|
require 'generator_spec/test_case'
|
6
4
|
require 'generators/cocoon/install/install_generator'
|
@@ -13,18 +11,18 @@ describe Cocoon::Generators::InstallGenerator do
|
|
13
11
|
context "in rails 3.0" do
|
14
12
|
context "with no arguments" do
|
15
13
|
before(:each) do
|
16
|
-
::Rails.
|
14
|
+
allow(::Rails).to receive(:version) { '3.0.8' }
|
17
15
|
prepare_destination
|
18
16
|
run_generator
|
19
17
|
end
|
20
18
|
|
21
19
|
it "stubs the version correctly" do
|
22
|
-
::Rails.version[0..2].
|
20
|
+
expect(::Rails.version[0..2]).to eq("3.0")
|
23
21
|
end
|
24
22
|
|
25
23
|
it "stubs the version correctly" do
|
26
24
|
test_version = (::Rails.version[0..2].to_f >= 3.1)
|
27
|
-
test_version.
|
25
|
+
expect(test_version).to be_falsey
|
28
26
|
end
|
29
27
|
|
30
28
|
it "copies cocoon.js to the correct folder" do
|
@@ -36,7 +34,7 @@ describe Cocoon::Generators::InstallGenerator do
|
|
36
34
|
context "in rails 3.1" do
|
37
35
|
context "with no arguments" do
|
38
36
|
before(:each) do
|
39
|
-
::Rails.
|
37
|
+
allow(::Rails).to receive(:version) { '3.1.0' }
|
40
38
|
prepare_destination
|
41
39
|
run_generator
|
42
40
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "Navigation" do
|
3
|
+
describe "Navigation", :type => :request do
|
4
4
|
# include Capybara
|
5
5
|
|
6
6
|
it "should be a valid app" do
|
7
|
-
::Rails.application.
|
7
|
+
expect(::Rails.application).to be_a(Dummy::Application)
|
8
8
|
end
|
9
9
|
end
|
@@ -17,24 +17,24 @@ shared_examples_for "a correctly rendered add link" do |options|
|
|
17
17
|
@link = doc.at('a')
|
18
18
|
end
|
19
19
|
it 'has a correct href' do
|
20
|
-
@link.attribute('href').value.
|
20
|
+
expect(@link.attribute('href').value).to eq(@options[:href])
|
21
21
|
end
|
22
22
|
it 'has a correct class' do
|
23
|
-
@link.attribute('class').value.
|
23
|
+
expect(@link.attribute('class').value).to eq(@options[:class])
|
24
24
|
end
|
25
25
|
it 'has a correct template' do
|
26
|
-
@link.attribute('data-association-insertion-template').value.
|
26
|
+
expect(@link.attribute('data-association-insertion-template').value).to eq(@options[:template])
|
27
27
|
end
|
28
28
|
it 'has a correct associations' do
|
29
|
-
@link.attribute('data-association').value.
|
30
|
-
@link.attribute('data-associations').value.
|
29
|
+
expect(@link.attribute('data-association').value).to eq(@options[:association])
|
30
|
+
expect(@link.attribute('data-associations').value).to eq(@options[:associations])
|
31
31
|
end
|
32
32
|
it 'has the correct text' do
|
33
|
-
@link.text.
|
33
|
+
expect(@link.text).to eq(@options[:text])
|
34
34
|
end
|
35
35
|
it 'sets extra attributes correctly' do
|
36
36
|
@options[:extra_attributes].each do |key, value|
|
37
|
-
@link.attribute(key).value.
|
37
|
+
expect(@link.attribute(key).value).to eq(value)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -56,17 +56,17 @@ shared_examples_for "a correctly rendered remove link" do |options|
|
|
56
56
|
@link = doc.at('a')
|
57
57
|
end
|
58
58
|
it 'has a correct href' do
|
59
|
-
@link.attribute('href').value.
|
59
|
+
expect(@link.attribute('href').value).to eq(@options[:href])
|
60
60
|
end
|
61
61
|
it 'has a correct class' do
|
62
|
-
@link.attribute('class').value.
|
62
|
+
expect(@link.attribute('class').value).to eq(@options[:class])
|
63
63
|
end
|
64
64
|
it 'has the correct text' do
|
65
|
-
@link.text.
|
65
|
+
expect(@link.text).to eq(@options[:text])
|
66
66
|
end
|
67
67
|
it 'sets extra attributes correctly' do
|
68
68
|
@options[:extra_attributes].each do |key, value|
|
69
|
-
@link.attribute(key).value.
|
69
|
+
expect(@link.attribute(key).value).to eq(value)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Nathan Van der Auwera
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,20 +30,23 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: sqlite3
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - '='
|
32
36
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
37
|
+
version: 1.3.8
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - '='
|
39
44
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
45
|
+
version: 1.3.8
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: json_pure
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: jeweler
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,38 +78,39 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rspec-rails
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- -
|
83
|
+
- - ~>
|
74
84
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
-
Mi44LjA=
|
85
|
+
version: 3.0.0
|
77
86
|
type: :development
|
78
87
|
prerelease: false
|
79
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
80
90
|
requirements:
|
81
|
-
- -
|
91
|
+
- - ~>
|
82
92
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
84
|
-
Mi44LjA=
|
93
|
+
version: 3.0.0
|
85
94
|
- !ruby/object:Gem::Dependency
|
86
95
|
name: rspec
|
87
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
88
98
|
requirements:
|
89
|
-
- -
|
99
|
+
- - ~>
|
90
100
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
92
|
-
Mi44LjA=
|
101
|
+
version: 3.0.0
|
93
102
|
type: :development
|
94
103
|
prerelease: false
|
95
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
96
106
|
requirements:
|
97
|
-
- -
|
107
|
+
- - ~>
|
98
108
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
100
|
-
Mi44LjA=
|
109
|
+
version: 3.0.0
|
101
110
|
- !ruby/object:Gem::Dependency
|
102
111
|
name: actionpack
|
103
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
104
114
|
requirements:
|
105
115
|
- - ! '>='
|
106
116
|
- !ruby/object:Gem::Version
|
@@ -108,6 +118,7 @@ dependencies:
|
|
108
118
|
type: :development
|
109
119
|
prerelease: false
|
110
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
111
122
|
requirements:
|
112
123
|
- - ! '>='
|
113
124
|
- !ruby/object:Gem::Version
|
@@ -115,6 +126,7 @@ dependencies:
|
|
115
126
|
- !ruby/object:Gem::Dependency
|
116
127
|
name: simplecov
|
117
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
118
130
|
requirements:
|
119
131
|
- - ! '>='
|
120
132
|
- !ruby/object:Gem::Version
|
@@ -122,6 +134,7 @@ dependencies:
|
|
122
134
|
type: :development
|
123
135
|
prerelease: false
|
124
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
125
138
|
requirements:
|
126
139
|
- - ! '>='
|
127
140
|
- !ruby/object:Gem::Version
|
@@ -129,6 +142,7 @@ dependencies:
|
|
129
142
|
- !ruby/object:Gem::Dependency
|
130
143
|
name: nokogiri
|
131
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
132
146
|
requirements:
|
133
147
|
- - ! '>='
|
134
148
|
- !ruby/object:Gem::Version
|
@@ -136,6 +150,7 @@ dependencies:
|
|
136
150
|
type: :development
|
137
151
|
prerelease: false
|
138
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
139
154
|
requirements:
|
140
155
|
- - ! '>='
|
141
156
|
- !ruby/object:Gem::Version
|
@@ -143,6 +158,7 @@ dependencies:
|
|
143
158
|
- !ruby/object:Gem::Dependency
|
144
159
|
name: generator_spec
|
145
160
|
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
146
162
|
requirements:
|
147
163
|
- - ! '>='
|
148
164
|
- !ruby/object:Gem::Version
|
@@ -150,6 +166,7 @@ dependencies:
|
|
150
166
|
type: :development
|
151
167
|
prerelease: false
|
152
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
153
170
|
requirements:
|
154
171
|
- - ! '>='
|
155
172
|
- !ruby/object:Gem::Version
|
@@ -157,6 +174,7 @@ dependencies:
|
|
157
174
|
- !ruby/object:Gem::Dependency
|
158
175
|
name: rubysl
|
159
176
|
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
160
178
|
requirements:
|
161
179
|
- - ! '>='
|
162
180
|
- !ruby/object:Gem::Version
|
@@ -164,6 +182,7 @@ dependencies:
|
|
164
182
|
type: :development
|
165
183
|
prerelease: false
|
166
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
167
186
|
requirements:
|
168
187
|
- - ! '>='
|
169
188
|
- !ruby/object:Gem::Version
|
@@ -171,6 +190,7 @@ dependencies:
|
|
171
190
|
- !ruby/object:Gem::Dependency
|
172
191
|
name: rubysl-test-unit
|
173
192
|
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
174
194
|
requirements:
|
175
195
|
- - ! '>='
|
176
196
|
- !ruby/object:Gem::Version
|
@@ -178,6 +198,7 @@ dependencies:
|
|
178
198
|
type: :development
|
179
199
|
prerelease: false
|
180
200
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
181
202
|
requirements:
|
182
203
|
- - ! '>='
|
183
204
|
- !ruby/object:Gem::Version
|
@@ -185,6 +206,7 @@ dependencies:
|
|
185
206
|
- !ruby/object:Gem::Dependency
|
186
207
|
name: psych
|
187
208
|
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
188
210
|
requirements:
|
189
211
|
- - ! '>='
|
190
212
|
- !ruby/object:Gem::Version
|
@@ -192,6 +214,7 @@ dependencies:
|
|
192
214
|
type: :development
|
193
215
|
prerelease: false
|
194
216
|
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
195
218
|
requirements:
|
196
219
|
- - ! '>='
|
197
220
|
- !ruby/object:Gem::Version
|
@@ -199,6 +222,7 @@ dependencies:
|
|
199
222
|
- !ruby/object:Gem::Dependency
|
200
223
|
name: racc
|
201
224
|
requirement: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
202
226
|
requirements:
|
203
227
|
- - ! '>='
|
204
228
|
- !ruby/object:Gem::Version
|
@@ -206,6 +230,7 @@ dependencies:
|
|
206
230
|
type: :development
|
207
231
|
prerelease: false
|
208
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
209
234
|
requirements:
|
210
235
|
- - ! '>='
|
211
236
|
- !ruby/object:Gem::Version
|
@@ -213,6 +238,7 @@ dependencies:
|
|
213
238
|
- !ruby/object:Gem::Dependency
|
214
239
|
name: rubinius-developer_tools
|
215
240
|
requirement: !ruby/object:Gem::Requirement
|
241
|
+
none: false
|
216
242
|
requirements:
|
217
243
|
- - ! '>='
|
218
244
|
- !ruby/object:Gem::Version
|
@@ -220,6 +246,7 @@ dependencies:
|
|
220
246
|
type: :development
|
221
247
|
prerelease: false
|
222
248
|
version_requirements: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
223
250
|
requirements:
|
224
251
|
- - ! '>='
|
225
252
|
- !ruby/object:Gem::Version
|
@@ -289,31 +316,36 @@ files:
|
|
289
316
|
- spec/generators/install_generator_spec.rb
|
290
317
|
- spec/integration/navigation_spec.rb
|
291
318
|
- spec/spec_helper.rb
|
319
|
+
- spec/support/i18n.rb
|
292
320
|
- spec/support/rails_version_helper.rb
|
293
321
|
- spec/support/shared_examples.rb
|
294
322
|
homepage: http://github.com/nathanvda/cocoon
|
295
323
|
licenses:
|
296
324
|
- MIT
|
297
|
-
metadata: {}
|
298
325
|
post_install_message:
|
299
326
|
rdoc_options: []
|
300
327
|
require_paths:
|
301
328
|
- lib
|
302
329
|
required_ruby_version: !ruby/object:Gem::Requirement
|
330
|
+
none: false
|
303
331
|
requirements:
|
304
332
|
- - ! '>='
|
305
333
|
- !ruby/object:Gem::Version
|
306
334
|
version: '0'
|
335
|
+
segments:
|
336
|
+
- 0
|
337
|
+
hash: -1378407659540710243
|
307
338
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
339
|
+
none: false
|
308
340
|
requirements:
|
309
341
|
- - ! '>='
|
310
342
|
- !ruby/object:Gem::Version
|
311
343
|
version: '0'
|
312
344
|
requirements: []
|
313
345
|
rubyforge_project:
|
314
|
-
rubygems_version:
|
346
|
+
rubygems_version: 1.8.24
|
315
347
|
signing_key:
|
316
|
-
specification_version:
|
348
|
+
specification_version: 3
|
317
349
|
summary: gem that enables easier nested forms with standard forms, formtastic and
|
318
350
|
simple-form
|
319
351
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
M2MwYmFkNzAwZjhhYjA2NmEwMjMxMzMwY2Q0ZjNiNzU5YzFkZWE4YQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmE1YTIwY2YzOTVkOTI1NzkzNGE4ZjIyZmUyZGI4ZTA0OTRkMmVhNg==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ZGZhNGU1N2FlNGZlOTFjYjVlZmNjZTFkMDIzYzE2OGNjMDJmZDljMTMxYTFh
|
10
|
-
MTIzYzkyNzExOWNlODljYzk0ZTQ2NmM3NzY2MDUyMmJiZjhmMGUzOWQ5Mzdh
|
11
|
-
YWRlNmM4NDZiMjdmZDdmNGEyYjVjOWYxYTc4ZjJkM2JhMWI0Yzg=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzUxMTgzY2VlOWRiNzgyMDlhMWRmYTU5ZmJjNjI4YjBlYzAwYmRmZTRkMzM4
|
14
|
-
MDNlOGFiNDAyMTM5ZWJlZjkxMDc3ZWEwZGRiNmNkZTI3Njk1NWRkNjQzMjhj
|
15
|
-
MzkxODI0NDkyMmU1NjU0NDkwYTQwNzQzNzE5NzQwODMyM2JlNjY=
|