1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-09 09:51:02 +01:00

expand/collapse all boxes

This commit is contained in:
Kyle Spearrin 2017-11-29 22:43:58 -05:00
parent b8a425f530
commit 62e1dbb642
2 changed files with 52 additions and 9 deletions

View File

@ -161,6 +161,39 @@
} }
}; };
$scope.collapseAll = function () {
$localStorage.collapsedFolders.none = true;
$localStorage.collapsedFolders.favorite = true;
if (!$rootScope.vaultGroupings) {
return;
}
for (var i = 0; i < $rootScope.vaultGroupings.length; i++) {
$localStorage.collapsedFolders[$rootScope.vaultGroupings[i].id] = true;
}
$('.box').addClass('collapsed-box');
$('.box .box-header button i.fa-minus').removeClass('fa-minus').addClass('fa-plus');
};
$scope.expandAll = function () {
delete $localStorage.collapsedFolders.none;
delete $localStorage.collapsedFolders.favorite;
if (!$rootScope.vaultGroupings) {
return;
}
for (var i = 0; i < $rootScope.vaultGroupings.length; i++) {
delete $localStorage.collapsedFolders[$rootScope.vaultGroupings[i].id];
}
$('.box').removeClass('collapsed-box');
$('.box-body').show();
$('.box .box-header button i.fa-plus').removeClass('fa-plus').addClass('fa-minus');
};
$scope.editCipher = function (cipher) { $scope.editCipher = function (cipher) {
var editModel = $uibModal.open({ var editModel = $uibModal.open({
animation: true, animation: true,
@ -482,7 +515,7 @@
return; return;
} }
$scope.bulkActionLoading = true; $scope.actionLoading = true;
apiService.ciphers.delMany({ ids: ids }, function () { apiService.ciphers.delMany({ ids: ids }, function () {
$analytics.eventTrack('Bulk Deleted Items'); $analytics.eventTrack('Bulk Deleted Items');
@ -494,12 +527,12 @@
} }
selectAll(false); selectAll(false);
$scope.bulkActionLoading = false; $scope.actionLoading = false;
toastr.success('Items have been deleted!'); toastr.success('Items have been deleted!');
}, function (e) { }, function (e) {
var errors = validationService.parseErrors(e); var errors = validationService.parseErrors(e);
toastr.error(errors.length ? errors[0] : 'An error occurred.'); toastr.error(errors.length ? errors[0] : 'An error occurred.');
$scope.bulkActionLoading = false; $scope.actionLoading = false;
}); });
}; };

View File

@ -1,9 +1,8 @@
<section class="content-header"> <section class="content-header">
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown" <button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown" ng-disabled="actionLoading">
ng-disabled="bulkActionLoading"> <i class="fa fa-refresh fa-spin" ng-show="actionLoading"></i>
<i class="fa fa-refresh fa-spin" ng-show="bulkActionLoading"></i> Actions <span class="caret"></span>
Bulk Actions <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
@ -19,7 +18,17 @@
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>
<li> <li>
<a href="#" stop-click ng-click="unselectAll()"> <a href="#" stop-click ng-click="unselectAll()">
<i class="fa fa-fw fa-minus-square-o"></i> Unselect All <i class="fa fa-fw fa-minus-circle"></i> Unselect All
</a>
</li>
<li>
<a href="#" stop-click ng-click="collapseAll()">
<i class="fa fa-fw fa-minus-square-o"></i> Collapse All
</a>
</li>
<li>
<a href="#" stop-click ng-click="expandAll()">
<i class="fa fa-fw fa-plus-square-o"></i> Expand All
</a> </a>
</li> </li>
</ul> </ul>
@ -139,7 +148,8 @@
<div class="box" ng-class="{'collapsed-box': grouping.collapsed}" <div class="box" ng-class="{'collapsed-box': grouping.collapsed}"
ng-repeat="grouping in filteredVaultGroupings = (vaultGroupings | filter: groupingFilter) track by grouping.id" ng-repeat="grouping in filteredVaultGroupings = (vaultGroupings | filter: groupingFilter) track by grouping.id"
ng-show="vaultGroupings.length && (!main.searchVaultText || groupingCiphers.length)" ng-show="vaultGroupings.length && (!main.searchVaultText || groupingCiphers.length)"
ng-style="firstCollectionId && grouping.id === firstCollectionId && {'margin-top': '40px'}"> ng-style="firstCollectionId && grouping.id === firstCollectionId &&
groupingIdFilter !== grouping.id && {'margin-top': '40px'}">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"> <h3 class="box-title">
<i class="fa" ng-if="grouping.folder" <i class="fa" ng-if="grouping.folder"