Simplify notification markup

This commit is contained in:
Toby Zerner 2015-09-04 12:12:48 +09:30
parent b3aa0298d5
commit 2f8a449b74

View File

@ -19,9 +19,13 @@ export default class Notification extends Component {
const href = this.href();
return (
<div className={'Notification Notification--' + notification.contentType() + ' ' + (!notification.isRead() ? 'unread' : '')}
onclick={this.markAsRead.bind(this)}>
<a href={href} config={href.indexOf('://') === -1 ? m.route : undefined}>
<a className={'Notification Notification--' + notification.contentType() + ' ' + (!notification.isRead() ? 'unread' : '')}
href={href}
config={function(element, isInitialized) {
if (href.indexOf('://') === -1) m.route.apply(this, arguments);
if (!isInitialized) $(element).click(this.markAsRead.bind(this));
}}>
{avatar(notification.sender())}
{icon(this.icon(), {className: 'Notification-icon'})}
<span className="Notification-content">{this.content()}</span>
@ -30,7 +34,6 @@ export default class Notification extends Component {
{this.excerpt()}
</div>
</a>
</div>
);
}