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",
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) {

View File

@ -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', {

View File

@ -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();
};
});

View File

@ -9,7 +9,7 @@
<div class="list-divider">
<i class="fa fa-folder-open"></i> {{folder.name}}
</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="detail">{{site.username}}</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">
<a ng-click="close()" class="left">Close</a>
<a ng-click="editSite()" class="right">Edit</a>
<a ui-sref="tabs.vault" class="left">Close</a>
<a href="#" class="right">Edit</a>
<div class="title">View Site</div>
</div>
<div class="content">