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(); 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) {
if (href.indexOf('://') === -1) m.route.apply(this, arguments);
if (!isInitialized) $(element).click(this.markAsRead.bind(this));
}}>
{avatar(notification.sender())} {avatar(notification.sender())}
{icon(this.icon(), {className: 'Notification-icon'})} {icon(this.icon(), {className: 'Notification-icon'})}
<span className="Notification-content">{this.content()}</span> <span className="Notification-content">{this.content()}</span>
@ -30,7 +34,6 @@ export default class Notification extends Component {
{this.excerpt()} {this.excerpt()}
</div> </div>
</a> </a>
</div>
); );
} }