1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-28 17:27:50 +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) {
var editModel = $uibModal.open({
animation: true,
@ -482,7 +515,7 @@
return;
}
$scope.bulkActionLoading = true;
$scope.actionLoading = true;
apiService.ciphers.delMany({ ids: ids }, function () {
$analytics.eventTrack('Bulk Deleted Items');
@ -494,12 +527,12 @@
}
selectAll(false);
$scope.bulkActionLoading = false;
$scope.actionLoading = false;
toastr.success('Items have been deleted!');
}, function (e) {
var errors = validationService.parseErrors(e);
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">
<div class="btn-group pull-right">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown"
ng-disabled="bulkActionLoading">
<i class="fa fa-refresh fa-spin" ng-show="bulkActionLoading"></i>
Bulk Actions <span class="caret"></span>
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown" ng-disabled="actionLoading">
<i class="fa fa-refresh fa-spin" ng-show="actionLoading"></i>
Actions <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
@ -19,7 +18,17 @@
<li role="separator" class="divider"></li>
<li>
<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>
</li>
</ul>
@ -139,7 +148,8 @@
<div class="box" ng-class="{'collapsed-box': grouping.collapsed}"
ng-repeat="grouping in filteredVaultGroupings = (vaultGroupings | filter: groupingFilter) track by grouping.id"
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">
<h3 class="box-title">
<i class="fa" ng-if="grouping.folder"