Directory auto-complete.

This commit is contained in:
Phill Luby
2014-11-16 19:30:49 +00:00
parent ead09395d9
commit 46ec72412a
4 changed files with 59 additions and 4 deletions

View File

@@ -777,6 +777,19 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
return folderList($scope.folders);
};
$scope.directoryList = [];
$scope.$watch('currentFolder.Path', function (newvalue) {
$http.get(
urlbase + '/autocomplete/directory',
{
params: { current: newvalue }
}
).success(function (data) {
$scope.directoryList = data;
});
});
$scope.editFolder = function (deviceCfg) {
$scope.currentFolder = angular.copy(deviceCfg);
$scope.currentFolder.selectedDevices = {};

View File

@@ -458,7 +458,10 @@
</div>
<div class="form-group" ng-class="{'has-error': folderEditor.folderPath.$invalid && folderEditor.folderPath.$dirty}">
<label translate for="folderPath">Folder Path</label>
<input name="folderPath" ng-readonly="editingExisting" id="folderPath" class="form-control" type="text" ng-model="currentFolder.Path" required></input>
<input name="folderPath" ng-readonly="editingExisting" id="folderPath" class="form-control" type="text" ng-model="currentFolder.Path" list="directory-list" required />
<datalist id="directory-list">
<option ng-repeat="directory in directoryList" value="{{ directory }}" />
</datalist>
<p class="help-block">
<span translate ng-if="folderEditor.folderPath.$valid || folderEditor.folderPath.$pristine">Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for</span> <code>{{system.tilde}}</code>.
<span translate ng-if="folderEditor.folderPath.$error.required && folderEditor.folderPath.$dirty">The folder path cannot be blank.</span>