From 32b2eed66cbcd4f185c58635ddfae374393e816b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 9 Sep 2016 23:00:11 -0400 Subject: [PATCH] vault tuneups --- src/popup/app/vault/vaultAddSiteController.js | 6 +- src/popup/app/vault/vaultController.js | 70 +++-------- src/popup/app/vault/views/vault.html | 8 +- src/popup/app/vault/views/vaultAddSite.html | 110 +++++++++--------- src/popup/less/components.less | 43 +++---- 5 files changed, 98 insertions(+), 139 deletions(-) diff --git a/src/popup/app/vault/vaultAddSiteController.js b/src/popup/app/vault/vaultAddSiteController.js index 0fbb622000..78bb46fc5b 100644 --- a/src/popup/app/vault/vaultAddSiteController.js +++ b/src/popup/app/vault/vaultAddSiteController.js @@ -1,12 +1,12 @@ angular .module('bit.vault') - .controller('vaultAddSiteController', function ($scope, siteService, cipherService) { + .controller('vaultAddSiteController', function ($scope, $state, siteService, cipherService) { $scope.site = { folderId: null }; - $scope.createSite = function (model) { + $scope.save = function (model) { cipherService.encryptSite(model, function (siteModel) { var site = new Site(siteModel, true); siteService.saveWithServer(site, function () { @@ -16,6 +16,6 @@ }; $scope.close = function () { - $scope.parentScope.closeAddSite(); + $state.go('tabs.vault', { animation: 'out-slide-down' }); }; }); diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index 0d322f056c..6b8e90619f 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -1,14 +1,26 @@ angular .module('bit.vault') - .controller('vaultController', function ($scope, siteService, folderService, $q, cipherService) { - $scope.sites = []; - $scope.folders = []; - $scope.focusedSiteId = null; + .controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, cipherService) { + var delayLoad = true; + if (!$rootScope.vaultSites) { + $rootScope.vaultSites =[]; + delayLoad = false; + } + if (!$rootScope.vaultFolders) { + $rootScope.vaultFolders = []; + delayLoad = false; + } - loadVault(); + if (delayLoad) { + setTimeout(loadVault, 1000); + } + else { + loadVault(); + } function loadVault() { + var promises = []; var decSites = []; var decFolders = [{ id: null, @@ -17,8 +29,6 @@ folderService.getAll(function (folders) { siteService.getAll(function (sites) { - var promises = []; - for (var i = 1; i < folders.length; i++) { decFolders.push({ id: folders[i].id @@ -52,8 +62,8 @@ } $q.all(promises).then(function () { - $scope.sites = decSites; - $scope.folders = decFolders; + $rootScope.vaultSites = decSites; + $rootScope.vaultFolders = decFolders; }); }); }); @@ -66,46 +76,4 @@ return item.name.toLowerCase(); }; - - /* - $scope.editSite = function (site) { - $scope.focusedSiteId = site.id; - $ionicModal.fromTemplateUrl('app/vault/views/vaultEditSite.html', { - scope: $scope, - animation: 'slide-in-up' - }).then(function (modal) { - $scope.editSiteModal = modal; - modal.show(); - }); - }; - - $scope.addSite = function () { - $ionicModal.fromTemplateUrl('app/vault/views/vaultAddSite.html', { - scope: $scope, - animation: 'slide-in-up' - }).then(function (modal) { - $scope.addSiteModal = modal; - modal.show(); - }); - }; - */ - - $scope.closeAddSite = function () { - $scope.addSiteModal.hide(); - }; - - $scope.closeViewSite = function () { - $scope.viewSiteModal.hide(); - $scope.focusedSiteId = null; - }; - - $scope.closeEditSite = function () { - $scope.editSiteModal.hide(); - $scope.focusedSiteId = null; - }; - - $scope.$on('closeViewSite.hidden', function () { - console.log('modal hidden'); - loadVault(); - }); }); diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index 2a7b657acf..478c897e97 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -4,15 +4,15 @@
- -
+
diff --git a/src/popup/app/vault/views/vaultAddSite.html b/src/popup/app/vault/views/vaultAddSite.html index c9093f6c31..540a27e535 100644 --- a/src/popup/app/vault/views/vaultAddSite.html +++ b/src/popup/app/vault/views/vaultAddSite.html @@ -1,62 +1,64 @@ -
- Close - Save -
Add Site
-
-
-
-
-
- Site Information -
-
-
- - +
+
+ Close + +
Add Site
+
+
+
+
+
+ Site Information
-
- - -
-
- - -
-
- - -
- - Generate Password - - -
-
-
-
-
- - -
-
- - +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + Generate Password + +
-
-
-
- +
+
+
+ + +
+
+ + +
+
-
-
- +
+
+ +
+
+
+ +
-
+ diff --git a/src/popup/less/components.less b/src/popup/less/components.less index 1df152d18f..17ec2a31d8 100644 --- a/src/popup/less/components.less +++ b/src/popup/less/components.less @@ -14,12 +14,14 @@ right: 0; overflow: hidden; - a { + a, button { color: white !important; text-decoration: none; + background: none; &:hover { background-color: rgba(255, 255, 255, 0.1); + text-decoration: none; } } @@ -100,21 +102,11 @@ } .list { - .list-item { - border-top: 1px solid @border-color; - - &:first-child { - border: none; - } - } - - .list-item-header { - background-color: transparent; - padding: 10px 10px; - color: @gray-light; - - + .list-item { - border: none; + .list-grouped { + .list-grouped-header { + background-color: transparent; + padding: 10px 10px; + color: @gray-light; } } @@ -139,14 +131,6 @@ .list-section-items { border-top: 1px solid @border-color-dark; border-bottom: 1px solid @border-color-dark; - - .list-section-item { - border-bottom: 1px solid @border-color; - - &:last-child { - border: none; - } - } } .list-section-footer { @@ -156,7 +140,7 @@ } } - .list-item, .list-section-item { + .list-grouped-item, .list-section-item { display: block; padding: 10px 10px; background-color: white; @@ -165,12 +149,17 @@ overflow: hidden; text-overflow: ellipsis; color: @text-color; + border-bottom: 1px solid @border-color; + + &:last-child { + border: none; + } &:hover { background-color: @list-item-hover; } - &.list-item-condensed { + &.condensed { padding: 3px 10px; } @@ -219,7 +208,7 @@ } &.list-no-selection { - .list-item, .list-section-item { + .list-grouped-item, .list-section-item { &:hover { background-color: white; }