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

This commit is contained in:
bn8 2014-02-23 23:51:50 +01:00
parent 3576aeac12
commit 0c25e62672
2 changed files with 23 additions and 9 deletions

View file

@ -553,6 +553,7 @@ on_valid_login_modal=function(e) {
'email': email,
'password': pass,
'server': server,
'lastsync': null
});
pleaseWaitHide();
logged_menu();
@ -628,6 +629,8 @@ on_click_sync_btn=function(e) {
if (data.groups) {
groups.import(data.groups);
groups.save();
user.lastsync=new Date().getTime();
localStorage.user=JSON.stringify(user);
refresh_group_list();
pleaseWaitHide();
view_home();
@ -691,6 +694,12 @@ on_click_myaccount_btn=function() {
$('#myaccount_modal #myaccount_email').html(user.email);
$('#myaccount_modal #myaccount_name')[0].value=user.name;
$('#myaccount_modal #myaccount_server').html(user.server);
if (user.lastsync) {
$('#myaccount_modal #myaccount_lastsync').html(moment(user.lastsync).format('DD/MM/YYYY HH:mm:ss'));
}
else {
$('#myaccount_modal #myaccount_lastsync').html('Jamais synchronisé');
}
$('#myaccount_modal').modal('show');
}

View file

@ -483,30 +483,35 @@ body{
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<label class="col-sm-3 control-label">Email</label>
<div class="col-sm-9">
<p class="form-control-static" id='myaccount_email'></p>
</div>
</div>
<div class="form-group">
<label "inputName" class="col-sm-2 control-label">Nom</label>
<div class="col-sm-10">
<label "inputName" class="col-sm-3 control-label">Nom</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="myaccount_name" placeholder="Nom" disabled>
</div>
</div>
<div class="form-group">
<label for="inputPassword" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<label for="inputPassword" class="col-sm-3 control-label">Mot de passe</label>
<div class="col-sm-9">
<input type="password" class="form-control" id="myaccount_password" placeholder="Mot de passe" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Serveur</label>
<div class="col-sm-10">
<label class="col-sm-3 control-label">Serveur</label>
<div class="col-sm-9">
<p class="form-control-static" id='myaccount_server'></p>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">Dernière synchronisation</label>
<div class="col-sm-5">
<p class="form-control-static" id='myaccount_lastsync'></p>
</div>
</div>
</form>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>