Compare commits

...
3 Commits
Author SHA1 Message Date
André ColombandJakob Borg b16cc72fc7 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.
2020-11-27 14:33:58 +01:00
Simon FreiandJakob Borg dcddd9c1e4 gui: Remove erronous $ from scope in directive (fixes #7124) (#7125) 2020-11-18 14:22:38 +01:00
Simon FreiandJakob Borg 35c813f56f gui: Initialise sharing when accepting new device (fixes #7113) (#7114) 2020-11-11 18:18:52 +01:00
4 changed files with 12 additions and 3 deletions
@@ -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++) {
@@ -1455,6 +1462,7 @@ angular.module('syncthing.core')
ignoredFolders: []
};
$scope.editingExisting = false;
initShareEditing('device');
$scope.deviceEditor.$setPristine();
$('#editDevice').modal();
});
@@ -16,7 +16,7 @@ angular.module('syncthing.core')
}
});
//Prevents user from adding a duplicate ID
if ($scope.devices.hasOwnProperty(viewValue)) {
if (scope.devices.hasOwnProperty(viewValue)) {
ctrl.$setValidity('unique', false);
} else {
ctrl.$setValidity('unique', true);
@@ -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()">
@@ -1475,6 +1475,7 @@ angular.module('syncthing.core')
ignoredFolders: []
};
$scope.editingExisting = false;
initShareEditing('device');
$scope.deviceEditor.$setPristine();
$('#editDevice').modal();
});