From e3c21f17f8cbb9d955fa7dd7693c2308dde34c2f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 8 Sep 2016 22:23:56 -0400 Subject: [PATCH] view site loaded with siteId parameter --- src/popup/app/config.js | 18 ++++++++---------- src/popup/app/vault/vaultController.js | 12 ------------ src/popup/app/vault/vaultViewSiteController.js | 12 ++---------- src/popup/app/vault/views/vault.html | 2 +- src/popup/app/vault/views/vaultViewSite.html | 4 ++-- 5 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/popup/app/config.js b/src/popup/app/config.js index e928536d..3da5f429 100644 --- a/src/popup/app/config.js +++ b/src/popup/app/config.js @@ -68,19 +68,17 @@ templateUrl: "app/tools/views/tools.html", controller: 'toolsController' }) - .state('empty', { - url: "/empty", - abstract: true, - templateUrl: "app/global/enoty.html", + .state('viewSite', { + url: "/view-site?siteId", + templateUrl: "app/vault/views/vaultViewSite.html", + controller: 'vaultViewSiteController', + params: { + siteId: null + }, data: { authorize: true } - }) - .state('empty.viewSite', { - url: "/view-site", - templateUrl: "app/vault/views/vaultViewSite.html", - controller: 'vaultViewSiteController' - }); + }); }) .run(function ($rootScope, userService, loginService, tokenService, $state) { $rootScope.$on('$stateChangeStart', function (event, toState, toParams) { diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index 54518505..0d322f05 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -2,7 +2,6 @@ .module('bit.vault') .controller('vaultController', function ($scope, siteService, folderService, $q, cipherService) { - $scope.parentScope = $scope; $scope.sites = []; $scope.folders = []; $scope.focusedSiteId = null; @@ -69,17 +68,6 @@ }; /* - $scope.viewSite = function (site) { - $scope.focusedSiteId = site.id; - $ionicModal.fromTemplateUrl('app/vault/views/vaultViewSite.html', { - scope: $scope, - animation: 'slide-in-up' - }).then(function (modal) { - $scope.viewSiteModal = modal; - modal.show(); - }); - }; - $scope.editSite = function (site) { $scope.focusedSiteId = site.id; $ionicModal.fromTemplateUrl('app/vault/views/vaultEditSite.html', { diff --git a/src/popup/app/vault/vaultViewSiteController.js b/src/popup/app/vault/vaultViewSiteController.js index 1144f977..06496c61 100644 --- a/src/popup/app/vault/vaultViewSiteController.js +++ b/src/popup/app/vault/vaultViewSiteController.js @@ -1,19 +1,11 @@ angular .module('bit.vault') - .controller('vaultViewSiteController', function ($scope, siteService, cipherService) { + .controller('vaultViewSiteController', function ($scope, $stateParams, siteService, cipherService) { $scope.site = null; - siteService.get($scope.parentScope.focusedSiteId, function (site) { + siteService.get($stateParams.siteId, function (site) { cipherService.decryptSite(site).then(function (model) { $scope.site = model; }); }); - - $scope.editSite = function () { - // TODO - }; - - $scope.close = function () { - $scope.parentScope.closeViewSite(); - }; }); diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index f6f3d4e1..ad8ba17f 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -9,7 +9,7 @@
{{folder.name}}
- + {{site.name}} {{site.username}} diff --git a/src/popup/app/vault/views/vaultViewSite.html b/src/popup/app/vault/views/vaultViewSite.html index 23d3c7ef..826f4ae4 100644 --- a/src/popup/app/vault/views/vaultViewSite.html +++ b/src/popup/app/vault/views/vaultViewSite.html @@ -1,6 +1,6 @@ 
- Close - Edit + Close + Edit
View Site