diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2025-10-30 10:36:52 -0400 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-10-30 10:37:21 -0400 |
| commit | 94a44a40aacacabb4737d3dfab129845b0777ba0 (patch) | |
| tree | 36f14b5711122db1e311d27c5f04f26509eacf69 /app/javascript/controllers/nested_fields_controller.js | |
| parent | b88ba1060f02396716ed5a136431957b15277643 (diff) | |
clients: allow creation of household members too
Diffstat (limited to 'app/javascript/controllers/nested_fields_controller.js')
| -rw-r--r-- | app/javascript/controllers/nested_fields_controller.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/javascript/controllers/nested_fields_controller.js b/app/javascript/controllers/nested_fields_controller.js new file mode 100644 index 0000000..56f86f5 --- /dev/null +++ b/app/javascript/controllers/nested_fields_controller.js @@ -0,0 +1,14 @@ +import { Controller } from "@hotwired/stimulus" + +// Connects to data-controller="nested-fields" +export default class extends Controller { + static targets = ["fields", "template"]; + + append() { + this.fieldsTarget.insertAdjacentHTML("beforeend", this.#templateContent); + } + + get #templateContent() { + return this.templateTarget.innerHTML.replace(/__INDEX__/g, Date.now()); + } +} |
