Created
February 19, 2013 15:48
-
-
Save fgrehm/4987039 to your computer and use it in GitHub Desktop.
Global ajax handlers
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
jQuery ($) -> | |
$indicator = $('#ajax-indicator') | |
$message = $indicator.find('span') | |
$(document).ajaxSend (event, jqXHR, ajaxOptions) -> | |
msg = if ajaxOptions.type == 'GET' then 'Carregando' else 'Processando' | |
$message.text("#{msg}...") | |
$indicator.show() | |
$(document).ajaxStop -> $indicator.hide() | |
$(document).ajaxError -> | |
alert('Ocorreu um erro ao processar sua requisição, por favor recarregue a página e tente novamente') |
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
p#ajax-indicator | |
= image_tag 'busy.gif' | |
span |
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
#ajax-indicator { | |
img { margin-right: $baseLineHeight / 2 } | |
display: none; | |
z-index: 1041; | |
position: fixed; | |
top: 0; | |
left: 50%; | |
margin-left: -80px; | |
width: 160px; | |
height: 25px; | |
background: $greenLight; | |
color: black; | |
text-align: center; | |
@include border-radius(0 0 5px 5px); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment