diff options
author | fnuesse <felix.nuesse@t-online.de> | 2019-01-03 17:41:52 +0300 |
---|---|---|
committer | fnuesse <felix.nuesse@t-online.de> | 2019-01-03 17:41:52 +0300 |
commit | 7db9c360f11b9800516cf2833b9d3a0106a79901 (patch) | |
tree | 7aaa5308e98801c9040c44bb0b12653c2baa574d | |
parent | 27d6fe83bfe2d0dca06ae76c1dc42eaaff812f89 (diff) |
Fully implemented edit_credential folderhandlingfeature/noid/folder
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
-rw-r--r-- | controller/translationcontroller.php | 1 | ||||
-rw-r--r-- | js/app/controllers/credential.js | 3 | ||||
-rw-r--r-- | js/app/controllers/edit_credential.js | 28 | ||||
-rw-r--r-- | js/app/services/folderservice.js | 25 | ||||
-rw-r--r-- | templates/views/edit_credential.html | 8 | ||||
-rw-r--r-- | templates/views/partials/forms/edit_credential/basics.html | 2 |
6 files changed, 49 insertions, 18 deletions
diff --git a/controller/translationcontroller.php b/controller/translationcontroller.php index aad1e6cf..fd28bfc4 100644 --- a/controller/translationcontroller.php +++ b/controller/translationcontroller.php @@ -425,6 +425,7 @@ class TranslationController extends ApiController { //template/views/partials/folder-picker 'folderpath.credential' => $this->trans->t('Credential to move'), 'folderpath.move' => $this->trans->t('Move'), + 'folderpath.moved' => $this->trans->t('Moved credential!'), 'folderpath.cancel' => $this->trans->t('Cancel'), 'folderpath.newfolder' => $this->trans->t('New Folder'), 'folderpath.createnewhint' => $this->trans->t('New...'), diff --git a/js/app/controllers/credential.js b/js/app/controllers/credential.js index b6d9b63e..69ae3a0c 100644 --- a/js/app/controllers/credential.js +++ b/js/app/controllers/credential.js @@ -105,6 +105,7 @@ angular.merge($scope.active_vault.credentials, _credentials); $scope.show_spinner = false; FolderService.expandWithFolder($scope, $scope.active_vault.credentials); + FolderService.initializeInCredentialJs(); $rootScope.$broadcast('credentials_loaded'); $rootScope.vaultCache[$scope.active_vault.guid] = angular.copy($scope.active_vault); if(!vault.private_sharing_key){ @@ -236,6 +237,8 @@ var _credential = angular.copy(credential); $rootScope.$emit('app_menu', false); SettingsService.setSetting('edit_credential', CredentialService.encryptCredential(_credential)); + + FolderService.setList($scope.active_vault.credentials); $location.path('/vault/' + $scope.active_vault.guid + '/edit/' + _credential.guid); }; diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js index a119fbb7..676239ae 100644 --- a/js/app/controllers/edit_credential.js +++ b/js/app/controllers/edit_credential.js @@ -36,9 +36,23 @@ function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, $translate, $rootScope, FolderService) { - $scope.FolderList=[]; + //folderhandling + $scope.FolderList=[]; + $scope.FullCredentialList=FolderService.getList(); + + FolderService.expandWithFolder($scope, $scope.FullCredentialList); + console.log("edit_cred.js"); + console.log(FolderService.getList()); + $scope.buildFolderList(true); + $scope.getCurrentFolderList(); + $scope.createBreadCrumbList(); + + $scope.openFolderPicker = function () { + $( '#folderPicker-ButtonDiv' ).click(); + }; + + $scope.active_vault = VaultService.getActiveVault(); - $scope.active_vault = VaultService.getActiveVault(); if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) { if (!$scope.active_vault) { $location.path('/'); @@ -50,6 +64,7 @@ _vault.vaultKey = SettingsService.getSetting('defaultVaultPass'); VaultService.setActiveVault(_vault); $scope.active_vault = _vault; + FolderService.isInitialized($scope); } } @@ -71,15 +86,6 @@ }); }); - VaultService.getVault($scope.active_vault).then(function (vault) { - console.log(vault.credentials) - FolderService.expandWithFolder($scope, vault.credentials); - $scope.buildFolderList(true); - $scope.getCurrentFolderList(); - $scope.createBreadCrumbList(); - }); - - $scope.currentTab = { title: $translate.instant('general'), url: 'views/partials/forms/edit_credential/basics.html', diff --git a/js/app/services/folderservice.js b/js/app/services/folderservice.js index 95bbfd56..8c1c20b2 100644 --- a/js/app/services/folderservice.js +++ b/js/app/services/folderservice.js @@ -30,8 +30,29 @@ * Service in the passmanApp. */ angular.module('passmanApp') - .service('FolderService', [function () { + .service('FolderService', ['$location', function ($location) { + + //takes load of edit_credentials, because the list is not available there + var decrypted_credential_list = {}; + var initializedByCredentialjs = false; + return { + + initializeInCredentialJs: function () { + initializedByCredentialjs=true; + }, + isInitialized: function (scope) { + if(!initializedByCredentialjs){ + $location.path('/vault/' + scope.active_vault.guid + '/'); + } + }, + setList: function (list) { + decrypted_credential_list=list; + }, + getList: function () { + return decrypted_credential_list; + }, + expandWithFolder: function ($scope, CredentialList) { $scope.currentFolder = "/"; @@ -48,7 +69,7 @@ angular.module('passmanApp') for (var i = 0; i < CredentialList.length; i++) { var _credential = CredentialList[i]; - if (_credential.folderpath !== null) { + if (_credential.folderpath !== null && typeof _credential.folderpath !== 'undefined') { while(_credential.folderpath.includes('//')){ _credential.folderpath=_credential.folderpath.replace("//", "/"); } diff --git a/templates/views/edit_credential.html b/templates/views/edit_credential.html index 04b4078f..c7dc2a41 100644 --- a/templates/views/edit_credential.html +++ b/templates/views/edit_credential.html @@ -16,12 +16,12 @@ </div> <div class="addCredential"> - <button folder-picker="storedCredential" - folder="FolderList" - > + <button ng-click="openFolderPicker();"> + {{ 'folderpath.move' | translate}} </button> - </div> + <div id="folderPicker-ButtonDiv" folder-picker="storedCredential" + credentiallist="FullCredentialList"></div> </div> </div> <div> diff --git a/templates/views/partials/forms/edit_credential/basics.html b/templates/views/partials/forms/edit_credential/basics.html index 73d55113..0d54d657 100644 --- a/templates/views/partials/forms/edit_credential/basics.html +++ b/templates/views/partials/forms/edit_credential/basics.html @@ -35,7 +35,7 @@ </div> <label>{{ 'folderpath' | translate}}</label> <div> - <input type="text" ng-model="storedCredential.folderpath"> + <input type="text" ng-model="storedCredential.folderpath" readonly> </div> <label>{{ 'add.tag' | translate}}</label> <div class="tags_input"> |