Add lastsync information to local user and display it on myaccount modal
bn8

bn8 commited on 2014-02-23 22:51:50
Showing 2 changed files, with 23 additions and 9 deletions.

... ...
@@ -553,6 +553,7 @@ on_valid_login_modal=function(e) {
553 553
         'email': email,
554 554
         'password': pass,
555 555
         'server': server,
556
+        'lastsync': null
556 557
       });
557 558
       pleaseWaitHide();
558 559
       logged_menu();
... ...
@@ -628,6 +629,8 @@ on_click_sync_btn=function(e) {
628 629
       if (data.groups) {
629 630
         groups.import(data.groups);
630 631
         groups.save();
632
+        user.lastsync=new Date().getTime();
633
+        localStorage.user=JSON.stringify(user);
631 634
         refresh_group_list();
632 635
         pleaseWaitHide();
633 636
         view_home();
... ...
@@ -691,6 +694,12 @@ on_click_myaccount_btn=function() {
691 694
   $('#myaccount_modal #myaccount_email').html(user.email);
692 695
   $('#myaccount_modal #myaccount_name')[0].value=user.name;
693 696
   $('#myaccount_modal #myaccount_server').html(user.server);
697
+  if (user.lastsync) {
698
+    $('#myaccount_modal #myaccount_lastsync').html(moment(user.lastsync).format('DD/MM/YYYY HH:mm:ss'));
699
+  }
700
+  else {
701
+    $('#myaccount_modal #myaccount_lastsync').html('Jamais synchronisé');
702
+  }
694 703
   $('#myaccount_modal').modal('show');
695 704
 }
696 705
 
... ...
@@ -483,30 +483,35 @@ body{
483 483
       <div class="modal-body">
484 484
       <form class="form-horizontal" role="form">
485 485
         <div class="form-group">
486
-          <label class="col-sm-2 control-label">Email</label>
487
-          <div class="col-sm-10">
486
+          <label class="col-sm-3 control-label">Email</label>
487
+          <div class="col-sm-9">
488 488
             <p class="form-control-static" id='myaccount_email'></p>
489 489
           </div>
490 490
         </div>
491 491
         <div class="form-group">
492
-          <label "inputName" class="col-sm-2 control-label">Nom</label>
493
-          <div class="col-sm-10">
492
+          <label "inputName" class="col-sm-3 control-label">Nom</label>
493
+          <div class="col-sm-9">
494 494
             <input type="text" class="form-control" id="myaccount_name" placeholder="Nom" disabled>
495 495
          </div>
496 496
         </div>
497 497
         <div class="form-group">
498
-          <label for="inputPassword" class="col-sm-2 control-label">Password</label>
499
-          <div class="col-sm-10">
498
+          <label for="inputPassword" class="col-sm-3 control-label">Mot de passe</label>
499
+          <div class="col-sm-9">
500 500
             <input type="password" class="form-control" id="myaccount_password" placeholder="Mot de passe" disabled>
501 501
           </div>
502 502
         </div>
503 503
         <div class="form-group">
504
-          <label class="col-sm-2 control-label">Serveur</label>
505
-          <div class="col-sm-10">
504
+          <label class="col-sm-3 control-label">Serveur</label>
505
+          <div class="col-sm-9">
506 506
             <p class="form-control-static" id='myaccount_server'></p>
507 507
           </div>
508 508
         </div>
509
-
509
+        <div class="form-group">
510
+          <label class="col-sm-5 control-label">Dernière synchronisation</label>
511
+          <div class="col-sm-5">
512
+            <p class="form-control-static" id='myaccount_lastsync'></p>
513
+          </div>
514
+        </div>
510 515
       </form>
511 516
       <div class="modal-footer">
512 517
         <button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>
513 518