FEATURE: lock icon for archived topics

remove model sniffing hack
This commit is contained in:
Sam 2014-04-11 10:27:04 +10:00
parent fe6153ba96
commit 668a5ff526
3 changed files with 6 additions and 7 deletions

View file

@ -9,8 +9,8 @@
Discourse.TopicStatusComponent = Ember.Component.extend({ Discourse.TopicStatusComponent = Ember.Component.extend({
classNames: ['topic-statuses'], classNames: ['topic-statuses'],
hasDisplayableStatus: Em.computed.or('topic.closed', 'topic.pinned', 'topic.unpinned', 'topic.invisible', 'topic.archetypeObject.notDefault'), hasDisplayableStatus: Em.computed.or('topic.archived','topic.closed', 'topic.pinned', 'topic.unpinned', 'topic.invisible', 'topic.archetypeObject.notDefault'),
shouldRerender: Discourse.View.renderIfChanged('topic.closed', 'topic.pinned', 'topic.visible', 'topic.unpinned'), shouldRerender: Discourse.View.renderIfChanged('topic.archived','topic.closed', 'topic.pinned', 'topic.visible', 'topic.unpinned'),
didInsertElement: function(){ didInsertElement: function(){
var self = this; var self = this;
@ -18,10 +18,6 @@ Discourse.TopicStatusComponent = Ember.Component.extend({
this.$('a').click(function(){ this.$('a').click(function(){
var topic = self.get('topic'); var topic = self.get('topic');
// could be passed in a controller
if(topic.constructor && topic.constructor.toString() !== 'Discourse.Topic') {
topic = topic.get('model');
}
// only pin unpin for now // only pin unpin for now
if (topic.get('pinned')) { if (topic.get('pinned')) {
topic.clearPin(); topic.clearPin();
@ -56,6 +52,7 @@ Discourse.TopicStatusComponent = Ember.Component.extend({
}; };
renderIconIf('topic.closed', 'lock', 'locked'); renderIconIf('topic.closed', 'lock', 'locked');
renderIconIf('topic.archived', 'lock', 'archived');
renderIconIf('topic.pinned', 'thumb-tack', 'pinned', togglePin); renderIconIf('topic.pinned', 'thumb-tack', 'pinned', togglePin);
renderIconIf('topic.unpinned', 'thumb-tack unpinned', 'unpinned', togglePin); renderIconIf('topic.unpinned', 'thumb-tack unpinned', 'unpinned', togglePin);
renderIconIf('topic.invisible', 'eye-slash', 'invisible'); renderIconIf('topic.invisible', 'eye-slash', 'invisible');

View file

@ -11,7 +11,7 @@
{{/if}} {{/if}}
<td class='main-link clearfix' {{bind-attr colspan="titleColSpan"}}> <td class='main-link clearfix' {{bind-attr colspan="titleColSpan"}}>
{{topicStatus topic=this}} {{topicStatus topic=this.model}}
{{{topicLink this}}} {{{topicLink this}}}
{{#if unread}} {{#if unread}}
<a href="{{lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unread}}</a> <a href="{{lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unread}}</a>

View file

@ -1145,6 +1145,8 @@ en:
topic_statuses: topic_statuses:
locked: locked:
help: "This topic is closed; it no longer accepts new replies" help: "This topic is closed; it no longer accepts new replies"
archived:
help: "This topic is archived; it no longer accepts new replies"
unpinned: unpinned:
title: "Unpinned" title: "Unpinned"
help: "This topic is unpinned; it will display in default order" help: "This topic is unpinned; it will display in default order"