Skip to content

Instantly share code, notes, and snippets.

@cheesepaulo
Forked from jacksonpires/bootbox-rails.js
Created April 15, 2017 20:50
Show Gist options
  • Save cheesepaulo/edd4ee20424ce93923ab6d84d55bba37 to your computer and use it in GitHub Desktop.
Save cheesepaulo/edd4ee20424ce93923ab6d84d55bba37 to your computer and use it in GitHub Desktop.
Sobrescreve o data-confirm do Rails pelo bootbox.js
$.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