Skip to content

Instantly share code, notes, and snippets.

@patorash
Created February 19, 2015 01:22
Show Gist options
  • Save patorash/89d101435171994c6f25 to your computer and use it in GitHub Desktop.
Save patorash/89d101435171994c6f25 to your computer and use it in GitHub Desktop.
Loading Modal Dialog
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">&times;</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