Commit bf1c66368dbb9e74de5cda7aeec907396948abc9
1 parent
5e92b217
Exists in
master
and in
7 other branches
Add loading div for signup
Showing
3 changed files
with
15 additions
and
0 deletions
Show diff stats
index.html
@@ -324,6 +324,7 @@ | @@ -324,6 +324,7 @@ | ||
324 | </script> | 324 | </script> |
325 | 325 | ||
326 | <script id="login" type="text/x-handlebars-template"> | 326 | <script id="login" type="text/x-handlebars-template"> |
327 | + <div class="loading">Carregando...</div> | ||
327 | <form id="login-form" class="login"> | 328 | <form id="login-form" class="login"> |
328 | <div class="message hide"></div> | 329 | <div class="message hide"></div> |
329 | <div class="username"> | 330 | <div class="username"> |
js/main.js
@@ -660,6 +660,12 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -660,6 +660,12 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
660 | var message = $('.signup .message'); | 660 | var message = $('.signup .message'); |
661 | message.hide(); | 661 | message.hide(); |
662 | message.text(''); | 662 | message.text(''); |
663 | + | ||
664 | + var signup = $(this).parents('form.signup'); | ||
665 | + var loading = $('.login-container .loading'); | ||
666 | + loading.show(); | ||
667 | + signup.hide(); | ||
668 | + | ||
663 | $.ajax({ | 669 | $.ajax({ |
664 | type: 'post', | 670 | type: 'post', |
665 | url: host + '/api/v1/register', | 671 | url: host + '/api/v1/register', |
@@ -669,6 +675,9 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -669,6 +675,9 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
669 | }).fail(function( /*data*/ ) { | 675 | }).fail(function( /*data*/ ) { |
670 | message.show(); | 676 | message.show(); |
671 | message.text('Não foi possível efetuar o cadastro'); | 677 | message.text('Não foi possível efetuar o cadastro'); |
678 | + }).always(function() { | ||
679 | + loading.hide(); | ||
680 | + signup.show(); | ||
672 | }); | 681 | }); |
673 | e.preventDefault(); | 682 | e.preventDefault(); |
674 | }); | 683 | }); |