rondo_form 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -8
- data/lib/generators/rondo_form/templates/nested_rondo_controller.js +2 -3
- data/lib/rondo_form/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad2d01fb9c206a3f7942241492eee9ba969f10483a9a3a2f30d53d8fad04186c
|
4
|
+
data.tar.gz: 81567ac3ffe29883945dcf5b34855796570d16be438cf21a39893a2882c4af55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45b7754068730e619cba9d2d4433e3ab876e2c468d8176c324ad744ef1148efb76a723719819660cd0eebe8f03f9db575aa80785dd539805d8e94b590bab6f32
|
7
|
+
data.tar.gz: c2cbb54fa7d4a4d33ab66b78096df1e8b72dc10bea32374471b49abc71adf15b00720d5f04b8500558f5cbc6b49939f161b75e4c7962c1b5abe29af1ad777d50
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RondoForm
|
2
2
|
|
3
|
-
Handle nested forms, same as Cocoon, but using StimulusJS
|
3
|
+
Handle dynamic nested forms, same as Cocoon, but using StimulusJS
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,7 +10,7 @@ Install the gem and add to the application's Gemfile by executing:
|
|
10
10
|
|
11
11
|
Or inside the Gemfile add the following
|
12
12
|
|
13
|
-
$ gem 'rondo_form', '~> 0.2.
|
13
|
+
$ gem 'rondo_form', '~> 0.2.2'
|
14
14
|
|
15
15
|
Run the installation task:
|
16
16
|
|
@@ -35,10 +35,12 @@ In your `projects/_form` partial:
|
|
35
35
|
</div>
|
36
36
|
|
37
37
|
<h3 class="text-xl mt-4">Tasks</h3>
|
38
|
-
<div class="my-2" data-controller="
|
39
|
-
|
40
|
-
<%=
|
41
|
-
|
38
|
+
<div class="my-2" data-controller="nested-rondo">
|
39
|
+
<div data-nested-rondo-target="fieldContain">
|
40
|
+
<%= f.simple_fields_for :tasks do |task| %>
|
41
|
+
<%= render "task_fields", f: task %>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
42
44
|
<div class="links">
|
43
45
|
<%= link_to_add_association "Add Task", f, :tasks %>
|
44
46
|
</div>
|
@@ -61,8 +63,9 @@ In your `_task_fields` partial:
|
|
61
63
|
|
62
64
|
```
|
63
65
|
|
64
|
-
_Note_:
|
65
|
-
|
66
|
+
_Note_:
|
67
|
+
- Stimulus controller is `nested-rondo`, so you need to declare the element with `data-controller="nested-rondo"`.
|
68
|
+
- You must add `data-nested-rondo-target="fieldContain"` to an element, that wraps all nested fields, the new field will be prepended to this element.
|
66
69
|
|
67
70
|
## Contributing
|
68
71
|
|
@@ -1,15 +1,14 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
static targets = ["template"]
|
4
|
+
static targets = ["template", "fieldContain"]
|
5
5
|
|
6
6
|
addField(e) {
|
7
7
|
e.preventDefault();
|
8
8
|
|
9
9
|
let assoc = e.target.dataset.association;
|
10
10
|
let newField = this.buildNewAssociation(assoc);
|
11
|
-
|
12
|
-
insertionNode.insertAdjacentHTML("beforebegin", newField);
|
11
|
+
this.fieldContainTarget.insertAdjacentHTML("beforeend", newField);
|
13
12
|
}
|
14
13
|
|
15
14
|
removeField(e) {
|
data/lib/rondo_form/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rondo_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hungle00
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|