Use pleaseWaitDialog in some cases

This commit is contained in:
Benjamin Renard 2014-01-12 20:34:06 +01:00
parent f92011ac52
commit 5d8df9bdfe

View file

@ -434,6 +434,7 @@ on_valid_login_modal=function(e) {
pass=$('#login_modal #login_pass')[0].value; pass=$('#login_modal #login_pass')[0].value;
server=$('#login_modal #login_server')[0].value; server=$('#login_modal #login_server')[0].value;
$('#login_modal').modal('hide'); $('#login_modal').modal('hide');
pleaseWaitShow();
sync_server.login(server,email,pass, sync_server.login(server,email,pass,
function(data) { function(data) {
localStorage.user=JSON.stringify({ localStorage.user=JSON.stringify({
@ -442,9 +443,11 @@ on_valid_login_modal=function(e) {
'password': pass, 'password': pass,
'server': server, 'server': server,
}); });
pleaseWaitHide();
logged_menu(); logged_menu();
}, },
function(data) { function(data) {
pleaseWaitHide();
if (jQuery.type(data) != 'object' && data.loginerror) { if (jQuery.type(data) != 'object' && data.loginerror) {
alert(data.loginerror); alert(data.loginerror);
} }
@ -463,6 +466,7 @@ on_valid_login_modal=function(e) {
********************/ ********************/
on_click_sync_btn=function(e) { on_click_sync_btn=function(e) {
if (user) { if (user) {
pleaseWaitShow();
sync_server.sync(user.server, user.email, user.password, groups.export(), sync_server.sync(user.server, user.email, user.password, groups.export(),
function(data) { function(data) {
console.log(data); console.log(data);
@ -470,14 +474,17 @@ on_click_sync_btn=function(e) {
groups.import(data.groups); groups.import(data.groups);
groups.save(); groups.save();
refresh_group_list(); refresh_group_list();
pleaseWaitHide();
alert('Groupes synchronisés'); alert('Groupes synchronisés');
} }
else { else {
pleaseWaitHide();
console.log(data); console.log(data);
alert('Erreur durant la synchronisation :('); alert('Erreur durant la synchronisation :(');
} }
}, },
function(data) { function(data) {
pleaseWaitHide();
console.log(data); console.log(data);
alert('Impossible de contacter le serveur :('); alert('Impossible de contacter le serveur :(');
} }
@ -548,6 +555,7 @@ pleaseWaitHide=function() {
* Activate * Activate
*********************/ *********************/
$( document ).ready( function() { $( document ).ready( function() {
pleaseWaitShow();
if(typeof(Storage)!=="undefined"){ if(typeof(Storage)!=="undefined"){
groups=new GroupList(); groups=new GroupList();
groups.loadFromLocalStorage(); groups.loadFromLocalStorage();
@ -561,6 +569,7 @@ $( document ).ready( function() {
} }
else { else {
alert('Local storage not supported !'); alert('Local storage not supported !');
pleaseWaitHide();
return; return;
} }
sync_server=new SyncServer(); sync_server=new SyncServer();
@ -598,4 +607,5 @@ $( document ).ready( function() {
$('#remove_group_btn').bind('click',on_remove_group_btn_click); $('#remove_group_btn').bind('click',on_remove_group_btn_click);
view_home(); view_home();
pleaseWaitHide();
} ); } );