sync page

This commit is contained in:
Kyle Spearrin 2016-09-21 19:30:08 -04:00
parent 438fbc1888
commit 2b6b75737e
4 changed files with 30 additions and 10 deletions

View File

@ -1,13 +1,7 @@
angular
.module('bit.settings')
.controller('settingsController', function ($scope, loginService, $state, syncService, SweetAlert, utilsService) {
$scope.sync = function () {
syncService.fullSync(function () {
alert('Sync done!');
});
};
.controller('settingsController', function ($scope, loginService, $state, SweetAlert, utilsService) {
$scope.logOut = function () {
SweetAlert.swal({
title: 'Log Out',

View File

@ -1,6 +1,25 @@
angular
.module('bit.settings')
.controller('settingsSyncController', function ($scope) {
.controller('settingsSyncController', function ($scope, syncService, toastr) {
$scope.lastSync = '--';
setLastSync();
$scope.sync = function () {
syncService.fullSync(function () {
toastr.success('Syncing complete');
setLastSync();
});
};
function setLastSync() {
syncService.getLastSync(function (lastSync) {
if (lastSync) {
$scope.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
}
else {
$scope.lastSync = 'Never';
}
});
}
});

View File

@ -34,7 +34,7 @@
Folders
<i class="fa fa-chevron-right fa-lg"></i>
</a>
<a class="list-section-item" href="" ng-click="sync()">
<a class="list-section-item" ui-sref="sync({animation: 'in-slide-left'})">
Sync
<i class="fa fa-chevron-right fa-lg"></i>
</a>

View File

@ -5,5 +5,12 @@
<div class="title">Sync</div>
</div>
<div class="content">
<div class="centered-message">
<p style="margin-top: -50px;">
<a href="" class="btn btn-lg btn-link btn-block" ng-click="sync()">
Sync Vault Now
</a>
<small class="text-muted">Last Sync: {{lastSync}}</small>
</p>
</div>
</div>