Skip to content

Commit

Permalink
FIX: in activity stream, move category badge to be under topic title.…
Browse files Browse the repository at this point in the history
… Long titles could cause it to be cut off. Category badge replaces the text that was there.
  • Loading branch information
nlalonde committed Sep 11, 2014
1 parent 52094fe commit 9b5f506
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 48 deletions.
18 changes: 1 addition & 17 deletions app/assets/javascripts/discourse/models/admin_post.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,6 @@ Discourse.AdminPost = Discourse.Post.extend({
} else {
return this.get("sameUser") ? "you_replied_to_topic" : "user_replied_to_topic";
}
}.property("reply_to_post_number", "sameUser"),

descriptionHtml: function () {
var descriptionKey = this.get("descriptionKey");
if (!descriptionKey) { return; }

var description = I18n.t("user_action." + descriptionKey, {
userUrl: this.get("usernameUrl"),
user: Handlebars.Utils.escapeExpression(this.get("presentName")),
postUrl: this.get("url"),
post_number: "#" + this.get("reply_to_post_number"),
topicUrl: this.get("url"),
});

return new Handlebars.SafeString(description);

}.property("descriptionKey")
}.property("reply_to_post_number", "sameUser")

});
26 changes: 0 additions & 26 deletions app/assets/javascripts/discourse/models/user_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var UserActionTypes = {
messages_sent: 12,
messages_received: 13
},
esc = Handlebars.Utils.escapeExpression,
InvertedActionTypes = {};

_.each(UserActionTypes, function (k, v) {
Expand Down Expand Up @@ -73,31 +72,6 @@ Discourse.UserAction = Discourse.Model.extend({
}
}.property('action_type'),

/**
Returns the HTML representation of a user action's description, complete with icon.
@property descriptionHtml
**/
descriptionHtml: function() {
var descriptionKey = this.get('descriptionKey');
if (!descriptionKey) { return; }

var icon = this.get('isPM') ? '<i class="fa fa-envelope" title="{{i18n user.stream.private_message}}"></i>' : '';

return new Handlebars.SafeString(icon + " " + I18n.t("user_action." + descriptionKey, {
userUrl: this.get('userUrl'),
replyUrl: this.get('replyUrl'),
postUrl: this.get('postUrl'),
topicUrl: this.get('replyUrl'),
user: esc(this.get('presentName')),
post_number: '#' + this.get('reply_to_post_number'),
user1Url: this.get('userUrl'),
user2Url: this.get('targetUserUrl'),
another_user: esc(this.get('targetDisplayName'))
}));

}.property('descriptionKey'),

sameUser: function() {
return this.get('username') === Discourse.User.currentProp('username');
}.property('username'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
</span>
<span class="title">
<a href="{{unbound url}}">{{unbound topic_title}}</a>
{{category-link category}}
</span>
<span class="type">
{{descriptionHtml}}
<span class="category">
{{category-link category}}
</span>
{{#if deleted}}
<span class="delete-info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
<span class='time'>{{date path="created_at" leaveAgo="true"}}</span>
<span class="title">
<a href="{{unbound postUrl}}">{{unbound title}}</a>
{{category-link category}}
</span>
<span class="type">{{unbound descriptionHtml}}</span>
<span class="category">{{category-link category}}</span>
</div>
<p class='excerpt'>{{{unbound excerpt}}}</p>
{{#grouped-each children}}
Expand Down

0 comments on commit 9b5f506

Please sign in to comment.