1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-28 22:23:28 +00:00
Files
browser/src/app/organization/organizationCollectionsEditController.js
2017-04-27 09:35:21 -04:00

28 lines
1.2 KiB
JavaScript

angular
.module('bit.organization')
.controller('organizationCollectionsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics, id) {
$analytics.eventTrack('organizationCollectionsEditController', { category: 'Modal' });
$scope.collection = {};
$uibModalInstance.opened.then(function () {
apiService.collections.get({ orgId: $state.params.orgId, id: id }, function (collection) {
$scope.collection = cipherService.decryptCollection(collection);
});
});
$scope.submit = function (model) {
var collection = cipherService.encryptCollection(model, $state.params.orgId);
$scope.submitPromise = apiService.collections.put({ orgId: $state.params.orgId }, collection, function (response) {
$analytics.eventTrack('Edited Collection');
var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true);
$uibModalInstance.close(decCollection);
}).$promise;
};
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});