Created
November 22, 2015 18:30
-
-
Save Teino1978-Corp/fcd1c3585ef5fe8cd2d5 to your computer and use it in GitHub Desktop.
Bootstrap Modal with Remote Source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$(document).on('.ajaxModal', 'click', function(event) { | |
$.get($(this).attr('href'), function(response) { | |
$('<div class="modal hide fade">' + response + '</div>').modal(); | |
}); | |
event.preventDefault(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.modal-header | |
button.close(data-dismiss="modal") × | |
h3 #{modal.title} | |
.modal-body | |
!= body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render: (req, res, view, data) -> | |
if not data.layout | |
data.layout = if req.header('X-Requested-With') is 'XMLHttpRequest' then 'layouts/modal' else 'layouts/default' | |
res.render view, data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment