Created
February 19, 2015 01:22
-
-
Save patorash/89d101435171994c6f25 to your computer and use it in GitHub Desktop.
Loading Modal Dialog
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
class window.LoadingModal | |
@modal_html = null | |
@show: (title, message, options={})-> | |
html = """ | |
<div class="modal fade" role="dialog" aria-labelledby="pleaseWaitDialogLabel" aria-hidden="true"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="閉じる"> | |
<span aria-hidden="true">×</span> | |
</button> | |
<h4 class="modal-title" id="pleaseWaitDialogLabel">#{title}</h4> | |
</div> | |
<div class="modal-body"> | |
<div class="progress"> | |
<div class="progress-bar progress-bar-striped active" role="progressbar" | |
aria-valuenow='100' aria-valuemin='0' aria-valuemax='100' style="width: 100%"> | |
<span class="sr-only">Loading...</span> | |
</div> | |
</div> | |
<p>#{message}<p> | |
</div> | |
</div> | |
</div> | |
</div> | |
""" | |
@modal_html = $(html) | |
@modal_html.on 'show.bs.modal', options.show_callback if options.show_callback? | |
@modal_html.on 'shown.bs.modal', options.shown_callback if options.shown_callback? | |
@modal_html.on 'hide.bs.modal', options.hide_callback if options.hide_callback? | |
@modal_html.on 'hidden.bs.modal', options.hidden_callback if options.hidden_callback? | |
@modal_html.on 'loaded.bs.modal', options.loaded_callback if options.loaded_callback? | |
@modal_html.modal() | |
return | |
@hide: -> | |
@modal_html.modal('hide') | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment