Created
April 21, 2017 15:03
-
-
Save arferreira/de4bdd79fd4e9e7de97d26af215d8aca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.rails.allowAction = function(element) { | |
var message = element.attr('data-confirm'); | |
if (!message) { return true; } | |
var opts = { | |
title: "Confirmação", | |
message: message, | |
buttons: { | |
confirm: { | |
label: 'Sim', | |
className: 'btn-success' | |
}, | |
cancel: { | |
label: 'Não', | |
className: 'btn-danger' | |
} | |
}, | |
callback: function(result) { | |
if (result) { | |
element.removeAttr('data-confirm'); | |
element.trigger('click.rails') | |
} | |
} | |
}; | |
bootbox.confirm(opts); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment