gui: Modal tweaks

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3292
LGTM: AudriusButkevicius, calmh
This commit is contained in:
Daniel Harte
2016-06-12 14:06:48 +00:00
committed by Jakob Borg
parent 6f5ca53f99
commit de298da532
44 changed files with 750 additions and 962 deletions

View File

@@ -1028,10 +1028,6 @@ angular.module('syncthing.core')
});
};
$scope.upgradeMajor = function () {
$('#majorUpgrade').modal();
};
$scope.shutdown = function () {
restarting = true;
$http.post(urlbase + '/system/shutdown').success(function () {
@@ -1052,12 +1048,6 @@ angular.module('syncthing.core')
$('#editDevice').modal();
};
$scope.idDevice = function (deviceCfg) {
$scope.currentDevice = deviceCfg;
$('#editDevice').modal('hide');
$('#idqr').modal('show');
};
$scope.addDevice = function (deviceID, name) {
return $http.get(urlbase + '/system/discovery')
.success(function (registry) {
@@ -1229,6 +1219,18 @@ angular.module('syncthing.core')
}).error($scope.emitHTTPError);
});
$scope.loadFormIntoScope = function (form) {
console.log('loadFormIntoScope',form.$name);
switch (form.$name) {
case 'deviceEditor':
$scope.deviceEditor = form;
break;
case 'folderEditor':
$scope.folderEditor = form;
break;
}
}
$scope.editFolder = function (folderCfg) {
$scope.currentFolder = angular.copy(folderCfg);
if ($scope.currentFolder.path.slice(-1) === $scope.system.pathSeparator) {
@@ -1464,20 +1466,11 @@ angular.module('syncthing.core')
$http.get(urlbase + '/db/ignores?folder=' + encodeURIComponent($scope.currentFolder.id))
.success(function (data) {
data.ignore = data.ignore || [];
$('#editFolder').modal('hide')
.one('hidden.bs.modal', function() {
var textArea = $('#editIgnores textarea');
textArea.val(data.ignore.join('\n'));
$('#editIgnores').modal()
.one('hidden.bs.modal', function () {
$('#editFolder').modal();
})
.one('shown.bs.modal', function () {
textArea.focus();
});
var textArea = $('#editIgnores textarea');
textArea.val(data.ignore.join('\n'));
$('#editIgnores').modal()
.one('shown.bs.modal', function () {
textArea.focus();
});
})
.then(function () {
@@ -1501,16 +1494,6 @@ angular.module('syncthing.core')
});
};
$scope.showURPreview = function () {
$('#settings').modal('hide')
.one('hidden.bs.modal', function() {
$('#urPreview').modal()
.one('hidden.bs.modal', function () {
$('#settings').modal();
});
});
};
$scope.acceptUR = function () {
$scope.config.options.urAccepted = 1000; // Larger than the largest existing report version
$scope.saveConfig();
@@ -1555,10 +1538,6 @@ angular.module('syncthing.core')
$http.post(urlbase + "/db/override?folder=" + encodeURIComponent(folder));
};
$scope.about = function () {
$('#about').modal('show');
};
$scope.advanced = function () {
$scope.advancedConfig = angular.copy($scope.config);
$('#advanced').modal('show');