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