diff options
author | Mathieu <mathieu.mahe@gmail.com> | 2018-04-01 19:15:36 +0700 |
---|---|---|
committer | Mathieu <mathieu.mahe@gmail.com> | 2018-04-01 19:15:36 +0700 |
commit | e9aa7ecdee0aa7bb4dcfa5046881bde2f1fe21cc (patch) | |
tree | 149976d8e878915890388c9884c06671dd477bb1 /actionview/app/assets | |
parent | 8d93107ba2554a9206a651ff2b96f2a87b061d14 (diff) | |
download | rails-e9aa7ecdee0aa7bb4dcfa5046881bde2f1fe21cc.tar.gz rails-e9aa7ecdee0aa7bb4dcfa5046881bde2f1fe21cc.tar.bz2 rails-e9aa7ecdee0aa7bb4dcfa5046881bde2f1fe21cc.zip |
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 |