cocooned 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +178 -0
- data/README.md +244 -172
- data/app/assets/javascripts/cocoon.js +1 -13
- data/app/assets/javascripts/cocooned.js +929 -399
- data/app/assets/stylesheets/cocooned.css +1 -9
- data/cocooned.gemspec +27 -18
- data/lib/cocooned/association/builder.rb +66 -0
- data/lib/cocooned/association/renderer.rb +53 -0
- data/lib/cocooned/association.rb +8 -0
- data/lib/cocooned/deprecation.rb +105 -0
- data/lib/cocooned/helpers/containers.rb +72 -0
- data/lib/cocooned/helpers/tags/add.rb +136 -0
- data/lib/cocooned/helpers/tags/down.rb +76 -0
- data/lib/cocooned/helpers/tags/remove.rb +78 -0
- data/lib/cocooned/helpers/tags/up.rb +76 -0
- data/lib/cocooned/helpers/tags.rb +60 -0
- data/lib/cocooned/helpers.rb +3 -329
- data/lib/cocooned/railtie.rb +7 -2
- data/lib/cocooned/tags/add.rb +61 -0
- data/lib/cocooned/tags/base.rb +61 -0
- data/lib/cocooned/tags/down.rb +19 -0
- data/lib/cocooned/tags/remove.rb +35 -0
- data/lib/cocooned/tags/up.rb +19 -0
- data/lib/cocooned/tags.rb +12 -0
- data/lib/cocooned/tags_helper.rb +83 -0
- data/lib/cocooned/version.rb +1 -1
- data/lib/cocooned.rb +6 -1
- metadata +53 -88
- data/History.md +0 -283
- data/Rakefile +0 -113
- data/lib/cocooned/association_builder.rb +0 -68
- data/lib/cocooned/helpers/cocoon_compatibility.rb +0 -27
- data/lib/cocooned/helpers/deprecate.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cebb79afb609396e42235e4fcdb5fb60760174cf3b5c5f79b67435fe3c493a07
|
4
|
+
data.tar.gz: 014ee4eb62394380a95feb3a105d7260d2d1ac6e32bf7488c746713dd1b0030b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 619a1aed3532db02f44338ec2d6199d92a316562574091fdfd853679bbaafb767a8b3599b6f0245a056098a929d146b83b8439e47dd612a41ffc84578f3e5504
|
7
|
+
data.tar.gz: d6645b868d1a4f18e31ce217bf5f1407b24cf1d93b8541fbf920e6a76ea71ecb19ccca78726cf54d984c7b3455a08dc7cc764922f6f767c893e8bf0816e2f595
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## Version 2.0.0 (2023-03-07)
|
10
|
+
|
11
|
+
* Drop support for Rails < 6.0
|
12
|
+
|
13
|
+
### Breaking changes
|
14
|
+
|
15
|
+
#### Features dropped without any replacements
|
16
|
+
|
17
|
+
* Use of a function as `data-association-insertion-node` on add triggers support have been dropped (#18)
|
18
|
+
As HTML dataset are `DOMStringMap`, they only support strings as values. The only way to use a function to loop up for insertion node on an add trigger was to use jQuery (ex: `$(addTrigger).data('association-insertion-node', (add) => {})`).
|
19
|
+
* `data-remove-timeout` on remove triggers (#18)
|
20
|
+
Items are now removed at the end of their hiding animation.
|
21
|
+
|
22
|
+
#### Events listener now use `CustomEvent`s (#17)
|
23
|
+
|
24
|
+
Cocooned events have been rewritten around `CustomEvent`s and standard `addEventListener` / `dispatchEvent`.
|
25
|
+
You should either rewrite your event binding with `addEventListener` or change your jQuery ones as follow:
|
26
|
+
|
27
|
+
```diff
|
28
|
+
- $(element).on('cocooned:event', (e, node, cocooned) => {
|
29
|
+
+ $(element).on('cocooned:event', e => {
|
30
|
+
+ { node, cocooned } = e.detail // Use nodes in 'cocooned:before-reindex' / 'cocooned:after-reindex' events
|
31
|
+
})
|
32
|
+
```
|
33
|
+
|
34
|
+
### Deprecations
|
35
|
+
|
36
|
+
These features are now deprecated and emit a warning message:
|
37
|
+
|
38
|
+
* `:insertion_traversal` option on `cocooned_add_item_link` (#18)
|
39
|
+
Use a more specific selector as `data-association-insertion-node` (set through `:insertion_node`) instead.
|
40
|
+
* Importing `@notus.sh/cocooned/cocooned` in your JavaScript files (#22)
|
41
|
+
Import Cocooned from either `@notus.sh/cocooned`, `@notus.sh/cocooned/jquery` or `@notus.sh/cocooned/src/cocooned/cocooned` instead.
|
42
|
+
|
43
|
+
These features are now deprecated but don't emit any warning message (sorry):
|
44
|
+
|
45
|
+
* Containers identified only by the `data-cocooned-options` attribute (#26)
|
46
|
+
Use the `cocooned_container` helper in your forms.
|
47
|
+
* Containers identified only by the `.cocooned-item` class (#26)
|
48
|
+
Use the `cocooned_item` helper in your forms.
|
49
|
+
|
50
|
+
These features were already deprecated but now emit a warning message:
|
51
|
+
|
52
|
+
* `link_to_add_association` (replaced by `cocooned_add_item_link`)
|
53
|
+
* `link_to_remove_association` (replaced by `cocooned_remove_item_link`)
|
54
|
+
* The `cocoon` I18n namespace (replaced by `cocooned`)
|
55
|
+
* `:render_option` option on `cocooned_add_item_link` / `link_to_add_association`
|
56
|
+
Use `:form_options` and/or `:locals` instead.
|
57
|
+
|
58
|
+
These features were already deprecated but (still) don't emit any warning message (sorry):
|
59
|
+
|
60
|
+
* Events in `cocoon` namespace (replaced by `cocooned`)
|
61
|
+
* Triggers only identified by Cocoon classes (`.add_fields`, `.remove_fields`)
|
62
|
+
* Cocoon auto-start logic (non-identified containers)
|
63
|
+
|
64
|
+
All deprecated features will be removed in the next major release.
|
65
|
+
|
66
|
+
### Added
|
67
|
+
|
68
|
+
* Add support for association scoped label to `cocooned_move_item_up_link` and `cocooned_move_item_down_link` (#11)
|
69
|
+
* Replace dependency to jQuery by an optional jQuery integration (#22)
|
70
|
+
* Introduce `cocooned_container` and `cocooned_item` helpers to ease forms markup construction (#26)
|
71
|
+
* Allow to choose between links or buttons for triggers (#27)
|
72
|
+
* Use Web Animation API for animations instead of CSS / jQuery (#29)
|
73
|
+
|
74
|
+
### Fixed
|
75
|
+
|
76
|
+
* Compatibility with Rails >= 7.0
|
77
|
+
* Compatibility with Ruby >= 3.1
|
78
|
+
|
79
|
+
### Changed
|
80
|
+
|
81
|
+
* Rewrite JavaScript tests suite with [Jest](https://jestjs.io/) (#2) (replace Jasmine, now deprecated)
|
82
|
+
* Reorganize JavaScript code and tests into the `npm` folder (#5)
|
83
|
+
* Rewrite JavaScript code to use ESM modules (#6) and modern ECMAScript idioms (#7, #14)
|
84
|
+
* Integrate deprecation messages with ActiveSupport::Deprecation (#9)
|
85
|
+
* Refactor helpers as tag classes (#10)
|
86
|
+
* Use HTML `<template>` instead of a data-attribute to pass subform template to JavaScript (#12)
|
87
|
+
* Split JavaScript monolith into smaller classes with minimal public API (#8, #18, #21)
|
88
|
+
* Isolate and unit test Cocoon compatibility code (#23)
|
89
|
+
* Use data-attributes instead of classes to hook JavaScript on (#26)
|
90
|
+
* Switch from Travis CI to Github actions (#30)
|
91
|
+
* Add Ruby 3.2 to CI (#32)
|
92
|
+
* Adapt NPM packaging scripts (#35)
|
93
|
+
|
94
|
+
## Version 1.4.1 (2022-08-08)
|
95
|
+
|
96
|
+
* Compatibility with Rails 7.0
|
97
|
+
|
98
|
+
## Version 1.4.0 (2021-08-15)
|
99
|
+
|
100
|
+
### Breaking changes
|
101
|
+
|
102
|
+
* Drop support for Rails < 5.0 and Ruby < 2.5
|
103
|
+
* Pass the original browser event to all event handlers _via_ e.originalEvent. (See [jQuery Event object](https://api.jquery.com/category/events/event-object/)).
|
104
|
+
|
105
|
+
### Backported (from cocoon 1.2.15)
|
106
|
+
|
107
|
+
* Add support for @hotwired/turbo (thanks @entretechno-jeremiah in [nathanvda/cocoon#600](https://github.com/nathanvda/cocoon/pull/600))
|
108
|
+
|
109
|
+
### Fixed
|
110
|
+
|
111
|
+
* Prevent side effects on options passed to view helpers.
|
112
|
+
* Prevent event propagation to parent elements (thanks @ashmill23 in [nathanvda/cocoon#560](https://github.com/nathanvda/cocoon/pull/560) and @zmagod in [nathanvda/cocoon#536](https://github.com/nathanvda/cocoon/pull/536))
|
113
|
+
|
114
|
+
### Changed
|
115
|
+
|
116
|
+
* Use form builder to add the hidden `_destroy` field instead of `hidden_field` (thanks @rradonic in [nathanvda/cocoon#559](https://github.com/nathanvda/cocoon/pull/559))
|
117
|
+
* Update deprecation warnings to postpone compatibility drop with the original `cocoon` to 3.0 (instead of 2.0)
|
118
|
+
|
119
|
+
## Version 1.3.2 (2019-04-05)
|
120
|
+
|
121
|
+
### Backported (from cocoon 1.2.13)
|
122
|
+
|
123
|
+
* Compatibility with Mongoid 7+ (thanks @startouf in [nathanvda/cocoon#527](https://github.com/nathanvda/cocoon/pull/527))
|
124
|
+
|
125
|
+
## Version 1.3.1 (2018-08-24)
|
126
|
+
|
127
|
+
### Changed
|
128
|
+
|
129
|
+
* Use UMD pattern to load the Cocooned module
|
130
|
+
* Now publish packages on both rubygems.org and npmjs.com (fixes [nathanvda/cocoon#452](https://github.com/nathanvda/cocoon/issue/452), [nathanvda/cocoon#555](https://github.com/nathanvda/cocoon/issue/555))
|
131
|
+
|
132
|
+
## Version 1.3.0 (2018-08-17)
|
133
|
+
|
134
|
+
### Breaking changes
|
135
|
+
|
136
|
+
* Drop support for Ruby 1.9 (thanks @simi)
|
137
|
+
* Drop support for Rubinius, Ruby < 2.2 and Rails < 4.0
|
138
|
+
* Drop support for custom wrapper class on item containers
|
139
|
+
Originaly supported _via_ an option on `link_to_remove_association`.
|
140
|
+
|
141
|
+
### Deprecated
|
142
|
+
|
143
|
+
The gem has been renamed to `cocooned`:
|
144
|
+
|
145
|
+
* `link_to_add_association` has been renamed `cocooned_add_item_link`
|
146
|
+
* Generated add links class `add_fields` has been renamed `cocooned-add`
|
147
|
+
* `link_to_remove_association` has been renamed `cocooned_remove_item_link`
|
148
|
+
* Generated remove links class `remove_fields` has been renamed `cocooned-remove`
|
149
|
+
* `cocoon:*` and `*.cocoon` Javascript events have been renamed to `cocooned:*` and `*.cocooned`
|
150
|
+
(ex: `cocooned:before-insert`, `click.cocooned`)
|
151
|
+
* The `cocoon` i18n scope have been renamed to `cocooned`
|
152
|
+
* The `.nested-fields` default item wrapper class have been renamed to `cocooned-item`
|
153
|
+
|
154
|
+
Other deprecations:
|
155
|
+
|
156
|
+
* `link_to_add_association`/`cocooned_add_item_link` no longer require a `:render_options` hash to pass locals to the nested partial
|
157
|
+
|
158
|
+
### Added
|
159
|
+
|
160
|
+
* Automatically remove `required` attributes on destroyed elements (thanks @markkhair in [nathanvda/cocoon#496](https://github.com/nathanvda/cocoon/pull/496), fixes [nathanvda/cocoon#386](https://github.com/nathanvda/cocoon/issue/386))
|
161
|
+
* Add extra properties on events (thanks @ayaman)
|
162
|
+
* Add a basic package.json to be used with Webpack (thanks @dmfrancisco in [nathanvda/cocoon#454](https://github.com/nathanvda/cocoon/pull/454))
|
163
|
+
* Namespace click handlers (thanks @chrise86 in [nathanvda/cocoon#310](https://github.com/nathanvda/cocoon/pull/310))
|
164
|
+
|
165
|
+
### Fixed
|
166
|
+
|
167
|
+
* Compatibility with jQuery 3 (thanks @mstmfm in [nathanvda/cocoon#379](https://github.com/nathanvda/cocoon/pull/379))
|
168
|
+
|
169
|
+
### Changed
|
170
|
+
|
171
|
+
* Refactor cocoon javascript as a self-contained object with same functionalities
|
172
|
+
* Remove Jeweller (thanks @brixen, @tlynam)
|
173
|
+
|
174
|
+
---
|
175
|
+
|
176
|
+
For changes prior to 1.3.0 (from 1.0.0 to 1.2.11), please refer to the [cocoon changelog](https://github.com/nathanvda/cocoon/blob/master/History.md).
|
177
|
+
|
178
|
+
Many thanks to [all contributors to the original gem](https://github.com/nathanvda/cocoon/graphs/contributors).
|