mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 00:13:37 +08:00
Pinned uncategorized topics span the title and category column in topic lists
This commit is contained in:
parent
113057bfa9
commit
5b559d9631
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user