1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Added toast config and messages when saving from vault. Persist scroll position when returning to vault from other pages.

This commit is contained in:
Kyle Spearrin
2016-09-12 19:48:36 -04:00
parent ba5286c438
commit 5f39939d65
17 changed files with 154 additions and 30 deletions

View File

@@ -1,10 +1,10 @@
angular
.module('bit.vault')
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, cipherService) {
.controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, cipherService, $state, $stateParams) {
var delayLoad = true;
if (!$rootScope.vaultSites) {
$rootScope.vaultSites =[];
$rootScope.vaultSites = [];
delayLoad = false;
}
if (!$rootScope.vaultFolders) {
@@ -13,6 +13,7 @@
}
if (delayLoad) {
setTimeout(setScrollY, 100);
setTimeout(loadVault, 1000);
}
else {
@@ -64,6 +65,9 @@
$q.all(promises).then(function () {
$rootScope.vaultSites = decSites;
$rootScope.vaultFolders = decFolders;
if (!delayLoad) {
setScrollY();
}
});
});
});
@@ -76,4 +80,31 @@
return item.name.toLowerCase();
};
$scope.addSite = function () {
$state.go('addSite', {
animation: 'in-slide-up',
returnScrollY: getScrollY()
});
};
$scope.viewSite = function (site) {
$state.go('viewSite', {
siteId: site.id,
animation: 'in-slide-up',
returnScrollY: getScrollY()
});
};
function getScrollY() {
var content = document.getElementsByClassName('content')[0];
return content.scrollTop;
};
function setScrollY() {
if ($stateParams.scrollY) {
var content = document.getElementsByClassName('content')[0];
content.scrollTop = $stateParams.scrollY;
}
};
});