mois3x / sweet-alert-rails-confirm

A Rails confirm replacement with SweetAlert
MIT License
73 stars 50 forks source link

showConfirmButton: false doesn't work #28

Closed moeabdol closed 9 years ago

moeabdol commented 9 years ago

In my Rails 4 application I'm using sweet alert to show notice and alert flash messages. I have the following in my application.js

$(document).ready(function(){
  "use strict";

  // show flash messages if any
  if($(".flash-message").length){
    var key = $(".flash-message").attr("key");
    var value = $(".flash-message").attr("value");
    showNotificationMessage(key, value);
  }
});

function showNotificationMessage(key, value){
  if(key === "success" || key === "notice"){
    swal({
      title: value,
      type: "success",
      timer: 3000,
      showConfirmButton: false,
    });
  }
  else{
    swal({
      title: value,
      type: "error",
      timer: 3000,
      showConfirmButton: false,
    });
  }
}

However, sweetalert still shows an ok button. Is this a current issue? or is there a way around it?

moeabdol commented 9 years ago

I got to hide the confirm button once I added sweetalert-rails gem in my Gemfile.

gem "sweet-alert"
gem "sweetalert-rails"
gem "sweet-alert-confirm"