added better comments. tweaked when modal is shown

This commit is contained in:
Dave Cranwell 2014-06-16 13:06:02 +01:00
parent b5dc5a9516
commit ba15fbead1
2 changed files with 12 additions and 7 deletions

View file

@ -16,7 +16,10 @@ function ModalWorkflow(opts) {
/* remove any previous modals before continuing (closing doesn't remove them from the dom) */
$('body > .modal').remove();
// set default contents of container
var container = $('<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">\n <div class="modal-dialog">\n <div class="modal-content">\n <button type="button" class="close icon text-replace icon-cross" data-dismiss="modal" aria-hidden="true">&times;</button>\n <div class="modal-body"></div>\n </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->\n</div>');
// add container to body and hide it, so content can be added to it before display
$('body').append(container);
container.modal('hide');
@ -51,15 +54,17 @@ function ModalWorkflow(opts) {
var response = eval('(' + responseText + ')');
self.loadBody(response);
container.modal('show');
};
self.loadBody = function(body) {
if (body.html) {
self.body.html(body.html);
self.loadBody = function(response) {
if (response.html) {
// if the response is html
self.body.html(response.html);
container.modal('show');
}
if (body.onload) {
body.onload(self);
if (response.onload) {
// if the response is a function
response.onload(self);
}
};

View file

@ -80,7 +80,7 @@ $zindex-modal-background: 500;
background-color: black;
// Fade for backdrop
&.fade { opacity:0; }
&.in { opacity:0.7; }
&.in { opacity:0.5; }
}
.modal .close{