Save 36% for Black Friday! Learn more

Michael Kibet

Joined

100 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in SEEKING WORK

Nairobi, Seeking work (mostly remote). Mid-level developer with 2 years in Ruby/Rails, specialist in APIs and microservices. Use React for front-end development. Rapidly improving at cryptocurrencies and blockchain.
email: [email protected]

cheers,
Michael

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;
  }
  $.rails.showConfirmationDialog(link);
  return false;
}

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

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

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.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.