modal UI for sharing folders/logins from vault

This commit is contained in:
Kyle Spearrin 2017-02-25 22:38:30 -05:00
parent 642b35582f
commit afaaf7d73a
5 changed files with 75 additions and 1 deletions

View File

@ -181,4 +181,29 @@
var logins = $filter('filter')($scope.logins, { folderId: folder.id });
return logins.length === 0;
};
$scope.shareLogin = function (login) {
share(login.id, login.name, false);
};
$scope.shareFolder = function (folder) {
share(folder.id, folder.name, true);
};
function share(id, name, isFolder) {
var shareModel = $uibModal.open({
animation: true,
templateUrl: 'app/vault/views/vaultShare.html',
controller: 'vaultShareController',
resolve: {
id: function () { return id; },
name: function () { return name; },
isFolder: function () { return isFolder; }
}
});
shareModel.result.then(function (result) {
});
}
});

View File

@ -0,0 +1,21 @@
angular
.module('bit.vault')
.controller('vaultShareController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService,
id, name, isFolder, $analytics) {
$analytics.eventTrack('vaultShareController', { category: 'Modal' });
$scope.cipher = {
id: id,
name: name,
isFolder: isFolder
};
$scope.savePromise = null;
$scope.save = function (model) {
$uibModalInstance.close({});
};
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});

View File

@ -16,7 +16,8 @@
{{folder.name}} <small>{{folderLogins.length}} logins</small>
</h3>
<div class="box-tools">
<button type="button" class="btn btn-box-tool" uib-tooltip="Share" ng-show="folder.id">
<button type="button" ng-click="shareFolder(folder)" class="btn btn-box-tool" uib-tooltip="Share"
ng-show="folder.id">
<i class="fa fa-user-plus"></i>
</button>
<div class="btn-group">

View File

@ -0,0 +1,26 @@
<div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="editFolderModelLabel">
<i class="fa fa-user-plus"></i>
<span ng-if="!cipher.isFolder">Share Login</span>
<span ng-if="cipher.isFolder">Share Folder</span>
<small>{{cipher.name}}</small>
</h4>
</div>
<form name="shareForm" ng-submit="shareForm.$valid && save(folder)" api-form="savePromise">
<div class="modal-body">
<div class="callout callout-danger validation-errors" ng-show="shareForm.$errors">
<h4>Errors have occured</h4>
<ul>
<li ng-repeat="e in shareForm.$errors">{{e}}</li>
</ul>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="shareForm.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="shareForm.$loading"></i>Share
</button>
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
</div>
</form>

View File

@ -115,6 +115,7 @@
<script src="app/vault/vaultAddLoginController.js"></script>
<script src="app/vault/vaultEditFolderController.js"></script>
<script src="app/vault/vaultAddFolderController.js"></script>
<script src="app/vault/vaultShareController.js"></script>
<script src="app/shared/sharedModule.js"></script>
<script src="app/shared/sharedController.js"></script>