Ask A Question


You’re not receiving notifications from this thread.

SweetAlert integration

Michael Kibet asked in Rails

I was able to intergrate sweetAlert properly(*not using the gem but by including the files manually in vendor *)and overiding the rails defaults as follows in the application.js file=>

$.rails.allowAction = function(link){
  if ("confirm") == undefined){
    return true;
  return false;

//User click confirm button
$.rails.confirmed = function(link){"confirm", null);

//Display the confirmation dialog
$.rails.showConfirmationDialog = function(link){
  var message ="confirm");
    title: message,
    type: 'warning',
    confirmButtonText: 'Sure',
    confirmButtonColor: '#2acbb3',
    showCancelButton: true

But the problem comes when I click on the delete button, the dialog box occurs for a very short and doesn't even allow me to either confirm nor deny.
*So I am asking how am i going to slow the dialog box down or make it persistent until a choice is made *


Hey Michael,

Not quite sure what's going on there, but any reason you're not using the gem? It already hooks into the standard rails data-confirm stuff and makes this seamless and you can customize the colors and buttons like usual.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,168+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.