Sha256: 0b22e103b56609f68ad7f65143e01f9cba251f8ff1f226dd8cfe60491e6b23ec

Contents?: true

Size: 801 Bytes

Versions: 72

Compression:

Stored size: 801 Bytes

Contents

import{Controller as e}from"@hotwired/stimulus";const t=class _RailsNestedForm extends e{add(e){e.preventDefault();const t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,(new Date).getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",t);const r=new CustomEvent("rails-nested-form:add",{bubbles:!0});this.element.dispatchEvent(r)}remove(e){e.preventDefault();const t=e.target.closest(this.wrapperSelectorValue);if(t.dataset.newRecord==="true")t.remove();else{t.style.display="none";const e=t.querySelector("input[name*='_destroy']");e.value="1"}const r=new CustomEvent("rails-nested-form:remove",{bubbles:!0});this.element.dispatchEvent(r)}};t.targets=["target","template"],t.values={wrapperSelector:{type:String,default:".nested-form-wrapper"}};let r=t;export{r as default};

Version data entries

72 entries across 40 versions & 2 rubygems

Version Path
wice_grid-7.1.4 spec/support/test_app/vendor/javascript/@stimulus-components--rails-nested-form.js
wice_grid-7.1.3 spec/support/test_app/vendor/javascript/@stimulus-components--rails-nested-form.js
wice_grid-7.1.2 spec/support/test_app/vendor/javascript/@stimulus-components--rails-nested-form.js
panda_cms-0.5.10 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.10 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.9 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.9 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.8 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.8 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.7 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.7 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.6 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.6 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.5 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.5 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.4 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.4 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.3 app/javascript/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.3 public/panda-cms-assets/javascripts/vendor/stimulus-components-rails-nested-form.js
panda_cms-0.5.2 app/javascript/vendor/stimulus-components-rails-nested-form.js