How to use logout alert popup from Smart admin for other requests too?

Rohan picture Rohan · May 5, 2015 · Viewed 7.3k times · Source

I am working with the Smart Admin Theme, particularly the Ajax version. When I press the logout button on the top right hand side, it brings out a nice alert confirmation message.

I am trying to look about how to use this in other requests as well? For example if someone is going to delete an important resource, I would like them to see it. But I am not sure if the theme makers have given a way to trigger this.

I know that there are data-attributes associated with it like:

data-logout-msg="You can improve your security further after logging out by closing this opened browser"

But I am not sure how to use this on another link in my application. Any idea anyone? Is there an API method somewhere I can call?

Answer

MyOrange picture MyOrange · May 26, 2015

$("#smart-mod-eg1").click(function(e) {
            $.SmartMessageBox({
                title : "Smart Alert!",
                content : "This is a confirmation box. Can be programmed for button callback",
                buttons : '[No][Yes]'
            }, function(ButtonPressed) {
                if (ButtonPressed === "Yes") {

                    $.smallBox({
                        title : "Callback function",
                        content : " You pressed Yes...",
                        color : "#659265",
                        iconSmall : "fa fa-check fa-2x fadeInRight animated",
                        timeout : 4000
                    });
                }
                if (ButtonPressed === "No") {
                    $.smallBox({
                        title : "Callback function",
                        content : " You pressed No...",
                        color : "#C46A69",
                        iconSmall : "fa fa-times fa-2x fadeInRight animated",
                        timeout : 4000
                    });
                }

            });
            e.preventDefault();
        })