Add support for themes (fixes #1925)
This commit is contained in:
21
gui/default/syncthing/core/uniqueFolderDirective.js
Normal file
21
gui/default/syncthing/core/uniqueFolderDirective.js
Normal file
@@ -0,0 +1,21 @@
|
||||
angular.module('syncthing.core')
|
||||
.directive('uniqueFolder', function () {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function (scope, elm, attrs, ctrl) {
|
||||
ctrl.$parsers.unshift(function (viewValue) {
|
||||
if (scope.editingExisting) {
|
||||
// we shouldn't validate
|
||||
ctrl.$setValidity('uniqueFolder', true);
|
||||
} else if (scope.folders.hasOwnProperty(viewValue)) {
|
||||
// the folder exists already
|
||||
ctrl.$setValidity('uniqueFolder', false);
|
||||
} else {
|
||||
// the folder is unique
|
||||
ctrl.$setValidity('uniqueFolder', true);
|
||||
}
|
||||
return viewValue;
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user