Created
November 12, 2012 19:24
-
-
Save magicmarkker/4061328 to your computer and use it in GitHub Desktop.
Rails custom dialog confirm box with twitter bootstrap modal
This file contains 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
$.rails.allowAction = (element) -> | |
message = element.data("confirm") | |
answer = false | |
return true unless message | |
if $.rails.fire(element, "confirm") | |
myCustomConfirmBox message, element | |
false | |
myCustomConfirmBox = (message, element) -> | |
$('.modal .btn-primary').unbind "click" | |
$("#dialog-confirm .modal-body").html message | |
$("#dialog-confirm").modal "show" | |
$("#dialog-confirm .btn-primary").click -> | |
if element.attr("data-remote") | |
$.rails.handleRemote element | |
else | |
$.rails.handleMethod element | |
$("#dialog-confirm").modal "hide" | |
$("#dialog-confirm .modal-body").html "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment