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({
classNames: ['topic-statuses'],
hasDisplayableStatus: Em.computed.or('topic.closed', 'topic.pinned', 'topic.unpinned', 'topic.invisible', 'topic.archetypeObject.notDefault'),
shouldRerender: Discourse.View.renderIfChanged('topic.closed', 'topic.pinned', 'topic.visible', 'topic.unpinned'),
hasDisplayableStatus: Em.computed.or('topic.archived','topic.closed', 'topic.pinned', 'topic.unpinned', 'topic.invisible', 'topic.archetypeObject.notDefault'),
shouldRerender: Discourse.View.renderIfChanged('topic.archived','topic.closed', 'topic.pinned', 'topic.visible', 'topic.unpinned'),
didInsertElement: function(){
var self = this;
@ -18,10 +18,6 @@ Discourse.TopicStatusComponent = Ember.Component.extend({
this.$('a').click(function(){
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
if (topic.get('pinned')) {
topic.clearPin();
@ -56,6 +52,7 @@ Discourse.TopicStatusComponent = Ember.Component.extend({
};
renderIconIf('topic.closed', 'lock', 'locked');
renderIconIf('topic.archived', 'lock', 'archived');
renderIconIf('topic.pinned', 'thumb-tack', 'pinned', togglePin);
renderIconIf('topic.unpinned', 'thumb-tack unpinned', 'unpinned', togglePin);
renderIconIf('topic.invisible', 'eye-slash', 'invisible');

View File

@ -11,7 +11,7 @@
{{/if}}
<td class='main-link clearfix' {{bind-attr colspan="titleColSpan"}}>
{{topicStatus topic=this}}
{{topicStatus topic=this.model}}
{{{topicLink this}}}
{{#if unread}}
<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:
locked:
help: "This topic is closed; it no longer accepts new replies"
archived:
help: "This topic is archived; it no longer accepts new replies"
unpinned:
title: "Unpinned"
help: "This topic is unpinned; it will display in default order"