diff --git a/src/popup/app/config.js b/src/popup/app/config.js index f292d6e4..4948dddb 100644 --- a/src/popup/app/config.js +++ b/src/popup/app/config.js @@ -64,7 +64,7 @@ url: "/vault", templateUrl: "app/vault/views/vault.html", controller: 'vaultController', - params: { scrollY: 0 } + params: { scrollY: 0, searchText: null } }) .state('tabs.settings', { url: "/settings", @@ -82,21 +82,21 @@ templateUrl: "app/vault/views/vaultViewSite.html", controller: 'vaultViewSiteController', data: { authorize: true }, - params: { animation: null, returnScrollY: 0 } + params: { animation: null, returnScrollY: 0, returnSearchText: null } }) .state('addSite', { url: "/add-site", templateUrl: "app/vault/views/vaultAddSite.html", controller: 'vaultAddSiteController', data: { authorize: true }, - params: { animation: null, returnScrollY: 0 } + params: { animation: null, returnScrollY: 0, returnSearchText: null } }) .state('editSite', { url: "/edit-site?siteId", templateUrl: "app/vault/views/vaultEditSite.html", controller: 'vaultEditSiteController', data: { authorize: true }, - params: { animation: null, fromView: true, returnScrollY: 0 } + params: { animation: null, fromView: true, returnScrollY: 0, returnSearchText: null } }); }) .run(function ($rootScope, userService, loginService, tokenService, $state) { diff --git a/src/popup/app/vault/vaultAddSiteController.js b/src/popup/app/vault/vaultAddSiteController.js index 09455357..f6cc1da9 100644 --- a/src/popup/app/vault/vaultAddSiteController.js +++ b/src/popup/app/vault/vaultAddSiteController.js @@ -3,6 +3,7 @@ .controller('vaultAddSiteController', function ($scope, $state, $stateParams, siteService, folderService, cipherService, $q) { var returnScrollY = $stateParams.returnScrollY; + var returnSearchText = $stateParams.returnSearchText; $scope.site = { folderId: null @@ -49,7 +50,11 @@ }; $scope.close = function () { - $state.go('tabs.vault', { animation: 'out-slide-down', scrollY: returnScrollY || 0 }); + $state.go('tabs.vault', { + animation: 'out-slide-down', + scrollY: returnScrollY || 0, + searchText: returnSearchText + }); }; function saveSite(site) { diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index db34c31f..e6ccb9d4 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -2,6 +2,8 @@ .module('bit.vault') .controller('vaultController', function ($scope, $rootScope, siteService, folderService, $q, cipherService, $state, $stateParams) { + $('#search').focus(); + var delayLoad = true; if (!$rootScope.vaultSites) { $rootScope.vaultSites = []; @@ -73,6 +75,11 @@ }); } + $scope.searchText = null; + if ($stateParams.searchText) { + $scope.searchText = $stateParams.searchText; + } + $scope.folderSort = function (item) { if (!item.id) { return ''; @@ -81,10 +88,16 @@ return item.name.toLowerCase(); }; + $scope.setFolderFilter = function (folder) { + $scope.folderFilter = {}; + $scope.folderFilter.folderId = folder.id; + } + $scope.addSite = function () { $state.go('addSite', { animation: 'in-slide-up', - returnScrollY: getScrollY() + returnScrollY: getScrollY(), + returnSearchText: $scope.searchText }); }; @@ -92,7 +105,8 @@ $state.go('viewSite', { siteId: site.id, animation: 'in-slide-up', - returnScrollY: getScrollY() + returnScrollY: getScrollY(), + returnSearchText: $scope.searchText }); }; diff --git a/src/popup/app/vault/vaultEditSiteController.js b/src/popup/app/vault/vaultEditSiteController.js index 09c39d22..0ffb422a 100644 --- a/src/popup/app/vault/vaultEditSiteController.js +++ b/src/popup/app/vault/vaultEditSiteController.js @@ -3,6 +3,7 @@ angular .controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, folderService, cipherService, $q, toastr) { var returnScrollY = $stateParams.returnScrollY; + var returnSearchText = $stateParams.returnSearchText; $scope.site = { folderId: null @@ -55,10 +56,19 @@ angular $scope.close = function () { if ($stateParams.fromView) { - $state.go('viewSite', { siteId: $stateParams.siteId, animation: 'out-slide-down' }); + $state.go('viewSite', { + siteId: $stateParams.siteId, + animation: 'out-slide-down', + returnScrollY: returnScrollY || 0, + returnSearchText: returnSearchText + }); } else { - $state.go('tabs.vault', { animation: 'out-slide-down', scrollY: returnScrollY || 0 }); + $state.go('tabs.vault', { + animation: 'out-slide-down', + scrollY: returnScrollY || 0, + searchText: returnSearchText + }); } }; diff --git a/src/popup/app/vault/vaultViewSiteController.js b/src/popup/app/vault/vaultViewSiteController.js index f64c1176..6c384ea0 100644 --- a/src/popup/app/vault/vaultViewSiteController.js +++ b/src/popup/app/vault/vaultViewSiteController.js @@ -3,6 +3,7 @@ .controller('vaultViewSiteController', function ($scope, $state, $stateParams, siteService, cipherService, tldjs, toastr) { var returnScrollY = $stateParams.returnScrollY; + var returnSearchText = $stateParams.returnSearchText; $scope.site = null; siteService.get($stateParams.siteId, function (site) { @@ -34,8 +35,22 @@ }); }); + $scope.edit = function (site) { + $state.go('editSite', { + animation: 'in-slide-up', + siteId: site.id, + fromView: true, + returnScrollY: returnScrollY || 0, + returnSearchText: returnSearchText + }); + } + $scope.close = function () { - $state.go('tabs.vault', { animation: 'out-slide-down', scrollY: returnScrollY || 0 }); + $state.go('tabs.vault', { + animation: 'out-slide-down', + scrollY: returnScrollY || 0, + searchText: returnSearchText + }); }; $scope.launchWebsite = function (site) { diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index 48ae7711..4d1dffc3 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -2,7 +2,10 @@
-