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

Improve appearance/behaviour of login/signup/forgot modals

This commit is contained in:
Toby Zerner
2015-05-26 16:25:25 +09:30
parent 5fc2f3aeee
commit 85ba97ed5c
10 changed files with 209 additions and 143 deletions

View File

@@ -0,0 +1,42 @@
import Component from 'flarum/component';
import LoadingIndicator from 'flarum/components/loading-indicator';
import Alert from 'flarum/components/alert';
import icon from 'flarum/helpers/icon';
export default class FormModal extends Component {
constructor(props) {
super(props);
this.alert = null;
this.loading = m.prop(false);
}
view(options) {
if (this.alert) {
this.alert.props.dismissible = false;
}
return m('div.modal-dialog', {className: options.className, config: this.element}, [
m('div.modal-content', [
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()) : '',
m('div.modal-body', [
m('div.form-centered', options.body)
]),
options.footer ? m('div.modal-footer', options.footer) : ''
])
]),
LoadingIndicator.component({className: 'modal-loading'+(this.loading() ? ' active' : '')})
])
}
ready() {
this.$(':input:first').select();
}
hide() {
app.modal.close();
}
}