From 668a5ff526a1a4f6ed330d27a5e2d6013368c5da Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 11 Apr 2014 10:27:04 +1000 Subject: [PATCH] FEATURE: lock icon for archived topics remove model sniffing hack --- .../discourse/components/topic_status_component.js | 9 +++------ .../templates/list/topic_list_item.js.handlebars | 2 +- config/locales/client.en.yml | 2 ++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/components/topic_status_component.js b/app/assets/javascripts/discourse/components/topic_status_component.js index 249fd4aa4..d136673d4 100644 --- a/app/assets/javascripts/discourse/components/topic_status_component.js +++ b/app/assets/javascripts/discourse/components/topic_status_component.js @@ -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'); diff --git a/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars b/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars index 2b292d26b..65c7898a8 100644 --- a/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars +++ b/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars @@ -11,7 +11,7 @@ {{/if}} - {{topicStatus topic=this}} + {{topicStatus topic=this.model}} {{{topicLink this}}} {{#if unread}} {{unread}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index d28682dbe..15dbfbffb 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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"