Skip to content

Commit

Permalink
Merge pull request #2 from gap777/allow_custom_show_logic
Browse files Browse the repository at this point in the history
Allow application to specify custom method to show the confirm modal
  • Loading branch information
Jeremy-Walton authored Mar 14, 2023
2 parents d47e75d + e991462 commit bbcbb09
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/ConfirmationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default class ConfirmationController {
acceptSelector: '#confirm-accept',
denySelector: '.confirm-cancel',
animationDuration: 300,
showConfirmCallback: null,
contentSlots: {
title: {
contentAttribute: 'turbo-confirm',
Expand Down Expand Up @@ -64,6 +65,10 @@ export default class ConfirmationController {
#showConfirm(element) {
this.#fillSlots(element)
this.dialogTarget.classList.add(this.#config.activeClass)
if (this.#config.showConfirmCallback) {
this.#config.showConfirmCallback(this.dialogTarget)
}

this.#setupListeners()
}

Expand Down

0 comments on commit bbcbb09

Please sign in to comment.