yii2mod / yii2-sweet-alert

SweetAlert widget for Yii2 framework
MIT License
43 stars 18 forks source link

replace default data-confirm popup #7

Closed cornernote closed 7 years ago

cornernote commented 7 years ago

There is a great answer here that allows a simple replacement of Yii2's default data-confirm popup: http://stackoverflow.com/a/33434184/599477

The basics are to include the asset, then add this JS:

/**
 * Override the default yii confirm dialog. This function is
 * called by yii when a confirmation is requested.
 *
 * @param message the message to display
 * @param okCallback triggered when confirmation is true
 * @param cancelCallback callback triggered when cancelled
 */
yii.confirm = function (message, okCallback, cancelCallback) {
    swal({
        title: message,
        type: 'warning',
        showCancelButton: true,
        closeOnConfirm: true,
        allowOutsideClick: true
    }, okCallback);
};

It would be great if this code was part of this yii2 extension. Even if it was in the documentation it would be great.

ihorchepurnyi commented 7 years ago

Hi, thanks for issue. I think we can add this piece of code to our README

ihorchepurnyi commented 7 years ago

Done, Thanks for your suggestion!

cornernote commented 7 years ago

Talk about express service!