gui: Select / Deselect all folders / devices (#fixes 4000) (#5307)

This commit is contained in:
BAHADIR YILMAZ 2018-11-07 11:44:52 +03:00 committed by Jakob Borg
parent e67be59c5f
commit f51514d0e7
3 changed files with 38 additions and 2 deletions

View File

@ -1371,6 +1371,20 @@ angular.module('syncthing.core')
$('#editDevice').modal(); $('#editDevice').modal();
}; };
$scope.selectAllFolders = function() {
Object.entries($scope.folders).forEach(entry =>{
let id = entry[1].id;
$scope.currentDevice.selectedFolders[id] = true;
});
};
$scope.deSelectAllFolders = function() {
Object.entries($scope.folders).forEach(entry =>{
let id = entry[1].id;
$scope.currentDevice.selectedFolders[id] = false;
});
};
$scope.addDevice = function (deviceID, name) { $scope.addDevice = function (deviceID, name) {
return $http.get(urlbase + '/system/discovery') return $http.get(urlbase + '/system/discovery')
.success(function (registry) { .success(function (registry) {
@ -1694,6 +1708,20 @@ angular.module('syncthing.core')
$scope.editFolderModal(); $scope.editFolderModal();
}; };
$scope.selectAllDevices = function() {
var devices = $scope.otherDevices();
for (var i = 0; i < devices.length; i++){
$scope.currentFolder.selectedDevices[devices[i].deviceID] = true;
}
};
$scope.deSelectAllDevices = function() {
var devices = $scope.otherDevices();
for (var i = 0; i < devices.length; i++){
$scope.currentFolder.selectedDevices[devices[i].deviceID] = false;
}
};
$scope.addFolder = function () { $scope.addFolder = function () {
$http.get(urlbase + '/svc/random/string?length=10').success(function (data) { $http.get(urlbase + '/svc/random/string?length=10').success(function (data) {
$scope.editingExisting = false; $scope.editingExisting = false;

View File

@ -67,7 +67,11 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label translate for="folders">Share Folders With Device</label> <label translate for="folders">Share Folders With Device</label>
<p translate class="help-block">Select the folders to share with this device.</p> <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>
</p>
<div class="row"> <div class="row">
<div class="col-md-4" ng-repeat="folder in folderList()"> <div class="col-md-4" ng-repeat="folder in folderList()">
<div class="checkbox"> <div class="checkbox">

View File

@ -42,7 +42,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label translate for="devices">Share With Devices</label> <label translate for="devices">Share With Devices</label>
<p translate class="help-block">Select the devices to share this folder with.</p> <p class="help-block">
<span translate>Select the devices to share this folder with.</span>&emsp;
<small><a href="#" ng-click="selectAllDevices()" translate>Select All</a>&emsp;
<a href="#" ng-click="deSelectAllDevices()" translate>Deselect All</a></small>
</p>
<div class="row"> <div class="row">
<div class="col-md-4" ng-repeat="device in otherDevices()"> <div class="col-md-4" ng-repeat="device in otherDevices()">
<div class="checkbox"> <div class="checkbox">