Michael Kibet


100 Experience
0 Lessons Completed
0 Questions Solved


Posted in SweetAlert integration

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 (link.data("confirm") == undefined){
    return true;
  return false;

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

//Display the confirmation dialog
$.rails.showConfirmationDialog = function(link){
  var message = link.data("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 *

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.