cocooned 2.4.1 → 2.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +11 -8
- data/cocooned.gemspec +2 -2
- data/lib/cocooned/helpers/containers.rb +4 -4
- data/lib/cocooned/helpers/tags/add.rb +4 -4
- data/lib/cocooned/helpers/tags/down.rb +4 -4
- data/lib/cocooned/helpers/tags/remove.rb +4 -4
- data/lib/cocooned/helpers/tags/up.rb +4 -4
- data/lib/cocooned/helpers/tags.rb +4 -4
- data/lib/cocooned/tags/add.rb +2 -2
- data/lib/cocooned/version.rb +1 -1
- metadata +8 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f2af10b0b746c5011676ba112458b540d192803ca0b1ddf527464b748003ed5
|
|
4
|
+
data.tar.gz: 0246debfd5bf517de6b2ae2ef10bc2caa117c732c855943ee998513ba4dd5ead
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6636bfb5b815f29ce6285bd504bc0c9a43196f70d0b0b21e771bee1e67338eec2ff64251012e8f5d67d2d54606c8538c2eb27a57f99ef70242d81bc6d5672e2
|
|
7
|
+
data.tar.gz: f8ba105ad6016c0ee6d846344543d7afda37cd7e52a07baa1ab80cc7392bbe0abf8ba32ec59e8201d5c0daa9ab19583973061d174909e27a1be958d157d6d58c
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
## Version 2.5.0 (2025-10-23)
|
|
12
|
+
|
|
13
|
+
* Upgrade to use `eslint ~> 9` (#103)
|
|
14
|
+
* Configure dependabot to auto-update Github Actions (#99)
|
|
15
|
+
* Drop support for Rails 7.1, Ruby 2.7 and Ruby 3.1 (#98)
|
|
16
|
+
* Add Rails 8.1 to the test matrix (#96)
|
|
17
|
+
* Remove Rails 7.0 from the test matrix (#92)
|
|
18
|
+
* Add Ruby 3.4 to the test matrix (#88)
|
|
19
|
+
|
|
9
20
|
## Version 2.4.1 (2024-11-25)
|
|
10
21
|
|
|
11
22
|
### Changed
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Cocooned makes it easier to handle nested forms in Rails.
|
|
7
7
|
|
|
8
|
-
Cocooned is form builder-agnostic: it works with standard Rails (>= 7.0, < 8.
|
|
8
|
+
Cocooned is form builder-agnostic: it works with standard Rails (>= 7.0, < 8.2) form helpers, [Formtastic](https://github.com/justinfrench/formtastic) or [SimpleForm](https://github.com/plataformatec/simple_form).
|
|
9
9
|
|
|
10
10
|
1. [Background](#some-background)
|
|
11
11
|
2. [Installation](#installation)
|
|
@@ -23,7 +23,7 @@ Cocooned is a fork of [Cocoon](https://github.com/nathanvda/cocoon) by [Nathan V
|
|
|
23
23
|
|
|
24
24
|
However, the project seems to have only received minimal fixes since 2018 and many pull requests, even simple ones, have been on hold for a long time. In 2019, as I needed more than what Cocoon provided at this time, I had the choice to either maintain an extension or to fork it and integrate everything that was waiting and more.
|
|
25
25
|
|
|
26
|
-
Over the time, Cocooned turned into an almost complete rewrite of Cocoon with more functionnalities, a more fluent API (I hope) and integration with modern toolchains. Still, **Cocooned is
|
|
26
|
+
Over the time, Cocooned turned into an almost complete rewrite of Cocoon with more functionnalities, a more fluent API (I hope) and integration with modern toolchains. Still, **Cocooned is compatible with Cocoon and can be used as a**(n almost) **drop-in replacement. This compatibility layer with the original Cocoon API will be dropped in the next major release.**
|
|
27
27
|
|
|
28
28
|
On the JavaScript side, Cocooned 2.0 removed the dependency to jQuery (Yeah! :tada:). See [JavaScript](#javascript) for details.
|
|
29
29
|
|
|
@@ -40,15 +40,18 @@ gem 'cocooned'
|
|
|
40
40
|
Cocooned comes with an NPM companion package: [`@notus.sh/cocooned`](https://www.npmjs.com/package/@notus.sh/cocooned).
|
|
41
41
|
It bundles JavaScript files to handles in-browser interactions with your nested forms.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Install it with your favorite package manager:
|
|
44
44
|
|
|
45
45
|
```shell
|
|
46
|
+
# bun
|
|
47
|
+
$ bun install @notus.sh/cocooned
|
|
48
|
+
# importmap (Rails ~7.0 default)
|
|
46
49
|
$ bin/importmap pin @notus.sh/cocooned
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
# npm
|
|
51
|
+
$ npm install @notus.sh/cocooned
|
|
52
|
+
# pnpm
|
|
53
|
+
$ pnpm add @notus.sh/cocooned
|
|
54
|
+
# yarn
|
|
52
55
|
$ yarn add @notus.sh/cocooned
|
|
53
56
|
```
|
|
54
57
|
|
data/cocooned.gemspec
CHANGED
|
@@ -38,9 +38,9 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
39
39
|
f.match(excluded_dirs) || excluded_files.include?(f)
|
|
40
40
|
end
|
|
41
|
-
spec.required_ruby_version = '>=
|
|
41
|
+
spec.required_ruby_version = '>= 3.1'
|
|
42
42
|
|
|
43
|
-
spec.add_dependency 'rails', '>= 7.
|
|
43
|
+
spec.add_dependency 'rails', '>= 7.2', '< 8.2'
|
|
44
44
|
|
|
45
45
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
|
46
46
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
@@ -29,13 +29,13 @@ module Cocooned
|
|
|
29
29
|
#
|
|
30
30
|
# Any other argument or option supported by `ActionView::Base#content_tag`
|
|
31
31
|
# will be forwarded.
|
|
32
|
-
def cocooned_container(*args, &
|
|
32
|
+
def cocooned_container(*args, &)
|
|
33
33
|
options = args.extract_options!.dup
|
|
34
34
|
name = args.shift || :div
|
|
35
35
|
defaults = cocooned_wrapper_defaults(options, %w[cocooned-container], :'cocooned-container')
|
|
36
36
|
defaults[:data][:cocooned_options] = options.extract!(:limit, :reorderable).to_json
|
|
37
37
|
|
|
38
|
-
content_tag(name, *args, **options.deep_merge(defaults), &
|
|
38
|
+
content_tag(name, *args, **options.deep_merge(defaults), &)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Wrap content with the expected markup for a Cocooned item.
|
|
@@ -53,12 +53,12 @@ module Cocooned
|
|
|
53
53
|
#
|
|
54
54
|
# Any argument or option supported by `ActionView::Base#content_tag` will
|
|
55
55
|
# be forwarded.
|
|
56
|
-
def cocooned_item(*args, &
|
|
56
|
+
def cocooned_item(*args, &)
|
|
57
57
|
options = args.extract_options!.dup
|
|
58
58
|
name = args.shift || :div
|
|
59
59
|
defaults = cocooned_wrapper_defaults(options, %w[cocooned-item nested-fields], :'cocooned-item')
|
|
60
60
|
|
|
61
|
-
content_tag(name, *args, **options.deep_merge(defaults), &
|
|
61
|
+
content_tag(name, *args, **options.deep_merge(defaults), &)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
protected
|
|
@@ -107,8 +107,8 @@ module Cocooned
|
|
|
107
107
|
#
|
|
108
108
|
# See the documentation of +ActionView::Base#link_to+ for additional
|
|
109
109
|
# options.
|
|
110
|
-
def cocooned_add_item_link(
|
|
111
|
-
cocooned_link(Cocooned::Tags::Add,
|
|
110
|
+
def cocooned_add_item_link(...)
|
|
111
|
+
cocooned_link(Cocooned::Tags::Add, ...)
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
# Output a button to add an item in a nested form.
|
|
@@ -127,8 +127,8 @@ module Cocooned
|
|
|
127
127
|
#
|
|
128
128
|
# See Cocooned::Helpers::Tags::Add main documentation for a reference of
|
|
129
129
|
# supported options.
|
|
130
|
-
def cocooned_add_item_button(
|
|
131
|
-
cocooned_button(Cocooned::Tags::Add,
|
|
130
|
+
def cocooned_add_item_button(...)
|
|
131
|
+
cocooned_button(Cocooned::Tags::Add, ...)
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
end
|
|
@@ -44,8 +44,8 @@ module Cocooned
|
|
|
44
44
|
#
|
|
45
45
|
# See the documentation of +ActionView::Base#link_to+ for additional
|
|
46
46
|
# options.
|
|
47
|
-
def cocooned_move_item_down_link(
|
|
48
|
-
cocooned_link(Cocooned::Tags::Down,
|
|
47
|
+
def cocooned_move_item_down_link(...)
|
|
48
|
+
cocooned_link(Cocooned::Tags::Down, ...)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Output a button to move an item down.
|
|
@@ -67,8 +67,8 @@ module Cocooned
|
|
|
67
67
|
#
|
|
68
68
|
# See the documentation of +ActionView::Helpers::FormBuilder#button+ for
|
|
69
69
|
# valid options.
|
|
70
|
-
def cocooned_move_item_down_button(
|
|
71
|
-
cocooned_button(Cocooned::Tags::Down,
|
|
70
|
+
def cocooned_move_item_down_button(...)
|
|
71
|
+
cocooned_button(Cocooned::Tags::Down, ...)
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -45,8 +45,8 @@ module Cocooned
|
|
|
45
45
|
#
|
|
46
46
|
# See the documentation of +ActionView::Base#link_to+ for additional
|
|
47
47
|
# options.
|
|
48
|
-
def cocooned_remove_item_link(
|
|
49
|
-
cocooned_link(Cocooned::Tags::Remove,
|
|
48
|
+
def cocooned_remove_item_link(...)
|
|
49
|
+
cocooned_link(Cocooned::Tags::Remove, ...)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# Output a button to remove an item (and an hidden field to mark
|
|
@@ -69,8 +69,8 @@ module Cocooned
|
|
|
69
69
|
#
|
|
70
70
|
# See the documentation of +ActionView::Base#link_to+ for additional
|
|
71
71
|
# options.
|
|
72
|
-
def cocooned_remove_item_button(
|
|
73
|
-
cocooned_button(Cocooned::Tags::Remove,
|
|
72
|
+
def cocooned_remove_item_button(...)
|
|
73
|
+
cocooned_button(Cocooned::Tags::Remove, ...)
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
end
|
|
@@ -44,8 +44,8 @@ module Cocooned
|
|
|
44
44
|
#
|
|
45
45
|
# See the documentation of +ActionView::Base#link_to+ for additional
|
|
46
46
|
# options.
|
|
47
|
-
def cocooned_move_item_up_link(
|
|
48
|
-
cocooned_link(Cocooned::Tags::Up,
|
|
47
|
+
def cocooned_move_item_up_link(...)
|
|
48
|
+
cocooned_link(Cocooned::Tags::Up, ...)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Output a button to move an item up.
|
|
@@ -67,8 +67,8 @@ module Cocooned
|
|
|
67
67
|
#
|
|
68
68
|
# See the documentation of +ActionView::Helpers::FormBuilder#button+ for
|
|
69
69
|
# valid options.
|
|
70
|
-
def cocooned_move_item_up_button(
|
|
71
|
-
cocooned_button(Cocooned::Tags::Up,
|
|
70
|
+
def cocooned_move_item_up_button(...)
|
|
71
|
+
cocooned_button(Cocooned::Tags::Up, ...)
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -46,14 +46,14 @@ module Cocooned
|
|
|
46
46
|
|
|
47
47
|
protected
|
|
48
48
|
|
|
49
|
-
def cocooned_link(klass, *args, &
|
|
49
|
+
def cocooned_link(klass, *args, &)
|
|
50
50
|
options = args.extract_options!
|
|
51
|
-
klass.create(self, *args, **options, &
|
|
51
|
+
klass.create(self, *args, **options, &).render(as: :link)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
def cocooned_button(klass, *args, &
|
|
54
|
+
def cocooned_button(klass, *args, &)
|
|
55
55
|
options = args.extract_options!
|
|
56
|
-
klass.create(self, *args, **options, &
|
|
56
|
+
klass.create(self, *args, **options, &).render(as: :button)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
data/lib/cocooned/tags/add.rb
CHANGED
|
@@ -25,9 +25,9 @@ module Cocooned
|
|
|
25
25
|
include AssociationOptions
|
|
26
26
|
include Cocooned::Deprecated::TagsHelper::AssociationOptions
|
|
27
27
|
|
|
28
|
-
def initialize(template, form, association,
|
|
28
|
+
def initialize(template, form, association, ...)
|
|
29
29
|
@association = association
|
|
30
|
-
super(template, form,
|
|
30
|
+
super(template, form, ...)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def render(as: :link)
|
data/lib/cocooned/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocooned
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gaël-Ian Havard
|
|
8
8
|
- Nathan Van der Auwera
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rails
|
|
@@ -17,20 +16,20 @@ dependencies:
|
|
|
17
16
|
requirements:
|
|
18
17
|
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '7.
|
|
19
|
+
version: '7.2'
|
|
21
20
|
- - "<"
|
|
22
21
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: '8.
|
|
22
|
+
version: '8.2'
|
|
24
23
|
type: :runtime
|
|
25
24
|
prerelease: false
|
|
26
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
27
26
|
requirements:
|
|
28
27
|
- - ">="
|
|
29
28
|
- !ruby/object:Gem::Version
|
|
30
|
-
version: '7.
|
|
29
|
+
version: '7.2'
|
|
31
30
|
- - "<"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '8.
|
|
32
|
+
version: '8.2'
|
|
34
33
|
- !ruby/object:Gem::Dependency
|
|
35
34
|
name: bundler
|
|
36
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -123,7 +122,6 @@ metadata:
|
|
|
123
122
|
homepage_uri: https://github.com/notus-sh/cocooned
|
|
124
123
|
source_code_uri: https://github.com/notus-sh/cocooned
|
|
125
124
|
funding_uri: https://opencollective.com/notus-sh
|
|
126
|
-
post_install_message:
|
|
127
125
|
rdoc_options: []
|
|
128
126
|
require_paths:
|
|
129
127
|
- lib
|
|
@@ -131,15 +129,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
131
129
|
requirements:
|
|
132
130
|
- - ">="
|
|
133
131
|
- !ruby/object:Gem::Version
|
|
134
|
-
version: '
|
|
132
|
+
version: '3.1'
|
|
135
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
134
|
requirements:
|
|
137
135
|
- - ">="
|
|
138
136
|
- !ruby/object:Gem::Version
|
|
139
137
|
version: '0'
|
|
140
138
|
requirements: []
|
|
141
|
-
rubygems_version: 3.
|
|
142
|
-
signing_key:
|
|
139
|
+
rubygems_version: 3.6.9
|
|
143
140
|
specification_version: 4
|
|
144
141
|
summary: Form builder agnostic handling of Rails nested forms
|
|
145
142
|
test_files: []
|