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