mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Pass the post to any events bound to custom names
This commit is contained in:
parent
3211c60bbe
commit
93b2af8a6e
1 changed files with 8 additions and 6 deletions
|
@ -37,19 +37,21 @@ var PosterNameComponent = Em.Component.extend({
|
||||||
if (Em.isEmpty(primaryGroupName)) {
|
if (Em.isEmpty(primaryGroupName)) {
|
||||||
buffer.push(title);
|
buffer.push(title);
|
||||||
} else {
|
} else {
|
||||||
buffer.push("<a href='#' class='user-group'>" + title + "</a>");
|
buffer.push("<a href='/groups/" + post.get('primary_group_name') + "' class='user-group'>" + title + "</a>");
|
||||||
}
|
}
|
||||||
buffer.push("</span>");
|
buffer.push("</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
PosterNameComponent.trigger('renderedName', buffer);
|
PosterNameComponent.trigger('renderedName', buffer, post);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
var $target = $(e.target);
|
var $target = $(e.target),
|
||||||
if ($target.hasClass('user-group')) {
|
href = $target.attr('href');
|
||||||
Discourse.URL.routeTo("/groups/" + this.get('post.primary_group_name'));
|
|
||||||
|
if (!Em.isEmpty(href) && href !== '#') {
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.sendAction('expandAction', this.get('post'));
|
this.sendAction('expandAction', this.get('post'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue