gui: Restore Select / Deselect All buttons in device sharing tab. (#7161)

This fixes a regression by restoring two functions removed in commit
a20d85d451, but still used from the HTML
template.  Adjust the restored versions to access the new flag storage
structure.

The replacement functions selectAllSharedFolders() and
selectAllUnrelatedFolders() are not functional, so this is just a
quick fix to restore a working state before making the new functions
actually work sensibly.

Just like the respective functions for sharing device selections, give
it a boolean argument instead of writing two almost identical
functions.

In line with the other selectAll...() functions, avoid calling
angular.forEach() and iterate over the folders object directly.
This commit is contained in:
André Colomb 2020-11-27 11:48:48 +01:00 committed by Jakob Borg
parent dcddd9c1e4
commit b16cc72fc7
2 changed files with 9 additions and 2 deletions

View File

@ -1416,6 +1416,13 @@ angular.module('syncthing.core')
$('#editDevice').modal();
};
$scope.selectAllFolders = function (state) {
var folders = $scope.folders;
for (var id in folders) {
$scope.currentSharing.selected[id] = !!state;
};
};
$scope.selectAllSharedFolders = function (state) {
var devices = $scope.currentSharing.shared;
for (var i = 0; i < devices.length; i++) {

View File

@ -69,8 +69,8 @@
<label translate for="folders">Share Folders With Device</label>
<p class="help-block">
<span translate>Select the folders to share with this device.</span>&emsp;
<small><a href="#" ng-click="selectAllFolders()" translate>Select All</a>&emsp;
<a href="#" ng-click="deSelectAllFolders()" translate>Deselect All</a></small>
<small><a href="#" ng-click="selectAllFolders(true)" translate>Select All</a>&emsp;
<a href="#" ng-click="selectAllFolders(false)" translate>Deselect All</a></small>
</p>
<div class="row">
<div class="col-md-4" ng-repeat="folder in folderList()">