Minor JS cleanup

This commit is contained in:
Robin Ward 2013-04-02 12:42:11 -04:00
parent 7ef5037bbe
commit 75703cfc6a
2 changed files with 11 additions and 11 deletions

View File

@ -7,24 +7,24 @@
{{#each featured_users}} {{#each featured_users}}
<a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a> <a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
{{/each}} {{/each}}
</div> </div>
</th> </th>
<th class='num'>{{i18n posts}}</th> <th class='num'>{{i18n posts}}</th>
<th class='num'>{{i18n age}}</th> <th class='num'>{{i18n age}}</th>
</tr> </tr>
{{#each topics}} {{#each topics}}
<tr {{bindAttr class="archived"}}> <tr {{bindAttr class="archived"}}>
<td class='main-link'> <td class='main-link'>
<div class='topic-inset'> <div class='topic-inset'>
{{view Discourse.TopicStatusView topicBinding="this"}} {{view Discourse.TopicStatusView topicBinding="this"}}
{{{topicLink this}} {{{topicLink this}}
{{#if unread}} {{#if unread}}
<a href="{{unbound lastReadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts unread="unread"}}'>{{unbound unread}}</a> <a href="{{unbound lastReadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts unread="unread"}}'>{{unbound unread}}</a>
{{/if}} {{/if}}
{{#if new_posts}} {{#if new_posts}}
<a href="{{unbound lastReadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts new_posts="new_posts"}}'>{{unbound new_posts}}</a> <a href="{{unbound lastReadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts new_posts="new_posts"}}'>{{unbound new_posts}}</a>
{{/if}} {{/if}}
</div> </div>
</td> </td>
<td class='num'><span class='badge-posts'>{{number posts_count}}</span></td> <td class='num'><span class='badge-posts'>{{number posts_count}}</span></td>

View File

@ -9,25 +9,25 @@
Discourse.TopicStatusView = Discourse.View.extend({ Discourse.TopicStatusView = Discourse.View.extend({
classNames: ['topic-statuses'], classNames: ['topic-statuses'],
hasDisplayableStatus: (function() { hasDisplayableStatus: function() {
if (this.get('topic.closed')) return true; if (this.get('topic.closed')) return true;
if (this.get('topic.pinned')) return true; if (this.get('topic.pinned')) return true;
if (!this.get('topic.archetype.isDefault')) return true; if (!this.get('topic.archetype.isDefault')) return true;
if (!this.get('topic.visible')) return true; if (!this.get('topic.visible')) return true;
return false; return false;
}).property('topic.closed', 'topic.pinned', 'topic.visible'), }.property('topic.closed', 'topic.pinned', 'topic.visible'),
statusChanged: (function() { statusChanged: function() {
this.rerender(); this.rerender();
}).observes('topic.closed', 'topic.pinned', 'topic.visible'), }.observes('topic.closed', 'topic.pinned', 'topic.visible'),
renderIcon: function(buffer, name, key) { renderIcon: function(buffer, name, key) {
var title; var title = Em.String.i18n("topic_statuses." + key + ".help");
title = Em.String.i18n("topic_statuses." + key + ".help");
return buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>"); return buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>");
}, },
render: function(buffer) { render: function(buffer) {
if (!this.get('hasDisplayableStatus')) return; if (!this.get('hasDisplayableStatus')) return;
// Allow a plugin to add a custom icon to a topic // Allow a plugin to add a custom icon to a topic