FIX: Show status icons on user topic pages

This commit is contained in:
Robin Ward 2013-11-04 13:12:37 -05:00
parent ede59a4386
commit a13d05660f
2 changed files with 11 additions and 10 deletions

View File

@ -1,12 +1,12 @@
/**
This view is for rendering an icon representing the status of a topic
@class TopicStatusView
@extends Discourse.View
@class TopicStatusComponent
@extends Ember.Component
@namespace Discourse
@module Discourse
**/
Discourse.TopicStatusView = Discourse.View.extend({
Discourse.TopicStatusComponent = Ember.Component.extend({
classNames: ['topic-statuses'],
hasDisplayableStatus: Em.computed.or('topic.closed', 'topic.pinned', 'topic.invisible', 'topic.archetypeObject.notDefault'),
@ -15,9 +15,9 @@ Discourse.TopicStatusView = Discourse.View.extend({
render: function(buffer) {
if (!this.get('hasDisplayableStatus')) { return; }
var topicStatusView = this;
var renderIconIf = function(conditionProp, name, key) {
if (!topicStatusView.get(conditionProp)) { return; }
var self = this,
renderIconIf = function(conditionProp, name, key) {
if (!self.get(conditionProp)) { return; }
var title = I18n.t("topic_statuses." + key + ".help");
buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>");
};
@ -32,4 +32,4 @@ Discourse.TopicStatusView = Discourse.View.extend({
});
Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusView);
Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusComponent);

View File

@ -13,9 +13,10 @@
<th class='num activity' colspan='2'>{{i18n activity}}</th>
</tr>
{{#groupedEach view.topics}}
<tr>
{{#each view.topics}}
<tr {{bindAttr class="archived"}}>
<td class='main-link'>
{{topicStatus topic=this}}
<a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
{{#if unread}}
<a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unbound unread}}</a>
@ -55,7 +56,7 @@
<td class="activity"></td>
{{/if}}
</tr>
{{/groupedEach}}
{{/each}}
</table>
{{else}}