How to use bootbox - 10 common examples

To help you get started, we’ve selected a few bootbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qmk / qmk_flasher / src / MainWindow / app.js View on Github external
/* Use a native dialog on macOS
     */
    dialog.showMessageBox(win, {
      buttons: [confirmButtonText, "Cancel"],
      defaultId: 0,
      message: messageText
      //TODO: Set an appropriate icon
    }, function (response) {
      if (response == 0) {
        handleFlashButton();
      }
    })
  } else {
    /* Use Bootbox on all other platforms.
     */
    const hexChangedModal = bootbox.confirm({
      message: messageText,
      buttons: {
        confirm: {
          label: confirmButtonText,
          className: 'btn-success'
        },
        cancel: {
          label: 'Cancel'
        }
      },
      callback: function (result) {
        if (result) {
          handleFlashButton();
        }
      }
    });
github laravelista / kyle / resources / assets / js / app.js View on Github external
$('.confirm').on("submit", function(e) {
    var currentForm = this;
    e.preventDefault();
    bootbox.confirm('Are you sure?', function(result) {
        if(result === true) {
            currentForm.submit();
        }
    })
});
github nsqio / nsq / nsqadmin / static / js / views / channel.js View on Github external
channelAction: function(e) {
        e.preventDefault();
        e.stopPropagation();
        var action = $(e.currentTarget).data('action');
        var txt = 'Are you sure you want to <strong>' +
            action + '</strong> <em>' + this.model.get('topic') +
            '/' + this.model.get('name') + '</em>?';
        bootbox.confirm(txt, function(result) {
            if (result !== true) {
                return;
            }
            if (action === 'delete') {
                var topic = this.model.get('topic');
                $.ajax(this.model.url(), {'method': 'DELETE'})
                    .done(function() {
                        window.location = AppState.basePath('/topics/' +
                            encodeURIComponent(topic));
                    })
                    .fail(this.handleAJAXError.bind(this));
            } else {
                $.post(this.model.url(), JSON.stringify({'action': action}))
                    .done(function() { window.location.reload(true); })
                    .fail(this.handleAJAXError.bind(this));
            }
github nsqio / nsq / nsqadmin / static / js / views / topic.js View on Github external
topicAction: function(e) {
        e.preventDefault();
        e.stopPropagation();
        var action = $(e.currentTarget).data('action');
        var txt = 'Are you sure you want to <strong>' +
            action + '</strong> <em>' + this.model.get('name') + '</em>?';
        bootbox.confirm(txt, function(result) {
            if (result !== true) {
                return;
            }
            if (action === 'delete') {
                $.ajax(this.model.url(), {'method': 'DELETE'})
                    .done(function() { window.location = AppState.basePath('/'); });
            } else {
                $.post(this.model.url(), JSON.stringify({'action': action}))
                    .done(function() { window.location.reload(true); })
                    .fail(this.handleAJAXError.bind(this));
            }
        }.bind(this));
    }
});
github nsqio / nsq / nsqadmin / static / js / views / app.js View on Github external
onTombstoneClick: function(e) {
        e.preventDefault();
        e.stopPropagation();
        var nodeName = $(e.target).data('node');
        var topicName = $(e.target).data('topic');
        var txt = 'Are you sure you want to <strong>tombstone</strong> <em>' + nodeName + '</em>?';
        bootbox.confirm(txt, function(result) {
            if (result !== true) {
                return;
            }
            var node = new Node({
                'name': nodeName
            });
            node.tombstoneTopic(topicName)
                .done(function() { window.location.reload(true); })
                .fail(this.handleAJAXError.bind(this));
        }.bind(this));
    }
});
github invinst / CPDB / dashboard / static / dashboard / js / components / OfficerSection / Officer / StoryList.react.js View on Github external
onDeleteStory: function (story, e) {
    this.prevent(e);
    bootbox.confirm('You are going to delete story "' + story.title + '"?',
      this.deleteStoryCallback.bind(this, story));
  },
github mangalam-research / wed / web / dashboard.js View on Github external
function safe_confirm(message, cb) {
    bootbox.confirm({
      message: message,
      buttons: {
        cancel: {
          label: "No",
          className: "btn-default btn-primary pull-left",
        },
        confirm: {
          label: "Yes",
          className: "btn-danger pull-right",
        },
      },
      callback: cb,
    });
  }
github onejgordon / flow-dashboard / src / js / components / common / SimpleAdmin.js View on Github external
handleDelete(event) {
    if (!this.props.disableDelete) {
      if (this.props.confirm_delete) {
        bootbox.confirm("Really delete?", (ok) => {
          if (ok) this.props.onFormDelete();
        });
      } else {
        this.props.onFormDelete();
      }
    }
  }
github invinst / CPDB / dashboard / static / dashboard / js / components / SessionSection / SessionAliasList.react.js View on Github external
deleteAlias: function (alias, e) {
    e.preventDefault();

    bootbox.confirm('Confirm delete alias "' + alias.alias +'"', function (yes) {
      if (yes) {
        SessionAliasAPI.deleteAlias(alias);
      }
    });
  },
github invinst / CPDB / dashboard / static / dashboard / js / components / DocumentSection / DocumentMixin.js View on Github external
onCancelClick: function (allegation, e) {
    e.preventDefault();
    e.stopPropagation();
    bootbox.confirm('Do you want to cancel document request for #' + allegation.crid, function (yes) {
      if (yes) {
        DocumentRequestAPI.cancelRequest(allegation);
      }
    });
  },

bootbox

Wrappers for JavaScript alert(), confirm(), prompt(), and other flexible dialogs using the Bootstrap framework

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis

Popular bootbox functions

Similar packages