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 This view is for rendering an icon representing the status of a topic
@class TopicStatusView @class TopicStatusComponent
@extends Discourse.View @extends Ember.Component
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
**/ **/
Discourse.TopicStatusView = Discourse.View.extend({ Discourse.TopicStatusComponent = Ember.Component.extend({
classNames: ['topic-statuses'], classNames: ['topic-statuses'],
hasDisplayableStatus: Em.computed.or('topic.closed', 'topic.pinned', 'topic.invisible', 'topic.archetypeObject.notDefault'), 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) { render: function(buffer) {
if (!this.get('hasDisplayableStatus')) { return; } if (!this.get('hasDisplayableStatus')) { return; }
var topicStatusView = this; var self = this,
var renderIconIf = function(conditionProp, name, key) { renderIconIf = function(conditionProp, name, key) {
if (!topicStatusView.get(conditionProp)) { return; } if (!self.get(conditionProp)) { return; }
var title = I18n.t("topic_statuses." + key + ".help"); var title = I18n.t("topic_statuses." + key + ".help");
buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>"); 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> <th class='num activity' colspan='2'>{{i18n activity}}</th>
</tr> </tr>
{{#groupedEach view.topics}} {{#each view.topics}}
<tr> <tr {{bindAttr class="archived"}}>
<td class='main-link'> <td class='main-link'>
{{topicStatus topic=this}}
<a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a> <a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
{{#if unread}} {{#if unread}}
<a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unbound unread}}</a> <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> <td class="activity"></td>
{{/if}} {{/if}}
</tr> </tr>
{{/groupedEach}} {{/each}}
</table> </table>
{{else}} {{else}}