1
0
mirror of https://github.com/flarum/core.git synced 2025-07-28 04:00:40 +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,44 @@
import Component from 'flarum/Component';
import icon from 'flarum/helpers/icon';
import NotificationList from 'flarum/components/NotificationList';
export default class NotificationsDropdown extends Component {
constructor(...args) {
super(...args);
/**
* Whether or not the notifications dropdown is visible.
*
* @type {Boolean}
*/
this.showing = false;
}
view() {
const user = app.session.user;
const unread = user.unreadNotificationsCount();
return (
<div className="dropdown btn-group notifications-dropdown">
<a href="javascript:;"
className={'dropdown-toggle btn btn-default btn-rounded btn-naked btn-icon' + (unread ? ' unread' : '')}
data-toggle="dropdown"
onclick={this.onclick.bind(this)}>
<span className="notifications-icon">{unread || icon('bell')}</span>
<span className="label">Notifications</span>
</a>
<div className="dropdown-menu dropdown-menu-right">
{this.showing ? NotificationList.component() : ''}
</div>
</div>
);
}
onclick() {
if (app.drawer.isOpen()) {
m.route(app.route('notifications'));
} else {
this.showing = true;
}
}
}