Set correct focus for selfhosters in setup wizard

This commit is contained in:
Johannes Zellner
2016-07-28 16:22:20 +02:00
parent cd896a4422
commit 7862fbd7ee
2 changed files with 8 additions and 3 deletions

View File

@@ -180,8 +180,13 @@ app.controller('StepController', ['$scope', '$route', '$location', 'Wizard', fun
};
$scope.$on('$viewContentLoaded', function () {
$('a[autofocus]').focus();
$('input[autofocus]').focus();
if ($location.path() === '/step2') {
if (Wizard.requireEmail) $('#inputEmail').focus();
else $('#inputDisplayName').focus();
} else {
$('a[autofocus]').focus();
$('input[autofocus]').focus();
}
});
$scope.showCustomAvatarSelector = function () {

View File

@@ -11,7 +11,7 @@
<input type="email" class="form-control" ng-model="wizard.email" id="inputEmail" name="email" placeholder="Email" ng-enter="focusNext('inputDisplayName', setup_form.email.$invalid)" required autocomplete="off">
</div>
<div class="form-group" ng-class="{ 'has-error': setup_form.displayName.$dirty && setup_form.displayName.$invalid }">
<input type="text" class="form-control" ng-model="wizard.displayName" id="inputDisplayName" name="displayName" placeholder="Display Name" ng-enter="focusNext('inputUsername', setup_form.displayName.$invalid)" required autofocus autocomplete="off">
<input type="text" class="form-control" ng-model="wizard.displayName" id="inputDisplayName" name="displayName" placeholder="Display Name" ng-enter="focusNext('inputUsername', setup_form.displayName.$invalid)" required autocomplete="off">
</div>
<div class="form-group" ng-class="{ 'has-error': setup_form.username.$dirty && setup_form.username.$invalid }">
<input type="text" class="form-control" ng-model="wizard.username" id="inputUsername" name="username" placeholder="Username" ng-enter="focusNext('inputPassword', setup_form.username.$invalid)" ng-maxlength="512" ng-minlength="3" required autocomplete="off">