From f77e3b09ea0fb342b70b2e6f5679b797ce133f46 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 19 Dec 2017 21:39:44 -0500 Subject: [PATCH] filter favorite ciphers from controller --- src/popup/app/vault/vaultController.js | 8 +++++++- src/popup/app/vault/views/vault.html | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index 523310b520..e5be32bb36 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -2,7 +2,7 @@ angular .module('bit.vault') .controller('vaultController', function ($scope, $rootScope, cipherService, folderService, $q, $state, $stateParams, toastr, - syncService, utilsService, $analytics, i18nService, stateService, $timeout, $window, collectionService) { + syncService, utilsService, $analytics, i18nService, stateService, $timeout, $window, collectionService, $filter) { var stateKey = 'vault', state = stateService.getState(stateKey) || {}; stateService.removeState('viewGrouping'); @@ -25,8 +25,13 @@ angular $scope.loaded = true; if (!$rootScope.vaultCiphers) { $rootScope.vaultCiphers = []; + $scope.favoriteCiphers = []; delayLoad = false; } + else { + $scope.favoriteCiphers = $filter('filter')($rootScope.vaultCiphers, { favorite: true }); + } + if (!$rootScope.vaultFolders) { $rootScope.vaultFolders = []; delayLoad = false; @@ -68,6 +73,7 @@ angular $rootScope.vaultFolders = decFolders; $rootScope.vaultCollections = decCollections; $rootScope.vaultCiphers = decCiphers; + $scope.favoriteCiphers = $filter('filter')($rootScope.vaultCiphers, { favorite: true }); if ($scope.showGroupingCounts) { var folderCounts = { 'none': 0 }; diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index 5bfc047bc9..72100efcfb 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -12,7 +12,7 @@
-
+
{{::i18n.favorites}} {{favoriteCiphers.length}} @@ -20,8 +20,7 @@