1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-14 02:08:50 +02:00

user vault collections changed to show all shared

This commit is contained in:
Kyle Spearrin 2017-04-27 16:24:38 -04:00
parent 54172c441f
commit a083fc9084
16 changed files with 71 additions and 48 deletions

View File

@ -82,11 +82,11 @@ angular
refreshFromServer: false
}
})
.state('backend.user.collections', {
url: '^/collections',
templateUrl: 'app/vault/views/vaultCollections.html',
controller: 'vaultCollectionsController',
data: { pageTitle: 'Collections' }
.state('backend.user.shared', {
url: '^/shared',
templateUrl: 'app/vault/views/vaultShared.html',
controller: 'vaultSharedController',
data: { pageTitle: 'Shared' }
})
.state('backend.user.settings', {
url: '^/settings',

View File

@ -1,7 +1,7 @@
<section class="content-header">
<h1>
Collections
<small>share with your organization</small>
<small>control what you share</small>
</h1>
</section>
<section class="content">

View File

@ -1,6 +1,6 @@
<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"><i class="fa fa-share-alt"></i> Add Collection</h4>
<h4 class="modal-title"><i class="fa fa-cubes"></i> Add Collection</h4>
</div>
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise">
<div class="modal-body">

View File

@ -1,6 +1,6 @@
<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"><i class="fa fa-share-alt"></i> Edit Collection</h4>
<h4 class="modal-title"><i class="fa fa-cubes"></i> Edit Collection</h4>
</div>
<form name="form" ng-submit="form.$valid && submit(collection)" api-form="submitPromise">
<div class="modal-body">

View File

@ -16,7 +16,7 @@
ng-show="collections.length && (!main.searchVaultText || collectionLogins.length)">
<div class="box-header with-border">
<h3 class="box-title">
<i class="fa" ng-class="{'fa-share-alt-square': collection.id, 'fa-sitemap': !collection.id}"></i>
<i class="fa" ng-class="{'fa-cubes': collection.id, 'fa-sitemap': !collection.id}"></i>
{{collection.name}}
<small ng-pluralize count="collectionLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small>
</h3>
@ -48,7 +48,7 @@
</li>
<li>
<a href="javascript:void(0)" ng-click="editCollections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li>

View File

@ -1,6 +1,6 @@
<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"><i class="fa fa-share-alt"></i> Collections <small>{{cipher.name}}</small></h4>
<h4 class="modal-title"><i class="fa fa-cubes"></i> Collections <small>{{cipher.name}}</small></h4>
</div>
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
<div class="modal-body">

View File

@ -252,8 +252,8 @@
$scope.share = function (login) {
var modal = $uibModal.open({
animation: true,
templateUrl: 'app/vault/views/vaultShare.html',
controller: 'vaultShareController',
templateUrl: 'app/vault/views/vaultShareLogin.html',
controller: 'vaultShareLoginController',
resolve: {
loginId: function () { return login.id; }
}

View File

@ -1,9 +1,9 @@
angular
.module('bit.vault')
.controller('vaultShareController', function ($scope, apiService, $uibModalInstance, authService, cipherService,
.controller('vaultShareLoginController', function ($scope, apiService, $uibModalInstance, authService, cipherService,
loginId, $analytics, $state) {
$analytics.eventTrack('vaultShareController', { category: 'Modal' });
$analytics.eventTrack('vaultShareLoginController', { category: 'Modal' });
$scope.model = {};
$scope.login = {};
$scope.collections = [];
@ -11,6 +11,7 @@
$scope.organizations = [];
var organizationCollectionCounts = {};
$scope.loadingCollections = true;
$scope.loading = true;
$scope.readOnly = false;
apiService.logins.get({ id: loginId }).$promise.then(function (login) {
@ -21,6 +22,7 @@
return login.Edit;
}).then(function (canEdit) {
$scope.loading = false;
if (!canEdit) {
return;
}

View File

@ -1,7 +1,7 @@
angular
.module('bit.vault')
.controller('vaultCollectionsController', function ($scope, apiService, cipherService, $analytics, $q, $localStorage,
.controller('vaultSharedController', function ($scope, apiService, cipherService, $analytics, $q, $localStorage,
$uibModal, $filter, $rootScope) {
$scope.logins = [];
$scope.collections = [];
@ -31,6 +31,14 @@
}
}
if (decLogins.length) {
$scope.collections.push({
id: null,
name: 'Unassigned',
collapsed: $localStorage.collapsedCollections && 'unassigned' in $localStorage.collapsedCollections
});
}
$scope.logins = decLogins;
}).$promise;
@ -41,20 +49,34 @@
$scope.filterByCollection = function (collection) {
return function (cipher) {
if (!cipher.collectionIds || !cipher.collectionIds.length) {
return collection.id === null;
}
return cipher.collectionIds.indexOf(collection.id) > -1;
};
};
$scope.collectionSort = function (item) {
if (!item.id) {
return '';
}
return item.name.toLowerCase();
};
$scope.collapseExpand = function (collection) {
if (!$localStorage.collapsedCollections) {
$localStorage.collapsedCollections = {};
}
if (collection.id in $localStorage.collapsedCollections) {
delete $localStorage.collapsedCollections[collection.id];
var id = collection.id || 'unassigned';
if (id in $localStorage.collapsedCollections) {
delete $localStorage.collapsedCollections[id];
}
else {
$localStorage.collapsedCollections[collection.id] = true;
$localStorage.collapsedCollections[id] = true;
}
};

View File

@ -68,7 +68,7 @@
</li>
<li ng-show="login.organizationId">
<a href="javascript:void(0)" ng-click="collections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li>
@ -155,7 +155,7 @@
</li>
<li ng-show="login.organizationId">
<a href="javascript:void(0)" ng-click="collections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li>

View File

@ -1,6 +1,6 @@
<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"><i class="fa fa-share-alt"></i> Collections <small>{{login.name}}</small></h4>
<h4 class="modal-title"><i class="fa fa-cubes"></i> Collections <small>{{login.name}}</small></h4>
</div>
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
<div class="modal-body">

View File

@ -11,14 +11,15 @@
<li ng-repeat="e in form.$errors">{{e}}</li>
</ul>
</div>
<div ng-show="!organizations.length" class="callout callout-default">
<p ng-show="loading">Loading...</p>
<div ng-show="!loading && !organizations.length" class="callout callout-default">
<h4><i class="fa fa-info-circle"></i> No Organizations</h4>
<p>You do not belong to any organizations. Organizations allow you to share logins with other bitwarden users.</p>
<a ng-click="createOrg()" class="btn btn-default btn-flat">
Create an Organization
</a>
</div>
<div ng-show="organizations.length">
<div ng-show="!loading && organizations.length">
<div class="form-group">
<label for="organization">Organization</label> <span>*</span>
<select id="organization" name="Organization" ng-model="model.organizationId" class="form-control"

View File

@ -1,35 +1,32 @@
<section class="content-header">
<h1>
Collections
Shared
<small>
<span ng-pluralize count="collections.length" when="{'1': '{} collection', 'other': '{} collections'}"></span>,
<span ng-pluralize
count="collections.length > 0 && logins.length ? collections.length - 1 : collections.length"
when="{'1': '{} collection', 'other': '{} collections'}"></span>,
<span ng-pluralize count="logins.length" when="{'1': '{} login', 'other': '{} logins'}"></span>
</small>
</h1>
</section>
<section class="content">
<div ng-show="loading && !collections.length">
<p>Loading...</p>
</div>
<div class="callout callout-default" style="background: #fff;" ng-show="!loading && !collections.length">
<h4><i class="fa fa-info-circle"></i> No Collections</h4>
<p ng-show="loading && !collections.length">Loading...</p>
<div class="callout callout-default" style="background: #fff;" ng-show="!loading && !collections.length && !logins.length">
<h4>Nothing shared <i class="fa fa-frown-o"></i></h4>
<p>
You do not have any collections being shared with you.
</p>
<p>
Collections allow you to share logins with other bitwarden users. To start using collections create an organization or
ask an existing organization to invite you.
You do not have any logins or collections being shared with you.
To start sharing, create an organization or ask an existing organization to invite you.
</p>
<a ui-sref="backend.user.settingsCreateOrg" class="btn btn-default btn-flat">
Create an Organization
</a>
</div>
<div class="box" ng-class="{'collapsed-box': collection.collapsed}" ng-repeat="collection in collections |
orderBy: ['name'] track by collection.id"
orderBy: collectionSort track by collection.id"
ng-show="collections.length">
<div class="box-header with-border">
<h3 class="box-title">
<i class="fa fa-share-alt-square"></i>
<i class="fa" ng-class="{'fa-cubes': collection.id, 'fa-sitemap': !collection.id}"></i>
{{collection.name}}
<small ng-pluralize count="collectionLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small>
</h3>
@ -41,13 +38,14 @@
</div>
</div>
<div class="box-body" ng-class="{'no-padding': collectionLogins.length}">
<div ng-show="!collectionLogins.length">
<div ng-show="!collectionLogins.length && collection.id">
<p>No logins in this collection.</p>
<p>
Share a login to this collection by selecting <i class="fa fa-share-alt"></i> <b>Share</b> or
<i class="fa fa-share-alt"></i> <b>Collections</b> from the login's options (<i class="fa fa-cog"></i>) menu.
<i class="fa fa-cubes"></i> <b>Collections</b> from the login's options (<i class="fa fa-cog"></i>) menu.
</p>
</div>
<div ng-show="!collectionLogins.length && !collection.id">No unassigned logins.</div>
<div class="table-responsive" ng-show="collectionLogins.length">
<table class="table table-striped table-hover table-vmiddle">
<tbody>
@ -66,7 +64,7 @@
</li>
<li>
<a href="javascript:void(0)" ng-click="editCollections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections
<i class="fa fa-fw fa-cubes"></i> Collections
</a>
</li>
<li>

View File

@ -58,7 +58,7 @@
</li>
<li ng-class="{active: $state.is('backend.org.collections')}">
<a ui-sref="backend.org.collections({orgId: params.orgId})">
<i class="fa fa-share-alt fa-fw"></i> <span>Collections</span>
<i class="fa fa-cubes fa-fw"></i> <span>Collections</span>
</a>
</li>
<li ng-class="{active: $state.is('backend.org.people')}">

View File

@ -54,11 +54,11 @@
</li>
</ul>
</li>
<li class="treeview" ng-class="{active: $state.is('backend.user.collections')}">
<a ui-sref="backend.user.collections">
<li class="treeview" ng-class="{active: $state.is('backend.user.shared')}">
<a ui-sref="backend.user.shared">
<small class="label pull-right bg-orange">NEW</small>
<i class="fa fa-share-alt fa-fw"></i> <span>Collections</span>
<i class="fa fa-share-alt fa-fw"></i> <span>Shared</span>
</a>
</li>
<li class="treeview" ng-class="{active: $state.is('backend.user.tools')}">
@ -85,7 +85,7 @@
<li ng-class="{active: $state.is('backend.user.apps')}">
<a ui-sref="backend.user.apps">
<small class="label pull-right bg-green">FREE</small>
<i class="fa fa-cubes fa-fw"></i> <span>Get the Apps</span>
<i class="fa fa-download fa-fw"></i> <span>Get the Apps</span>
</a>
</li>
<li>

View File

@ -125,8 +125,8 @@
<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/vault/vaultCollectionsController.js"></script>
<script src="app/vault/vaultShareLoginController.js"></script>
<script src="app/vault/vaultSharedController.js"></script>
<script src="app/vault/vaultLoginCollectionsController.js"></script>
<script src="app/organization/organizationModule.js"></script>