Pinned uncategorized topics span the title and category column in topic lists

This commit is contained in:
Neil Lalonde 2014-02-06 14:38:04 -05:00
parent 113057bfa9
commit 5b559d9631
3 changed files with 15 additions and 2 deletions

View File

@ -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();

View File

@ -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

View File

@ -10,7 +10,7 @@
{{/if}}
{{/if}}
<td class='main-link clearfix'>
<td class='main-link clearfix' {{bind-attr colspan="titleColSpan"}}>
{{topicStatus topic=this}}
{{{topicLink this}}}
{{#if unread}}