diff --git a/app/assets/javascripts/discourse/controllers/topic_list_item_controller.js b/app/assets/javascripts/discourse/controllers/topic_list_item_controller.js index 80c6010f6..555493d95 100644 --- a/app/assets/javascripts/discourse/controllers/topic_list_item_controller.js +++ b/app/assets/javascripts/discourse/controllers/topic_list_item_controller.js @@ -10,7 +10,6 @@ Discourse.TopicListItemController = Ember.ObjectController.extend({ needs: ['discoveryTopics'], canStar: Em.computed.alias('controllers.discoveryTopics.currentUser.id'), - hideCategory: Em.computed.alias('controllers.discoveryTopics.hideCategory'), bulkSelectEnabled: Em.computed.alias('controllers.discoveryTopics.bulkSelectEnabled'), checked: function(key, value) { @@ -27,6 +26,16 @@ Discourse.TopicListItemController = Ember.ObjectController.extend({ return selected.contains(topic); }.property('controllers.discoveryTopics.selected.length'), + titleColSpan: function() { + // Uncategorized pinned topics will span the title and category column in the topic list. + return (!this.get('controllers.discoveryTopics.hideCategory') && + this.get('model.isPinnedUncategorized') ? 2 : 1); + }.property('controllers.discoveryTopics.hideCategory', 'model.isPinnedUncategorized'), + + hideCategory: function() { + return this.get('controllers.discoveryTopics.hideCategory') || this.get('titleColSpan') > 1; + }.property('controllers.discoveryTopics.hideCategory', 'titleColSpan'), + actions: { toggleStar: function() { this.get('model').toggleStar(); diff --git a/app/assets/javascripts/discourse/models/topic.js b/app/assets/javascripts/discourse/models/topic.js index 867bd5db1..dc9145c82 100644 --- a/app/assets/javascripts/discourse/models/topic.js +++ b/app/assets/javascripts/discourse/models/topic.js @@ -260,6 +260,10 @@ Discourse.Topic = Discourse.Model.extend({ }, + isPinnedUncategorized: function() { + return this.get('pinned') && this.get('category.isUncategorizedCategory'); + }.property('pinned', 'category.isUncategorizedCategory'), + /** Clears the pin from a topic for the currently logged in user 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 0f5281f80..640b86bf6 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 @@ -10,7 +10,7 @@ {{/if}} {{/if}} - + {{topicStatus topic=this}} {{{topicLink this}}} {{#if unread}}