Allow #editIgnores to scroll in browser (fixes #2041)

class modal-open is applied to <body>, which ultimately means that the
browser will scoll to the modal's content. However, #editFolder was
finishing its close animation (and removing this modal-open class)
after #editIgnores had set modal-open (and had started its open
animation). The end result is that <body> ends up without modal-open
when #editIgnores is open, and so the browser doesn't properly scroll.

Instead, only open the #editIgnores once #editFolder has finished closing.
This commit is contained in:
Antony Male 2015-07-15 12:20:27 +01:00
parent 8fab7ec5e3
commit 8f38e83aaf

View File

@ -1230,18 +1230,20 @@ angular.module('syncthing.core')
.success(function (data) { .success(function (data) {
data.ignore = data.ignore || []; data.ignore = data.ignore || [];
$('#editFolder').modal('hide'); $('#editFolder').modal('hide')
.one('hidden.bs.modal', function() {
var textArea = $('#editIgnores textarea'); var textArea = $('#editIgnores textarea');
textArea.val(data.ignore.join('\n')); textArea.val(data.ignore.join('\n'));
$('#editIgnores').modal() $('#editIgnores').modal()
.on('hidden.bs.modal', function () { .one('hidden.bs.modal', function () {
$('#editFolder').modal(); $('#editFolder').modal();
}) })
.on('shown.bs.modal', function () { .one('shown.bs.modal', function () {
textArea.focus(); textArea.focus();
}); });
});
}) })
.then(function () { .then(function () {
$('#editIgnoresButton').removeAttr('disabled'); $('#editIgnoresButton').removeAttr('disabled');