Revise Remember Me checkbox appearance

Use a generic checkbox instead of a switch — it's more familiar and accessible.

Signed-off-by: Toby Zerner <toby.zerner@gmail.com>
This commit is contained in:
Toby Zerner 2017-07-08 22:25:24 +09:30
parent d87aa89dff
commit edf693bde1
2 changed files with 21 additions and 20 deletions

View File

@ -23869,10 +23869,10 @@ System.register('flarum/components/LogInButtons', ['flarum/Component', 'flarum/u
});; });;
'use strict'; 'use strict';
System.register('flarum/components/LogInModal', ['flarum/components/Modal', 'flarum/components/ForgotPasswordModal', 'flarum/components/SignUpModal', 'flarum/components/Alert', 'flarum/components/Button', 'flarum/components/LogInButtons', 'flarum/components/Switch', 'flarum/utils/extractText'], function (_export, _context) { System.register('flarum/components/LogInModal', ['flarum/components/Modal', 'flarum/components/ForgotPasswordModal', 'flarum/components/SignUpModal', 'flarum/components/Alert', 'flarum/components/Button', 'flarum/components/LogInButtons', 'flarum/utils/extractText'], function (_export, _context) {
"use strict"; "use strict";
var Modal, ForgotPasswordModal, SignUpModal, Alert, Button, LogInButtons, Switch, extractText, LogInModal; var Modal, ForgotPasswordModal, SignUpModal, Alert, Button, LogInButtons, extractText, LogInModal;
return { return {
setters: [function (_flarumComponentsModal) { setters: [function (_flarumComponentsModal) {
Modal = _flarumComponentsModal.default; Modal = _flarumComponentsModal.default;
@ -23886,8 +23886,6 @@ System.register('flarum/components/LogInModal', ['flarum/components/Modal', 'fla
Button = _flarumComponentsButton.default; Button = _flarumComponentsButton.default;
}, function (_flarumComponentsLogInButtons) { }, function (_flarumComponentsLogInButtons) {
LogInButtons = _flarumComponentsLogInButtons.default; LogInButtons = _flarumComponentsLogInButtons.default;
}, function (_flarumComponentsSwitch) {
Switch = _flarumComponentsSwitch.default;
}, function (_flarumUtilsExtractText) { }, function (_flarumUtilsExtractText) {
extractText = _flarumUtilsExtractText.default; extractText = _flarumUtilsExtractText.default;
}], }],
@ -23924,7 +23922,7 @@ System.register('flarum/components/LogInModal', ['flarum/components/Modal', 'fla
* *
* @type {Function} * @type {Function}
*/ */
this.remember = m.prop(this.props.remember && true); this.remember = m.prop(!!this.props.remember);
} }
}, { }, {
key: 'className', key: 'className',
@ -23963,12 +23961,16 @@ System.register('flarum/components/LogInModal', ['flarum/components/Modal', 'fla
m( m(
'div', 'div',
{ className: 'Form-group' }, { className: 'Form-group' },
Switch.component({ m(
children: app.translator.trans('core.forum.log_in.remember_me_label'), 'div',
disabled: this.loading, null,
onchange: this.remember, m(
state: this.remember() 'label',
}) { className: 'checkbox' },
m('input', { type: 'checkbox', bidi: this.remember, disabled: this.loading }),
app.translator.trans('core.forum.log_in.remember_me_label')
)
)
), ),
m( m(
'div', 'div',

View File

@ -4,7 +4,6 @@ import SignUpModal from 'flarum/components/SignUpModal';
import Alert from 'flarum/components/Alert'; import Alert from 'flarum/components/Alert';
import Button from 'flarum/components/Button'; import Button from 'flarum/components/Button';
import LogInButtons from 'flarum/components/LogInButtons'; import LogInButtons from 'flarum/components/LogInButtons';
import Switch from 'flarum/components/Switch';
import extractText from 'flarum/utils/extractText'; import extractText from 'flarum/utils/extractText';
/** /**
@ -38,7 +37,7 @@ export default class LogInModal extends Modal {
* *
* @type {Function} * @type {Function}
*/ */
this.remember = m.prop(this.props.remember && true); this.remember = m.prop(!!this.props.remember);
} }
className() { className() {
@ -66,14 +65,14 @@ export default class LogInModal extends Modal {
bidi={this.password} bidi={this.password}
disabled={this.loading} /> disabled={this.loading} />
</div> </div>
<div className="Form-group"> <div className="Form-group">
{Switch.component({ <div>
children: app.translator.trans('core.forum.log_in.remember_me_label'), <label className="checkbox">
disabled: this.loading, <input type="checkbox" bidi={this.remember} disabled={this.loading} />
onchange: this.remember, {app.translator.trans('core.forum.log_in.remember_me_label')}
state: this.remember() </label>
})} </div>
</div> </div>
<div className="Form-group"> <div className="Form-group">