Skip to content

Instantly share code, notes, and snippets.

@timesync
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timesync/1ba557e380008a0050f1 to your computer and use it in GitHub Desktop.
Save timesync/1ba557e380008a0050f1 to your computer and use it in GitHub Desktop.
An example of how to get Bootbox.js and Meteor playing nicely together.
bootbox.dialog({
title: “Modal Window Title”,
/**
* Note in the following:
*
* "messages" needs to be a string of at least 1 character in length
* as it's required for Bootbox to function properly.
*/
message: “ “,
buttons:
main: {
label: "Done",
className: "btn-primary",
callback: function() {
console.log(“Done clicked.”);
}
}
},
});
/**
* In order to get reactive templates to function properly, you have to
* render the template after the Bootbox dialog has been instantiated.
*
* Parameters below that might need some explanation:
*
* yourWindowTemplate – The template you want to render inside the Bootbox dialog.
*
* yourDataContext - The data context for the template.
*
* $(".bootbox-body")[0] - This is the parent element where you're rendering your
* content. To get this semi-hack to work, this is REQUIRED.
*/
Blaze.renderWithData(yourWindowTemplate, yourMongoCollection.findOne(item_id), $(".bootbox-body")[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment