sbilly / joli-admin

Joli is a free admin template/Dashboard/Web App based on Angular JS.
153 stars 120 forks source link

message boxes not working #18

Open robertnicjoo opened 5 years ago

robertnicjoo commented 5 years ago

hi, I'm using this template in dynamic application and message boxes wont open when i have errors, as the sample page works with id and buttons to open message boxes should i edit some file or codes in order to let them open without any click function? just like bootstrap alerts??

<div class="message-box message-box-danger animated fadeIn" id="message-box-danger">
            <div class="mb-container">
                <div class="mb-middle">
                    <div class="mb-title"><span class="fa fa-times"></span> Danger</div>
                    <div class="mb-content">
                        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec at tellus sed mauris mollis pellentesque nec a ligula. Quisque ultricies eleifend lacinia. Nunc luctus quam pretium massa semper tincidunt. Praesent vel mollis eros. Fusce erat arcu, feugiat ac dignissim ac, aliquam sed urna. Maecenas scelerisque molestie justo, ut tempor nunc.</p>
                    </div>
                    <div class="mb-footer">
                        <button class="btn btn-default btn-lg pull-right mb-control-close">Close</button>
                    </div>
                </div>
            </div>
        </div>

thanks.

angelhosuarezrucoba commented 5 years ago

there is a method like this in /js/actions.js

/ MESSAGE BOX / $(".mb-control").on("click", function () {
var box = $($(this).data("box")); if (box.length > 0) {

        box.toggleClass("open");

        var sound = box.data("sound");

        if (sound === 'alert')
            playAudio('alert');

        if (sound === 'fail')
            playAudio('fail');

    } 
    return false;
});

that method just works on ready , you could paste the function inside and call it where do you want. thats all then it will work. you have to put data-box="#message-box-danger" as an attribute to some label or item that you want and this class mb-control .