diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go
index b276fe79..ca431e6b 100644
--- a/cmd/syncthing/gui.go
+++ b/cmd/syncthing/gui.go
@@ -969,7 +969,9 @@ func (s *apiService) getRandomString(w http.ResponseWriter, r *http.Request) {
func (s *apiService) getDBIgnores(w http.ResponseWriter, r *http.Request) {
qs := r.URL.Query()
- ignores, patterns, err := s.model.GetIgnores(qs.Get("folder"))
+ folder := qs.Get("folder")
+
+ ignores, patterns, err := s.model.GetIgnores(folder)
if err != nil {
http.Error(w, err.Error(), 500)
return
diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json
index 26db4838..24d54112 100644
--- a/gui/default/assets/lang/lang-en.json
+++ b/gui/default/assets/lang/lang-en.json
@@ -43,6 +43,7 @@
"Copied from original": "Copied from original",
"Copyright © 2014-2016 the following Contributors:": "Copyright © 2014-2016 the following Contributors:",
"Copyright © 2014-2017 the following Contributors:": "Copyright © 2014-2017 the following Contributors:",
+ "Creating ignore patterns, overwriting an existing file at {%path%}.": "Creating ignore patterns, overwriting an existing file at {{path}}.",
"Danger!": "Danger!",
"Deleted": "Deleted",
"Device": "Device",
@@ -63,6 +64,7 @@
"Edit Device": "Edit Device",
"Edit Folder": "Edit Folder",
"Editing": "Editing",
+ "Editing {%path%}.": "Editing {{path}}.",
"Enable NAT traversal": "Enable NAT traversal",
"Enable Relaying": "Enable Relaying",
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.",
diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js
index f1717681..a418e2d0 100755
--- a/gui/default/syncthing/core/syncthingController.js
+++ b/gui/default/syncthing/core/syncthingController.js
@@ -58,6 +58,24 @@ angular.module('syncthing.core')
$scope.metricRates = (window.localStorage["metricRates"] == "true");
} catch (exception) { }
+ $scope.folderDefaults = {
+ selectedDevices: {},
+ type: "readwrite",
+ rescanIntervalS: 60,
+ minDiskFreePct: 1,
+ maxConflicts: 10,
+ fsync: true,
+ order: "random",
+ fileVersioningSelector: "none",
+ trashcanClean: 0,
+ simpleKeep: 5,
+ staggeredMaxAge: 365,
+ staggeredCleanInterval: 3600,
+ staggeredVersionsPath: "",
+ externalCommand: "",
+ autoNormalize: true
+ };
+
$scope.localStateTotal = {
bytes: 0,
files: 0
@@ -1393,24 +1411,9 @@ angular.module('syncthing.core')
};
$scope.addFolder = function () {
- $scope.currentFolder = {
- selectedDevices: {},
- type: "readwrite",
- rescanIntervalS: 60,
- minDiskFreePct: 1,
- maxConflicts: 10,
- fsync: true,
- order: "random",
- fileVersioningSelector: "none",
- trashcanClean: 0,
- simpleKeep: 5,
- staggeredMaxAge: 365,
- staggeredCleanInterval: 3600,
- staggeredVersionsPath: "",
- externalCommand: "",
- autoNormalize: true
- };
+ $scope.currentFolder = angular.copy($scope.folderDefaults);
$scope.editingExisting = false;
+ $('#editIgnores textarea').val("");
$scope.folderEditor.$setPristine();
$http.get(urlbase + '/svc/random/string?length=10').success(function (data) {
$scope.currentFolder.id = (data.random.substr(0, 5) + '-' + data.random.substr(5, 5)).toLowerCase();
@@ -1420,26 +1423,11 @@ angular.module('syncthing.core')
$scope.addFolderAndShare = function (folder, folderLabel, device) {
$scope.dismissFolderRejection(folder, device);
- $scope.currentFolder = {
- id: folder,
- label: folderLabel,
- selectedDevices: {},
- rescanIntervalS: 60,
- minDiskFreePct: 1,
- maxConflicts: 10,
- fsync: true,
- order: "random",
- fileVersioningSelector: "none",
- trashcanClean: 0,
- simpleKeep: 5,
- staggeredMaxAge: 365,
- staggeredCleanInterval: 3600,
- staggeredVersionsPath: "",
- externalCommand: "",
- autoNormalize: true,
- viewFlags: {
- importFromOtherDevice: true
- }
+ $scope.currentFolder = angular.copy($scope.folderDefaults);
+ $scope.currentFolder.id = folder;
+ $scope.currentFolder.label = folderLabel;
+ $scope.currentFolder.viewFlags = {
+ importFromOtherDevice: true
};
$scope.currentFolder.selectedDevices[device] = true;
@@ -1516,10 +1504,20 @@ angular.module('syncthing.core')
delete folderCfg.versioning;
}
+ var ignores = $('#editIgnores textarea').val().trim();
+ if (!$scope.editingExisting && ignores) {
+ folderCfg.paused = true;
+ };
+
$scope.folders[folderCfg.id] = folderCfg;
$scope.config.folders = folderList($scope.folders);
$scope.saveConfig();
+
+ if (!$scope.editingExisting && ignores) {
+ $scope.saveIgnores();
+ $scope.setFolderPause(folderCfg.id, false);
+ };
};
$scope.dismissFolderRejection = function (folder, device) {
@@ -1593,11 +1591,21 @@ angular.module('syncthing.core')
});
};
- $scope.saveIgnores = function () {
- if (!$scope.editingExisting) {
+ $scope.editIgnoresOnAddingFolder = function () {
+ if ($scope.editingExisting) {
return;
}
+ if ($scope.currentFolder.path.endsWith($scope.system.pathSeparator)) {
+ $scope.currentFolder.path = $scope.currentFolder.path.slice(0, -1);
+ };
+ $('#editIgnores').modal().one('shown.bs.modal', function () {
+ textArea.focus();
+ });
+ };
+
+
+ $scope.saveIgnores = function () {
$http.post(urlbase + '/db/ignores?folder=' + encodeURIComponent($scope.currentFolder.id), {
ignore: $('#editIgnores textarea').val().split('\n')
});
diff --git a/gui/default/syncthing/folder/editFolderModalView.html b/gui/default/syncthing/folder/editFolderModalView.html
index 2eb1faee..359f90e1 100644
--- a/gui/default/syncthing/folder/editFolderModalView.html
+++ b/gui/default/syncthing/folder/editFolderModalView.html
@@ -184,7 +184,7 @@
-