diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2018-04-02 10:50:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 10:50:10 -0500 |
commit | 91f4e335b59a794e1f1d5c2a13b286c38aec9f85 (patch) | |
tree | 054f300fd414bcbf70aca4b21db20230f6977aa4 /actionview/app/assets | |
parent | abb810b90bf25c3316e735d3778275ba5b817dfb (diff) | |
parent | e9aa7ecdee0aa7bb4dcfa5046881bde2f1fe21cc (diff) | |
download | rails-91f4e335b59a794e1f1d5c2a13b286c38aec9f85.tar.gz rails-91f4e335b59a794e1f1d5c2a13b286c38aec9f85.tar.bz2 rails-91f4e335b59a794e1f1d5c2a13b286c38aec9f85.zip |
Merge pull request #32404 from mathieumahe/master
Extract the confirm call in its own, overridable method in rails_ujs
Diffstat (limited to 'actionview/app/assets')
-rw-r--r-- | actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee b/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee index 72b5aaa218..0738ffcdc9 100644 --- a/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee +++ b/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee @@ -5,6 +5,10 @@ Rails.handleConfirm = (e) -> stopEverything(e) unless allowAction(this) +# Default confirm dialog, may be overridden with custom confirm dialog in Rails.confirm +Rails.confirm = (message, element) -> + confirm(message) + # For 'data-confirm' attribute: # - Fires `confirm` event # - Shows the confirmation dialog @@ -20,7 +24,7 @@ allowAction = (element) -> answer = false if fire(element, 'confirm') - try answer = confirm(message) + try answer = Rails.confirm(message, element) callback = fire(element, 'confirm:complete', [answer]) answer and callback |