Improve new folder dialog
This commit is contained in:
@@ -146,16 +146,21 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
|
||||
$scope.newDirectory.name = '';
|
||||
$scope.newDirectory.busy = false;
|
||||
|
||||
$scope.newDirectoryForm.$setUntouched();
|
||||
$scope.newDirectoryForm.$setPristine();
|
||||
|
||||
$('#newDirectoryModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.newDirectory.busy = true;
|
||||
$scope.newDirectory.error = null;
|
||||
|
||||
var filePath = sanitize($scope.cwd + '/' + $scope.newDirectory.name);
|
||||
|
||||
Client.filesCreateDirectory($scope.appId, filePath, function (error, result) {
|
||||
$scope.newDirectory.busy = false;
|
||||
if (error && error.statusCode === 409) return $scope.newDirectory.error = 'Already exists';
|
||||
if (error) return Client.error(error);
|
||||
|
||||
console.log('create direcotory', result);
|
||||
@@ -277,4 +282,11 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
// setup all the dialog focus handling
|
||||
['newDirectoryModal'].forEach(function (id) {
|
||||
$('#' + id).on('shown.bs.modal', function () {
|
||||
$(this).find("[autofocus]:first").focus();
|
||||
});
|
||||
});
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user