Asynchronous modal dialogs for the synchronous window.alert, window.confirm
and window.prompt, styled and managed by Twitter Bootstrap.
Pretty similar to Bootbox, yet using
jQuery's Deferred objects.
alert, confirm and prompt all support custom title and body. Additionally,
they support setting the button text and severity (default and danger at the moment).
// Alert dialog with custom title and body
Bootstrap.Dialogs.alert({ title: 'Alert title', body: 'Alert body' })
.done(function () {
...
});
// Confirm dialog with default text
Bootstrap.Dialogs.confirm()
.done(function () {
...
})
.fail(function () {
...
});
// Prompt dialog with custom title and body
Bootstrap.Dialogs.prompt({ title: 'What is your name?', body: 'Please enter your name' })
.done(function (name) {
...
})
.fail(function () {
...
});
// Confirm dialog with custom button text
Bootstrap.Dialogs.confirm({ ok: 'Confirm', cancel: 'Abort' });
// Critical alert dialog
Bootstrap.Dialogs.alert({ danger: true });TL;DR: npm install && npm test
Install Node and Npm using your packet manager of choice.
Install development dependencies:
npm install
Build and run the tests:
npm test
Start a development cycle listening for changes to files running a simple static server, CoffeeScript linting + compilation, and the test suite:
npm start
To see the examples in action, issue npm install && npm start and access
http://localhost:8000/examples/.
In order to upgrade the distribution files bundled in the repo, run npm run-script dist.
- Update
Release notes - Bump
package.jsonandbower.jsonversion numbers - Run
npm run distto update all distribution sources git tag -a <tag>with the appropriate version number
- Support require of jQuery and bootstrap for better browserify integration.
- Add very basic CommonJS support.
- Fix leak of click handlers between buttons.
- Disable scrolling of body behind a dialog.
- Upgrade jQuery dependency to 1.10.2.
- Capitalize "OK" texts.
- Make Bower dependencies looser.
- Fix #5: Allow clicking the backdrop to dismiss (unless "lock" is true).
- Fix #4: Add "lock" option to disable ESC closing.
- Replace
noButtonswithlockoption.
- Remove positional arguments support from .dialog.
- Add
noButtonsoption to .dialog.
- Add
returnoption to allow confirm dialogs to optionally be resolvable by pressing the return key.
- Fix #3: Allow setting alert, confirm and prompt button texts.
- Update API's argument passing style to be objects rather than regular argument list.
- Fix #2: Add option to make the 'OK' button take on the btn-danger class.
- Add keyboard bindings for Return and Escape
- Add grunt-cli as a dependency
- Depend on jQuery 1.8.3 to match Bootstrap
- Allow buttons to be jQuery objects or DOM elements
- Make "Ok" buttons primary
- Add Bootstrap and jQuery as component dependencies.
- Submit prompt on Return keypress.
- Give prompt input focus.
- Wrap titles in h3.
- Add close button by default.
- Initial release.
Distrubuted under the ISC license. Please refer to the LICENSE.