Boot Modal has evoloved from a project I'm working on were we needed our dialogs to handle a number of functions not currently available with bootstrap modals.
- Dynamic Creation of Modals
- DOM injection and removel of modal objects
- The ability to have multipule modals open (Automatic handling of focusing the most recent dialog)
- The ablitity to associate a knockout viewModel with a dialog
- If knockout is not included we create a simple result object of all the dialogs inputs.
This project continues to evolve as I attempt to add additional features and improve upon my existing code.
Twitter Bootstrap
jQuery
Knockout [optional]
By default modals have a ok and cancel button. Once the buttons are triggered a callback will be fired once the modal has closed with two arguments a success {boolean} and results {object}. You can override the buttons with object in one of tow ways.
buttons: { 'Accept Button': { class: 'btn btn-primary', callback: function(evt, results) { //handle ok event } }, Cancel: { callback: function(evt, results) { // handle cancel event } } }
var dlg = new BootModal({ title: 'Delete Item', content: 'Are you sure you want to delete this item?' buttons: { Ok: { class: 'btn btn-primary', callback: function(evt, results) { //handle ok event } }, Cancel: { class: 'btn btn-default', callback: function(evt, results) { // handle cancel event } } } }); or BootModal.Confirm({ title: 'Delete Item', content: 'Are you sure you want to delete this item?' }, function(success, results) { //handle close callback });
Knockout validation
The ablility to use knockout stringTempletes
Angular Plugin