20 lines
511 B
JavaScript
20 lines
511 B
JavaScript
|
|
import { Controller } from "@hotwired/stimulus"
|
||
|
|
|
||
|
|
export default class extends Controller {
|
||
|
|
static targets = ["template", "container"]
|
||
|
|
|
||
|
|
connect() {
|
||
|
|
console.log("connect")
|
||
|
|
}
|
||
|
|
|
||
|
|
add(event) {
|
||
|
|
console.log("start")
|
||
|
|
event.preventDefault()
|
||
|
|
event.stopPropagation()
|
||
|
|
|
||
|
|
const content = this.templateTarget.innerHTML.replace(/NEW_EXC_RECORD/g, new Date().getTime())
|
||
|
|
|
||
|
|
this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||
|
|
console.log("end")
|
||
|
|
}
|
||
|
|
}
|