Skip to content

Commit f41b570

Browse files
committed
Use vanilla-nested node module
1 parent 35b5dab commit f41b570

File tree

7 files changed

+10
-124
lines changed

7 files changed

+10
-124
lines changed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ GEM
179179
turbolinks-source (5.2.0)
180180
tzinfo (1.2.5)
181181
thread_safe (~> 0.1)
182-
vanilla_nested (1.2.0)
182+
vanilla_nested (1.2.2)
183183
web-console (4.0.1)
184184
actionview (>= 6.0.0)
185185
activemodel (>= 6.0.0)

app/javascript/packs/application.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require("@rails/ujs").start()
77
require("turbolinks").start()
88
require("@rails/activestorage").start()
99
require("channels")
10-
require("../vanilla_nested")
10+
require("vanilla-nested")
1111

1212
document.addEventListener('vanilla-nested:fields-limit-reached', function(e) {
1313
alert('Limit reached: ' + e.detail.triggeredBy.dataset.limit);

app/javascript/vanilla_nested.js

-119
This file was deleted.

app/models/user.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class User < ApplicationRecord
77
accepts_nested_attributes_for :address, update_only: true
88

99
has_many :pets
10-
accepts_nested_attributes_for :pets, allow_destroy: true, reject_if: :all_blank, limit: 2
10+
accepts_nested_attributes_for :pets, allow_destroy: true, reject_if: :all_blank, limit: 10
1111

1212
validates :name, :lastname, :email, presence: true
1313

app/views/users/_form_fields_with_variable_pets.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class='bg-success'>
2-
Add '?dymanic_form=1' to the url to test dynamic nested form fields
2+
Add '?dynamic_form=1' to the url to test dynamic nested form fields
33
</div>
44

55
<%= render partial: 'form_fields', locals: { f: f } %>

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"@rails/ujs": "^6.0.0",
88
"@rails/webpacker": "^4.2.0",
99
"spectre.css": "^0.5.8",
10-
"turbolinks": "^5.2.0"
10+
"turbolinks": "^5.2.0",
11+
"vanilla-nested": "arielj/vanilla-nested"
1112
},
1213
"version": "0.1.0",
1314
"devDependencies": {

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -7162,6 +7162,10 @@ validate-npm-package-license@^3.0.1:
71627162
spdx-correct "^3.0.0"
71637163
spdx-expression-parse "^3.0.0"
71647164

7165+
vanilla-nested@arielj/vanilla-nested:
7166+
version "1.0.0"
7167+
resolved "https://codeload.github.com/arielj/vanilla-nested/tar.gz/29a197e0902c154737952ffba55c3ae3bd2abe83"
7168+
71657169
vary@~1.1.2:
71667170
version "1.1.2"
71677171
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"

0 commit comments

Comments
 (0)