mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-18 10:55:48 +01:00
load folder dropdowns for site add/edit forms
This commit is contained in:
parent
9ebec2a1bc
commit
1069b51266
@ -1,7 +1,7 @@
|
||||
angular
|
||||
.module('bit.vault')
|
||||
|
||||
.controller('vaultAddSiteController', function ($scope, $state, siteService, cipherService, $q) {
|
||||
.controller('vaultAddSiteController', function ($scope, $state, siteService, folderService, cipherService, $q) {
|
||||
$scope.site = {
|
||||
folderId: null
|
||||
};
|
||||
@ -9,6 +9,30 @@
|
||||
$('#name').focus();
|
||||
popupUtils.initListSectionItemListeners();
|
||||
|
||||
var promises = [];
|
||||
var decFolders = [{
|
||||
id: null,
|
||||
name: '(none)'
|
||||
}];
|
||||
|
||||
folderService.getAll(function (folders) {
|
||||
for (var i = 1; i < folders.length; i++) {
|
||||
decFolders.push({
|
||||
id: folders[i].id
|
||||
});
|
||||
|
||||
var folderNamePromise = cipherService.decrypt(folders[i].name, i);
|
||||
promises.push(folderNamePromise);
|
||||
folderNamePromise.then(function (obj) {
|
||||
decFolders[obj.index].name = obj.val;
|
||||
});
|
||||
}
|
||||
|
||||
$q.all(promises).then(function () {
|
||||
$scope.folders = decFolders;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.savePromise = null;
|
||||
$scope.save = function (model) {
|
||||
$scope.savePromise = cipherService.encryptSite(model).then(function (siteModel) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
angular
|
||||
.module('bit.vault')
|
||||
|
||||
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, cipherService, $q) {
|
||||
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, folderService, cipherService, $q) {
|
||||
$scope.site = {
|
||||
folderId: null
|
||||
};
|
||||
@ -12,6 +12,30 @@
|
||||
});
|
||||
});
|
||||
|
||||
var promises = [];
|
||||
var decFolders = [{
|
||||
id: null,
|
||||
name: '(none)'
|
||||
}];
|
||||
|
||||
folderService.getAll(function (folders) {
|
||||
for (var i = 1; i < folders.length; i++) {
|
||||
decFolders.push({
|
||||
id: folders[i].id
|
||||
});
|
||||
|
||||
var folderNamePromise = cipherService.decrypt(folders[i].name, i);
|
||||
promises.push(folderNamePromise);
|
||||
folderNamePromise.then(function (obj) {
|
||||
decFolders[obj.index].name = obj.val;
|
||||
});
|
||||
}
|
||||
|
||||
$q.all(promises).then(function () {
|
||||
$scope.folders = decFolders;
|
||||
});
|
||||
});
|
||||
|
||||
popupUtils.initListSectionItemListeners();
|
||||
|
||||
$scope.savePromise = null;
|
||||
|
@ -42,10 +42,8 @@
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item">
|
||||
<label for="folder">Folder</label>
|
||||
<select id="folder" name="FolderId">
|
||||
<option>Blue</option>
|
||||
<option selected>Green</option>
|
||||
<option>Red</option>
|
||||
<select id="folder" name="FolderId" ng-model="site.folderId" bit-field>
|
||||
<option ng-repeat="folder in folders" value="{{folder.id}}">{{folder.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="list-section-item list-section-item-checkbox">
|
||||
|
@ -42,10 +42,8 @@
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item">
|
||||
<label for="folder">Folder</label>
|
||||
<select id="folder" name="FolderId">
|
||||
<option>Blue</option>
|
||||
<option selected>Green</option>
|
||||
<option>Red</option>
|
||||
<select id="folder" name="FolderId" ng-model="site.folderId" bit-field>
|
||||
<option ng-repeat="folder in folders" value="{{folder.id}}">{{folder.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="list-section-item list-section-item-checkbox">
|
||||
|
Loading…
Reference in New Issue
Block a user