view site loaded with siteId parameter

This commit is contained in:
Kyle Spearrin 2016-09-08 22:23:56 -04:00
parent ab9593a53a
commit e3c21f17f8
5 changed files with 13 additions and 35 deletions

View File

@ -68,19 +68,17 @@
templateUrl: "app/tools/views/tools.html", templateUrl: "app/tools/views/tools.html",
controller: 'toolsController' controller: 'toolsController'
}) })
.state('empty', { .state('viewSite', {
url: "/empty", url: "/view-site?siteId",
abstract: true, templateUrl: "app/vault/views/vaultViewSite.html",
templateUrl: "app/global/enoty.html", controller: 'vaultViewSiteController',
params: {
siteId: null
},
data: { data: {
authorize: true authorize: true
} }
}) });
.state('empty.viewSite', {
url: "/view-site",
templateUrl: "app/vault/views/vaultViewSite.html",
controller: 'vaultViewSiteController'
});
}) })
.run(function ($rootScope, userService, loginService, tokenService, $state) { .run(function ($rootScope, userService, loginService, tokenService, $state) {
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) { $rootScope.$on('$stateChangeStart', function (event, toState, toParams) {

View File

@ -2,7 +2,6 @@
.module('bit.vault') .module('bit.vault')
.controller('vaultController', function ($scope, siteService, folderService, $q, cipherService) { .controller('vaultController', function ($scope, siteService, folderService, $q, cipherService) {
$scope.parentScope = $scope;
$scope.sites = []; $scope.sites = [];
$scope.folders = []; $scope.folders = [];
$scope.focusedSiteId = null; $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.editSite = function (site) {
$scope.focusedSiteId = site.id; $scope.focusedSiteId = site.id;
$ionicModal.fromTemplateUrl('app/vault/views/vaultEditSite.html', { $ionicModal.fromTemplateUrl('app/vault/views/vaultEditSite.html', {

View File

@ -1,19 +1,11 @@
angular angular
.module('bit.vault') .module('bit.vault')
.controller('vaultViewSiteController', function ($scope, siteService, cipherService) { .controller('vaultViewSiteController', function ($scope, $stateParams, siteService, cipherService) {
$scope.site = null; $scope.site = null;
siteService.get($scope.parentScope.focusedSiteId, function (site) { siteService.get($stateParams.siteId, function (site) {
cipherService.decryptSite(site).then(function (model) { cipherService.decryptSite(site).then(function (model) {
$scope.site = model; $scope.site = model;
}); });
}); });
$scope.editSite = function () {
// TODO
};
$scope.close = function () {
$scope.parentScope.closeViewSite();
};
}); });

View File

@ -9,7 +9,7 @@
<div class="list-divider"> <div class="list-divider">
<i class="fa fa-folder-open"></i> {{folder.name}} <i class="fa fa-folder-open"></i> {{folder.name}}
</div> </div>
<a ng-click="viewSite(site)" class="list-item" ng-repeat="site in folderSites = (sites | filter: { folderId: folder.id } | orderBy: ['name', 'username'])"> <a ui-sref="viewSite({siteId: site.id})" class="list-item" ng-repeat="site in folderSites = (sites | filter: { folderId: folder.id } | orderBy: ['name', 'username'])">
<span class="text">{{site.name}}</span> <span class="text">{{site.name}}</span>
<span class="detail">{{site.username}}</span> <span class="detail">{{site.username}}</span>
<!--<span class="btn btn-link pull-right"><i class="fa fa-ellipsis-h"></i></span>--> <!--<span class="btn btn-link pull-right"><i class="fa fa-ellipsis-h"></i></span>-->

View File

@ -1,6 +1,6 @@
<div class="header"> <div class="header">
<a ng-click="close()" class="left">Close</a> <a ui-sref="tabs.vault" class="left">Close</a>
<a ng-click="editSite()" class="right">Edit</a> <a href="#" class="right">Edit</a>
<div class="title">View Site</div> <div class="title">View Site</div>
</div> </div>
<div class="content"> <div class="content">