Browse Source

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

This fixes a regression by restoring two functions removed in commit
a20d85d451fcce63d94b6d8c40de65d4db3c7bd9, 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.
André Colomb 5 years ago
parent
commit
ab53687c38

+ 7 - 0
gui/default/syncthing/core/syncthingController.js

@@ -1438,6 +1438,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++) {

+ 2 - 2
gui/default/syncthing/device/editDeviceModalView.html

@@ -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()">