1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

load add fields with current tab info

This commit is contained in:
Kyle Spearrin
2016-09-14 22:44:04 -04:00
parent 0a201ef887
commit 6bb8b28517
4 changed files with 40 additions and 12 deletions

View File

@@ -4,12 +4,20 @@
.controller('vaultAddSiteController', function ($scope, $state, $stateParams, siteService, folderService, cipherService, $q) {
var returnScrollY = $stateParams.returnScrollY;
var returnSearchText = $stateParams.returnSearchText;
var fromCurrent = $stateParams.uri !== null;
$scope.site = {
folderId: null
folderId: null,
name: $stateParams.name,
uri: $stateParams.uri
};
$('#name').focus();
if ($scope.site.name && $scope.site.uri) {
$('#username').focus();
}
else {
$('#name').focus();
}
popupUtils.initListSectionItemListeners();
var promises = [];
@@ -50,11 +58,18 @@
};
$scope.close = function () {
$state.go('tabs.vault', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
searchText: returnSearchText
});
if (fromCurrent) {
$state.go('tabs.current', {
animation: 'out-slide-down'
});
}
else {
$state.go('tabs.vault', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
searchText: returnSearchText
});
}
};
function saveSite(site) {