1
0
mirror of https://github.com/flarum/core.git synced 2025-07-12 12:26:23 +02:00
* Replace gulp with webpack and npm scripts for JS compilation
* Set up Travis CI to commit compiled JS
* Restructure `js` directory; only one instance of npm, forum/admin are "submodules"
* Refactor JS initializers into Application subclasses
* Maintain partial compatibility API (importing from absolute paths) for extensions
* Remove minification responsibility from PHP asset compiler
* Restructure `less` directory
This commit is contained in:
Toby Zerner
2018-06-20 13:20:31 +09:30
committed by GitHub
parent d234badbb2
commit 3f683dd6ee
235 changed files with 9351 additions and 57639 deletions

View File

@ -0,0 +1,55 @@
import Alert from '../../common/components/Alert';
import Button from '../../common/components/Button';
import icon from '../../common/helpers/icon';
/**
* Shows an alert if the user has not yet confirmed their email address.
*
* @param {ForumApp} app
*/
export default function alertEmailConfirmation(app) {
const user = app.session.user;
if (!user || user.isActivated()) return;
const resendButton = Button.component({
className: 'Button Button--link',
children: app.translator.trans('core.forum.user_email_confirmation.resend_button'),
onclick: function() {
resendButton.props.loading = true;
m.redraw();
app.request({
method: 'POST',
url: app.forum.attribute('apiUrl') + '/users/' + user.id() + '/send-confirmation',
}).then(() => {
resendButton.props.loading = false;
resendButton.props.children = [icon('fas fa-check'), ' ', app.translator.trans('core.forum.user_email_confirmation.sent_message')];
resendButton.props.disabled = true;
m.redraw();
}).catch(() => {
resendButton.props.loading = false;
m.redraw();
});
}
});
class ContainedAlert extends Alert {
view() {
const vdom = super.view();
vdom.children = [<div className="container">{vdom.children}</div>];
return vdom;
}
}
m.mount(
$('<div/>').insertBefore('#content')[0],
ContainedAlert.component({
dismissible: false,
children: app.translator.trans('core.forum.user_email_confirmation.alert_message', {email: <strong>{user.email()}</strong>}),
controls: [resendButton]
})
);
}