From fef2d38101c0a8b5de58d0b7f94768e0c37d6a79 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 4 Jan 2017 23:29:08 -0500 Subject: [PATCH] display site count for folders in optimized view as well --- src/popup/app/vault/vaultController.js | 12 ++++++++++++ src/popup/app/vault/views/vault.html | 1 + src/popup/app/vault/views/vaultViewFolder.html | 1 + src/popup/less/components.less | 12 +++++++++++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index 75671ce2e9..f52906dba3 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -60,6 +60,18 @@ $rootScope.vaultFolders = decFolders; $rootScope.vaultLogins = decLogins; + // compute site count for each folder + for (var i = 0; i < $rootScope.vaultFolders.length; i++) { + var siteCount = 0; + for (var j = 0; j < $rootScope.vaultLogins.length; j++) { + if ($rootScope.vaultLogins[j].folderId == $rootScope.vaultFolders[i].id) { + siteCount++; + } + } + + $rootScope.vaultFolders[i].siteCount = siteCount; + } + if (!delayLoad) { setScrollY(); } diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index d9b5fe11c1..d2ac1c5a20 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -18,6 +18,7 @@ ng-repeat="folder in vaultFolders | orderBy: folderSort"> {{folder.name}} + {{folder.siteCount}} diff --git a/src/popup/app/vault/views/vaultViewFolder.html b/src/popup/app/vault/views/vaultViewFolder.html index 7263958f37..dfcc0584bb 100644 --- a/src/popup/app/vault/views/vaultViewFolder.html +++ b/src/popup/app/vault/views/vaultViewFolder.html @@ -17,6 +17,7 @@
{{folder.name}} + {{vaultLogins.length}}