mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
FIX: Link a poster's name to their profile, makes much more sense now
that we're showing the popup to that.
This commit is contained in:
parent
fa25700400
commit
f33ebc512b
1 changed files with 7 additions and 5 deletions
|
@ -14,7 +14,8 @@ var PosterNameComponent = Em.Component.extend({
|
||||||
var name = post.get('name'),
|
var name = post.get('name'),
|
||||||
username = post.get('username'),
|
username = post.get('username'),
|
||||||
linkClass = 'username',
|
linkClass = 'username',
|
||||||
primaryGroupName = post.get('primary_group_name');
|
primaryGroupName = post.get('primary_group_name'),
|
||||||
|
url = post.get('usernameUrl');
|
||||||
|
|
||||||
if (post.get('staff')) { linkClass += ' staff'; }
|
if (post.get('staff')) { linkClass += ' staff'; }
|
||||||
if (post.get('admin')) { linkClass += ' admin'; }
|
if (post.get('admin')) { linkClass += ' admin'; }
|
||||||
|
@ -25,7 +26,7 @@ var PosterNameComponent = Em.Component.extend({
|
||||||
linkClass += ' ' + primaryGroupName;
|
linkClass += ' ' + primaryGroupName;
|
||||||
}
|
}
|
||||||
// Main link
|
// Main link
|
||||||
buffer.push("<span class='" + linkClass + "'><a href='#'>" + username + "</a>");
|
buffer.push("<span class='" + linkClass + "'><a href='" + url + "' data-auto-route='true'>" + username + "</a>");
|
||||||
|
|
||||||
// Add a glyph if we have one
|
// Add a glyph if we have one
|
||||||
var glyph = this.posterGlyph(post);
|
var glyph = this.posterGlyph(post);
|
||||||
|
@ -37,7 +38,7 @@ var PosterNameComponent = Em.Component.extend({
|
||||||
// Are we showing full names?
|
// Are we showing full names?
|
||||||
if (name && this.get('displayNameOnPosts') && (this.sanitizeName(name) !== this.sanitizeName(username))) {
|
if (name && this.get('displayNameOnPosts') && (this.sanitizeName(name) !== this.sanitizeName(username))) {
|
||||||
name = Handlebars.Utils.escapeExpression(name);
|
name = Handlebars.Utils.escapeExpression(name);
|
||||||
buffer.push("<span class='full-name'><a href='#'>" + name + "</a></span>");
|
buffer.push("<span class='full-name'><a href='" + url + "' data-auto-route='true'>" + name + "</a></span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// User titles
|
// User titles
|
||||||
|
@ -60,9 +61,10 @@ var PosterNameComponent = Em.Component.extend({
|
||||||
|
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
var $target = $(e.target),
|
var $target = $(e.target),
|
||||||
href = $target.attr('href');
|
href = $target.attr('href'),
|
||||||
|
url = this.get('post.usernameUrl');
|
||||||
|
|
||||||
if (!Em.isEmpty(href) && href !== '#') {
|
if (!Em.isEmpty(href) && href !== url) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.appEvents.trigger('poster:expand', $target);
|
this.appEvents.trigger('poster:expand', $target);
|
||||||
|
|
Loading…
Reference in a new issue