gui: Reset ignore input field when adding remote share (fixes #4203)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4204
LGTM: AudriusButkevicius, calmh
This commit is contained in:
Simon Frei 2017-06-09 05:41:19 +00:00 committed by Jakob Borg
parent d637148cca
commit 9c4175715a

View File

@ -1369,6 +1369,13 @@ angular.module('syncthing.core')
$('#globalChanges').modal(); $('#globalChanges').modal();
}; };
$scope.editFolderModal() = function () {
$scope.folderPathErrors = {};
$scope.folderEditor.$setPristine();
$('#editIgnores textarea').val("");
$('#editFolder').modal();
};
$scope.editFolder = function (folderCfg) { $scope.editFolder = function (folderCfg) {
$scope.currentFolder = angular.copy(folderCfg); $scope.currentFolder = angular.copy(folderCfg);
if ($scope.currentFolder.path.slice(-1) === $scope.system.pathSeparator) { if ($scope.currentFolder.path.slice(-1) === $scope.system.pathSeparator) {
@ -1413,20 +1420,15 @@ angular.module('syncthing.core')
$scope.currentFolder.externalCommand = $scope.currentFolder.externalCommand || ""; $scope.currentFolder.externalCommand = $scope.currentFolder.externalCommand || "";
$scope.editingExisting = true; $scope.editingExisting = true;
$scope.folderPathErrors = {}; $scope.editFolderModal();
$scope.folderEditor.$setPristine();
$('#editFolder').modal();
}; };
$scope.addFolder = function () { $scope.addFolder = function () {
$scope.currentFolder = angular.copy($scope.folderDefaults);
$scope.editingExisting = false;
$('#editIgnores textarea').val("");
$scope.folderPathErrors = {};
$scope.folderEditor.$setPristine();
$http.get(urlbase + '/svc/random/string?length=10').success(function (data) { $http.get(urlbase + '/svc/random/string?length=10').success(function (data) {
$scope.currentFolder = angular.copy($scope.folderDefaults);
$scope.currentFolder.id = (data.random.substr(0, 5) + '-' + data.random.substr(5, 5)).toLowerCase(); $scope.currentFolder.id = (data.random.substr(0, 5) + '-' + data.random.substr(5, 5)).toLowerCase();
$('#editFolder').modal(); $scope.editingExisting = false;
$scope.editFolderModal();
}); });
}; };
@ -1441,9 +1443,7 @@ angular.module('syncthing.core')
$scope.currentFolder.selectedDevices[device] = true; $scope.currentFolder.selectedDevices[device] = true;
$scope.editingExisting = false; $scope.editingExisting = false;
$scope.folderPathErrors = {}; $scope.editFolderModal();
$scope.folderEditor.$setPristine();
$('#editFolder').modal();
}; };
$scope.shareFolderWithDevice = function (folder, device) { $scope.shareFolderWithDevice = function (folder, device) {