emberjs-addons/ember-bootstrap — pull request #81 by pangratz (2013-07-12 11:33:08+00:00)
Title: Promisify Bootstrap.ModalPane

A ModalPane now resolves when the `primary` button is clicked and
rejects on `secondary` or `close`.

This change allows you to write a dialog like this:

``` javascript
Bootstrap.ModalPane.popup({
heading: 'You sure?',
primary: 'Delete',
secondary: 'Cancel'
}).then(function() {
// primary button has been clicked
}, function() {
// secondary button or dialog has been closed
});
```

The options and event are passed to the promise handler, so you can add
some additional logic:

``` javascript
Bootstrap.ModalPane.popup(...)
.then(null, function(options, event) {
if (options.secondary) {
// dialog closed because secondary button clicked
} else if (options.close) {
// dialog closed by X
}
});
```