sciactive / pnotify

Beautiful JavaScript notifications with Web Notifications support.
https://sciactive.com/pnotify/
Apache License 2.0
3.65k stars 513 forks source link

Confirm doesn't work right without History module #225

Closed NightOwl888 closed 8 years ago

NightOwl888 commented 8 years ago

The confirm "module" seems to have a dependency on the history module in order to function correctly. It is difficult to tell whether this was intended or not in the design, but if it is intended it seems that the confirm module should always be packaged together with the history module rather than making them separate.

Here is a demo of the issue.

<html>
<head>

    <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/pnotify/3.0.0/pnotify.min.css" />

    <script src="//cdn.jsdelivr.net/jquery/1.10.2/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/pnotify/3.0.0/pnotify.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/pnotify/3.0.0/pnotify.confirm.min.js"></script>
    <!-- With this commented, the overlay doesn't go away when a button is clicked. -->
    <!--<script src="//cdnjs.cloudflare.com/ajax/libs/pnotify/3.0.0/pnotify.history.min.js"></script>-->

</head>
<body>

<button class="btn btn-default source" onclick="(new PNotify({
                    title: 'Confirmation Needed',
                    text: 'Are you sure?',
                    icon: 'glyphicon glyphicon-question-sign',
                    styling: 'bootstrap3',
                    width: '330',
                    hide: false,
                    confirm: {
                        confirm: true
                    },
                    buttons: {
                        closer: false,
                        sticker: false
                    },
                    history: {
                        history: false
                    },
                    addclass: 'stack-modal',
                    stack: {'dir1': 'down', 'dir2': 'right', 'modal': true}
                })).get().on('pnotify.confirm', function(){
                    alert('Ok, cool.');
                }).on('pnotify.cancel', function(){
                    alert('Oh ok. Chicken, I see.');
                });">Modal Confirm Dialog</button>

</body>
</html>
NightOwl888 commented 8 years ago

Closing because it is an exact duplicate of #214.