Use pleaseWaitDialog in some cases
Benjamin Renard

Benjamin Renard commited on 2014-01-12 19:34:06
Showing 1 changed files, with 10 additions and 0 deletions.

... ...
@@ -434,6 +434,7 @@ on_valid_login_modal=function(e) {
434 434
   pass=$('#login_modal #login_pass')[0].value;
435 435
   server=$('#login_modal #login_server')[0].value;
436 436
   $('#login_modal').modal('hide');
437
+  pleaseWaitShow();
437 438
   sync_server.login(server,email,pass,
438 439
     function(data) {
439 440
       localStorage.user=JSON.stringify({
... ...
@@ -442,9 +443,11 @@ on_valid_login_modal=function(e) {
442 443
         'password': pass,
443 444
         'server': server,
444 445
       });
446
+      pleaseWaitHide();
445 447
       logged_menu();
446 448
     },
447 449
     function(data) {
450
+      pleaseWaitHide();
448 451
       if (jQuery.type(data) != 'object' && data.loginerror) {
449 452
         alert(data.loginerror);
450 453
       }
... ...
@@ -463,6 +466,7 @@ on_valid_login_modal=function(e) {
463 466
  ********************/
464 467
 on_click_sync_btn=function(e) {
465 468
   if (user) {
469
+    pleaseWaitShow();
466 470
     sync_server.sync(user.server, user.email, user.password, groups.export(),
467 471
       function(data) {
468 472
         console.log(data);
... ...
@@ -470,14 +474,17 @@ on_click_sync_btn=function(e) {
470 474
           groups.import(data.groups);
471 475
           groups.save();
472 476
           refresh_group_list();
477
+          pleaseWaitHide();
473 478
           alert('Groupes synchronisés');
474 479
         }
475 480
         else {
481
+          pleaseWaitHide();
476 482
           console.log(data);
477 483
           alert('Erreur durant la synchronisation :(');
478 484
         }
479 485
       },
480 486
       function(data) {
487
+        pleaseWaitHide();
481 488
         console.log(data);
482 489
         alert('Impossible de contacter le serveur :(');
483 490
       }
... ...
@@ -548,6 +555,7 @@ pleaseWaitHide=function() {
548 555
  * Activate
549 556
  *********************/
550 557
 $( document ).ready( function() {
558
+  pleaseWaitShow();
551 559
   if(typeof(Storage)!=="undefined"){
552 560
     groups=new GroupList();
553 561
     groups.loadFromLocalStorage();
... ...
@@ -561,6 +569,7 @@ $( document ).ready( function() {
561 569
   }
562 570
   else {
563 571
     alert('Local storage not supported !');
572
+    pleaseWaitHide();
564 573
     return;
565 574
   }
566 575
   sync_server=new SyncServer();
... ...
@@ -598,4 +607,5 @@ $( document ).ready( function() {
598 607
 
599 608
   $('#remove_group_btn').bind('click',on_remove_group_btn_click);
600 609
   view_home();
610
+  pleaseWaitHide();
601 611
 } );
602 612