This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/notification-item.js.es6
2014-08-06 15:24:20 -04:00

25 lines
648 B
JavaScript

export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['notification.read'],
_markRead: function(){
var self = this;
this.$('a').click(function(){
self.set('notification.read', true);
return true;
});
}.on('didInsertElement'),
render: function(buffer) {
var notification = this.get('notification'),
text = I18n.t(this.get('scope'), Em.getProperties(notification, 'description', 'username'));
var url = notification.get('url');
if (url) {
buffer.push('<a href="' + notification.get('url') + '">' + text + '</a>');
} else {
buffer.push(text);
}
}
});