mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
modal UI for sharing folders/logins from vault
This commit is contained in:
parent
642b35582f
commit
afaaf7d73a
@ -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) {
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
21
src/app/vault/vaultShareController.js
Normal file
21
src/app/vault/vaultShareController.js
Normal 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');
|
||||
};
|
||||
});
|
@ -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">
|
||||
|
26
src/app/vault/views/vaultShare.html
Normal file
26
src/app/vault/views/vaultShare.html
Normal file
@ -0,0 +1,26 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</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>
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user