unify user preferences views

This commit is contained in:
Maja Komel 2018-06-28 22:14:04 +02:00 committed by Sam
parent 55a963252d
commit 3ddfc12307
7 changed files with 91 additions and 82 deletions

View File

@ -1,4 +1,4 @@
<section class='user-right user-preferences'> <section class='user-preferences'>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="control-group"> <div class="control-group">
@ -9,6 +9,7 @@
{{#if success}} {{#if success}}
<div class="control-group"> <div class="control-group">
<div class="controls">
<div class="instructions"> <div class="instructions">
<p> <p>
{{#if model.staff}} {{#if model.staff}}
@ -19,10 +20,11 @@
</p> </p>
</div> </div>
</div> </div>
</div>
{{else}} {{else}}
{{#if error}} {{#if error}}
<div class="control-group"> <div class="control-group">
<div class="instructions"> <div class="controls">
<div class='alert alert-error'>{{errorMessage}}</div> <div class='alert alert-error'>{{errorMessage}}</div>
</div> </div>
</div> </div>
@ -34,6 +36,7 @@
{{text-field value=newEmail id="change-email" classNames="input-xxlarge" autofocus="autofocus"}} {{text-field value=newEmail id="change-email" classNames="input-xxlarge" autofocus="autofocus"}}
{{input-tip validation=emailValidation}} {{input-tip validation=emailValidation}}
</div> </div>
<div class="controls">
<div class='instructions'> <div class='instructions'>
{{#if taken}} {{#if taken}}
{{i18n 'user.change_email.taken'}} {{i18n 'user.change_email.taken'}}
@ -42,6 +45,7 @@
{{/if}} {{/if}}
</div> </div>
</div> </div>
</div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">

View File

@ -1,7 +1,11 @@
<section class="user-content user-preferences second-factor-backup-preferences"> <section class="user-preferences second-factor-backup-preferences">
<form class="form-horizontal"> <form class="form-horizontal">
<h2>{{i18n "user.second_factor_backup.title"}}</h2>
<div class="control-group">
<div class="controls">
<h3>{{i18n "user.second_factor_backup.title"}}</h3>
</div>
<div class="controls">
{{#if successMessage}} {{#if successMessage}}
<div class="alert alert-success"> <div class="alert alert-success">
{{successMessage}} {{successMessage}}
@ -13,13 +17,25 @@
{{errorMessage}} {{errorMessage}}
</div> </div>
{{/if}} {{/if}}
</div>
</div>
<div class="second-factor-form"> <label class='control-label'>{{i18n 'user.second_factor.label'}}</label>
<div class="control-group">
<div class="controls">
{{second-factor-input {{second-factor-input
value=secondFactorToken value=secondFactorToken
maxlength=6 maxlength=6
inputId="second-factor-token"}} inputId="second-factor-token"}}
<div class='instructions'>
{{i18n "user.second_factor.disable_description"}}
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="actions"> <div class="actions">
{{d-button {{d-button
action="generateSecondFactorCodes" action="generateSecondFactorCodes"
@ -34,11 +50,6 @@
label="user.second_factor_backup.disable"}} label="user.second_factor_backup.disable"}}
{{/if}} {{/if}}
</div> </div>
</div>
<div class="instructions">
{{i18n "user.second_factor.disable_description"}}
</div>
{{#conditional-loading-section isLoading=loading}} {{#conditional-loading-section isLoading=loading}}
{{#if backupCodes}} {{#if backupCodes}}
@ -51,11 +62,13 @@
{{backup-codes {{backup-codes
copyBackupCode=(action "copyBackupCode") copyBackupCode=(action "copyBackupCode")
backupCodes=backupCodes}} backupCodes=backupCodes}}
{{/if}}
{{/conditional-loading-section}}
{{#link-to "preferences.account" model.username}} {{#link-to "preferences.account" model.username}}
{{i18n "go_back"}} {{i18n "go_back"}}
{{/link-to}} {{/link-to}}
{{/if}}
{{/conditional-loading-section}}
</div>
</div>
</form> </form>
</section> </section>

View File

@ -1,5 +1,6 @@
<section class='user-content user-preferences'> <section class='user-preferences'>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<h3>{{i18n 'user.second_factor.title'}}</h3> <h3>{{i18n 'user.second_factor.title'}}</h3>
@ -8,7 +9,7 @@
{{#if errorMessage}} {{#if errorMessage}}
<div class="control-group"> <div class="control-group">
<div class="instructions"> <div class="controls">
<div class='alert alert-error'>{{errorMessage}}</div> <div class='alert alert-error'>{{errorMessage}}</div>
</div> </div>
</div> </div>
@ -22,7 +23,7 @@
{{second-factor-input value=secondFactorToken inputId='second-factor-token'}} {{second-factor-input value=secondFactorToken inputId='second-factor-token'}}
</div> </div>
<div class='instructions'> <div class='instructions controls'>
{{i18n 'user.second_factor.disable_description'}} {{i18n 'user.second_factor.disable_description'}}
</div> </div>
</div> </div>
@ -97,7 +98,7 @@
autofocus="autofocus"}} autofocus="autofocus"}}
</div> </div>
<div class='instructions'> <div class='instructions controls'>
{{i18n 'user.second_factor.confirm_password_description'}} {{i18n 'user.second_factor.confirm_password_description'}}
</div> </div>
</div> </div>

View File

@ -1,4 +1,4 @@
<section class='user-content'> <section class='user-preferences'>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="control-group"> <div class="control-group">

View File

@ -563,11 +563,6 @@
margin-right: 10px; margin-right: 10px;
} }
.second-factor-form {
display: flex;
align-items: center;
}
.form-horizontal .instructions { .form-horizontal .instructions {
margin-left: 0; margin-left: 0;
} }

View File

@ -292,10 +292,6 @@
margin-top: 0; margin-top: 0;
} }
.form-horizontal .instructions {
margin-left: 8px;
}
.pref-mailing-list-mode .controls { .pref-mailing-list-mode .controls {
select { select {
width: 400px; width: 400px;

View File

@ -125,7 +125,7 @@ QUnit.test("second factor", assert => {
}); });
fillIn("#password", "secrets"); fillIn("#password", "secrets");
click(".user-content .btn-primary"); click(".user-preferences .btn-primary");
andThen(() => { andThen(() => {
assert.ok(exists("#test-qr"), "shows qr code"); assert.ok(exists("#test-qr"), "shows qr code");
@ -156,7 +156,7 @@ QUnit.test("second factor backup", assert => {
}); });
fillIn("#second-factor-token", "111111"); fillIn("#second-factor-token", "111111");
click(".second-factor-form .btn-primary"); click(".user-preferences .btn-primary");
andThen(() => { andThen(() => {
assert.ok(exists(".backup-codes-area"), "shows backup codes"); assert.ok(exists(".backup-codes-area"), "shows backup codes");