1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 23:44:27 +02:00

Massive JavaScript cleanup

- Use JSX for templates
- Docblock/comment everything
- Mostly passes ESLint (still some work to do)
- Lots of renaming, refactoring, etc.

CSS hasn't been updated yet.
This commit is contained in:
Toby Zerner
2015-07-15 14:00:11 +09:30
parent 4480e0a83f
commit ab6c03c0cc
220 changed files with 9785 additions and 5919 deletions

View File

@@ -0,0 +1,67 @@
import Modal from 'flarum/components/Modal';
/**
* The `DeleteAccountModal` component shows a modal dialog which allows the user
* to delete their account.
*
* @todo require typing password instead of DELETE
*/
export default class DeleteAccountModal extends Modal {
constructor(props) {
super(props);
/**
* The value of the confirmation input.
*
* @type {Function}
*/
this.confirmation = m.prop();
}
className() {
return 'modal-sm delete-account-modal';
}
title() {
return 'Delete Account';
}
content() {
return (
<div className="modal-body">
<div className="form-centered">
<div className="help-text">
<p>Hold up! If you delete your account, there&#39;s no going back. Keep in mind:</p>
<ul>
<li>Your username will be released, so someone else will be able to sign up with your name.</li>
<li>All of your posts will remain, but no longer associated with your account.</li>
</ul>
</div>
<div className="form-group">
<input className="form-control"
name="confirm"
placeholder="Type &quot;DELETE&quot; to proceed"
oninput={m.withAttr('value', this.confirmation)}/>
</div>
<div className="form-group">
<button type="submit"
className="btn btn-primary btn-block"
disabled={this.loading || this.confirmation() !== 'DELETE'}>
Delete Account
</button>
</div>
</div>
</div>
);
}
onsubmit(e) {
e.preventDefault();
if (this.confirmation() !== 'DELETE') return;
this.loading = true;
app.session.user.delete().then(() => app.session.logout());
}
}