diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js index 2d5a73e..e5fa674 100644 --- a/app/javascript/controllers/application.js +++ b/app/javascript/controllers/application.js @@ -3,7 +3,7 @@ import { Application } from "@hotwired/stimulus" const application = Application.start() // Configure Stimulus development experience -application.debug = true +application.debug = false window.Stimulus = application export { application } diff --git a/app/javascript/initializers/forms.js b/app/javascript/initializers/forms.js index e1c1f54..ef0b4bc 100644 --- a/app/javascript/initializers/forms.js +++ b/app/javascript/initializers/forms.js @@ -1,14 +1,22 @@ -Turbo.config.forms.confirm = (title) => { - console.log('confirm called') - const dialog = document.getElementById("front-dialog") + +// the confirm action opens front-dialog +Turbo.config.forms.confirm = (content) => { + const dialog = document.getElementById('front-dialog') + const dialogContent = dialog.querySelector('[data-dialog-content]') + dialogContent.innerHTML = content dialog.showModal() return new Promise((resolve) => { - dialog.addEventListener("close", () => { resolve(dialog.returnValue == "confirm") }, { once: true }) + dialog.addEventListener( + 'close', + () => { resolve(dialog.returnValue == 'confirm') }, + { once: true }) }) } Turbo.config.forms.showModal = (dialogId) => { - console.log('showModal called', dialogId) + const dialog = document.getElementById(dialogId) + if (dialog) dialog.showModal() + else console.warn(`dialog id=<${dialogId}> not found!`) } document.addEventListener('turbo:submit-start', (e) => { const dialogId = e.explicitOriginalTarget.dataset.turboShowModal diff --git a/app/views/edge/index.html.erb b/app/views/edge/index.html.erb index ae6556b..3a1b8af 100644 --- a/app/views/edge/index.html.erb +++ b/app/views/edge/index.html.erb @@ -2,25 +2,17 @@ diff --git a/app/views/layouts/components/_footer.html.erb b/app/views/layouts/components/_footer.html.erb index a96fbbd..66a7f22 100644 --- a/app/views/layouts/components/_footer.html.erb +++ b/app/views/layouts/components/_footer.html.erb @@ -1,17 +1,17 @@ diff --git a/app/views/layouts/components/_main_dialog.html.erb b/app/views/layouts/components/_main_dialog.html.erb index d29602d..8ac19ba 100644 --- a/app/views/layouts/components/_main_dialog.html.erb +++ b/app/views/layouts/components/_main_dialog.html.erb @@ -1,17 +1,11 @@ diff --git a/app/views/layouts/components/_navbar.html.erb b/app/views/layouts/components/_navbar.html.erb index bb1ea64..adff25a 100644 --- a/app/views/layouts/components/_navbar.html.erb +++ b/app/views/layouts/components/_navbar.html.erb @@ -25,15 +25,15 @@ w-52 p-2 shadow " > -
  • Homepage
  • -
  • Portfolio
  • -
  • About
  • +
  • Homepage
  • +
  • Portfolio
  • +
  • About