You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
540 B

import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["dialog"]
confirm(event) {
event.preventDefault()
this.pendingForm = event.target
this.dialogTarget.showModal()
}
ok() {
this.dialogTarget.close()
this.pendingForm?.submit()
}
cancel() {
this.dialogTarget.close()
this.pendingForm = null
}
backdropClick(event) {
console.info(event.target === this.dialogTarget)
if (event.target === this.dialogTarget) this.cancel()
}
}