mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-07-01 23:41:08 -04:00
Initial line item idea
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (typeof Stimulus === "undefined") {
|
||||
console.error("Stimulus is not loaded. Make sure the UMD script is included first.");
|
||||
return;
|
||||
}
|
||||
|
||||
const application = Stimulus.Application.start();
|
||||
application.register("nested-form", window.NestedFormController);
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
(function() {
|
||||
class NestedFormController extends Stimulus.Controller {
|
||||
static targets = ["container", "template"]
|
||||
|
||||
add(event) {
|
||||
event.preventDefault();
|
||||
const content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, new Date().getTime());
|
||||
this.containerTarget.insertAdjacentHTML("beforeend", content);
|
||||
}
|
||||
|
||||
remove(event) {
|
||||
event.preventDefault();
|
||||
event.target.closest(".nested-fields").remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Expose globally so index.js can access it
|
||||
window.NestedFormController = NestedFormController;
|
||||
})();
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user