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.
 
 
 
 
 

23 lines
616 B

import "@hotwired/turbo-rails"
Turbo.config.drive.progressBarDelay = 300
Turbo.config.forms.confirm = (title) => {
const dialog = document.getElementById("main-dialog")
const dialogTitle = dialog.querySelector('[data-modal=title]')
const previousTitleContent = dialogTitle.textContent
dialogTitle.textContent = title
dialog.showModal()
return new Promise((resolve, _) => {
dialog.addEventListener(
"close",
() => {
dialogTitle.textContent = previousTitleContent
resolve(dialog.returnValue == "confirm")
},
{ once: true },
);
});
}
import "controllers"