from state passed around

This commit is contained in:
Kyle Spearrin 2016-12-07 00:07:01 -05:00
parent 4476eb7389
commit d16b9920ec
8 changed files with 34 additions and 19 deletions

View File

@ -93,14 +93,14 @@
templateUrl: 'app/vault/views/vaultViewFolder.html',
controller: 'vaultViewFolderController',
data: { authorize: true },
params: { animation: null, returnScrollY: 0, returnSearchText: null, fromCurrent: false }
params: { animation: null, returnScrollY: 0, returnSearchText: null, from: 'vault' }
})
.state('viewSite', {
url: '/view-site?siteId',
templateUrl: 'app/vault/views/vaultViewSite.html',
controller: 'vaultViewSiteController',
data: { authorize: true },
params: { animation: null, returnScrollY: 0, returnSearchText: null, fromCurrent: false }
params: { animation: null, returnScrollY: 0, returnSearchText: null, from: 'vault' }
})
.state('addSite', {
url: '/add-site',
@ -109,7 +109,7 @@
data: { authorize: true },
params: {
animation: null, returnScrollY: 0, returnSearchText: null, name: null,
uri: null, site: null, fromCurrent: false
uri: null, site: null, from: 'vault'
}
})
.state('editSite', {
@ -119,7 +119,7 @@
data: { authorize: true },
params: {
animation: null, fromView: true, returnScrollY: 0,
returnSearchText: null, site: null, fromCurrent: false
returnSearchText: null, site: null, from: 'vault'
}
})

View File

@ -104,7 +104,7 @@ angular
$state.go('viewSite', {
siteId: site.id,
animation: 'in-slide-up',
fromCurrent: true
from: 'current'
});
};

View File

@ -93,7 +93,7 @@
if (addState) {
$state.go('addSite', {
animation: 'out-slide-down',
fromCurrent: addState.fromCurrent,
from: addState.from,
site: addState.site,
returnScrollY: addState.returnScrollY,
returnSearchText: addState.returnSearchText

View File

@ -6,7 +6,7 @@
$scope.i18n = i18nService;
var returnScrollY = $stateParams.returnScrollY;
var returnSearchText = $stateParams.returnSearchText;
var fromCurrent = $stateParams.fromCurrent || $stateParams.uri !== null;
var fromCurrent = $stateParams.from;
$scope.site = {
folderId: null,
@ -48,12 +48,19 @@
};
$scope.close = function () {
if (fromCurrent) {
if (from === 'current') {
$state.go('tabs.current', {
animation: 'out-slide-down'
});
}
else {
else if (from === 'folder') {
$state.go('viewFolder', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
searchText: returnSearchText
});
}
else if(from === 'vault') {
$state.go('tabs.vault', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
@ -67,7 +74,7 @@
$state.go('passwordGenerator', {
animation: 'in-slide-up',
addState: {
fromCurrent: fromCurrent,
from: from,
site: $scope.site,
returnScrollY: returnScrollY,
returnSearchText: returnSearchText

View File

@ -8,7 +8,7 @@ angular
var returnSearchText = $stateParams.returnSearchText;
var siteId = $stateParams.siteId;
var fromView = $stateParams.fromView;
var fromCurrent = $stateParams.fromCurrent;
var from = $stateParams.from;
$scope.site = {
folderId: null
@ -75,7 +75,7 @@ angular
animation: 'out-slide-down',
returnScrollY: returnScrollY || 0,
returnSearchText: returnSearchText,
fromCurrent: fromCurrent
from: from
});
}
else {

View File

@ -86,7 +86,8 @@
$state.go('addSite', {
animation: 'in-slide-up',
returnScrollY: getScrollY(),
returnSearchText: $scope.searchText
returnSearchText: $scope.searchText,
from: 'folder'
});
};
@ -95,7 +96,8 @@
siteId: site.id,
animation: 'in-slide-up',
returnScrollY: getScrollY(),
returnSearchText: $scope.searchText
returnSearchText: $scope.searchText,
from: 'folder'
});
};

View File

@ -6,7 +6,7 @@ angular
$scope.i18n = i18nService;
var returnScrollY = $stateParams.returnScrollY;
var returnSearchText = $stateParams.returnSearchText;
var fromCurrent = $stateParams.fromCurrent;
var from = $stateParams.from;
$scope.site = null;
siteService.get($stateParams.siteId, function (site) {
@ -49,16 +49,23 @@ angular
fromView: true,
returnScrollY: returnScrollY || 0,
returnSearchText: returnSearchText,
fromCurrent: fromCurrent
from: from
});
};
$scope.close = function () {
if (fromCurrent) {
if (from === 'current') {
$state.go('tabs.current', {
animation: 'out-slide-down'
});
}
else if (from === 'folder') {
$state.go('viewFolder', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
searchText: returnSearchText
});
}
else {
$state.go('tabs.vault', {
animation: 'out-slide-down',

View File

@ -19,8 +19,7 @@
</div>
<a href="javascript:void(0)" ng-click="viewSite(site)"
class="list-section-item condensed" title="{{i18n.edit}} {{site.name}}"
ng-repeat="site in vaultSites | filter: { folderId: folder.id }
| filter: searchSites() | orderBy: ['name', 'username']">
ng-repeat="site in vaultSites | filter: searchSites() | orderBy: ['name', 'username']">
<span class="btn-list" ng-click="$event.stopPropagation()" title="{{i18n.copyPassword}}" ngclipboard
ngclipboard-error="clipboardError(e)" ngclipboard-success="clipboardSuccess(e, i18n.password)"
data-clipboard-text="{{site.password}}" ng-class="{'disabled': !site.password}">