1
0
mirror of https://github.com/flarum/core.git synced 2025-07-22 01:01:28 +02:00

Improvements to change/forgot password

This commit is contained in:
Toby Zerner
2015-05-27 16:25:44 +09:30
parent 696bfe5a07
commit 2741923714
16 changed files with 96 additions and 34 deletions

View File

@@ -7,13 +7,14 @@ export default class FormModal extends Component {
constructor(props) {
super(props);
this.alert = null;
this.alert = m.prop();
this.loading = m.prop(false);
}
view(options) {
if (this.alert) {
this.alert.props.dismissible = false;
var alert = this.alert();
if (alert) {
alert.props.dismissible = false;
}
return m('div.modal-dialog', {className: options.className, config: this.element}, [
@@ -21,7 +22,7 @@ export default class FormModal extends Component {
m('a[href=javascript:;].btn.btn-icon.btn-link.close.back-control', {onclick: this.hide.bind(this)}, icon('times')),
m('form', {onsubmit: this.onsubmit.bind(this)}, [
m('div.modal-header', m('h3.title-control', options.title)),
this.alert ? m('div.modal-alert', this.alert.view()) : '',
alert ? m('div.modal-alert', alert) : '',
m('div.modal-body', [
m('div.form-centered', options.body)
]),
@@ -39,4 +40,19 @@ export default class FormModal extends Component {
hide() {
app.modal.close();
}
handleErrors(errors) {
if (errors) {
this.alert(new Alert({
type: 'warning',
message: errors.map((error, k) => [error.detail, k < errors.length - 1 ? m('br') : ''])
}));
}
m.redraw();
if (errors) {
this.$('[name='+errors[0].path+']').select();
}
}
}