mirror of
https://github.com/discourse/discourse.git
synced 2025-02-18 17:25:15 +00:00
FIX: columns of uncategorized pinned topics shift when the topic gets unpinned
This commit is contained in:
parent
8fe47539c8
commit
38cc1bf6c1
@ -1,6 +1,6 @@
|
|||||||
{{#if controller.bulkSelectEnabled}}
|
{{#if controller.bulkSelectEnabled}}
|
||||||
<td class='star'>
|
<td class='star'>
|
||||||
<input type="checkbox" class="bulk-select">
|
<input type="checkbox" class="bulk-select">
|
||||||
</td>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<td class='main-link clearfix' colspan="{{titleColSpan}}">
|
<td class='main-link clearfix' colspan="{{titleColSpan}}">
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
|
|
||||||
export default Discourse.View.extend(StringBuffer, {
|
export default Discourse.View.extend(StringBuffer, {
|
||||||
|
topic: Em.computed.alias("content"),
|
||||||
rerenderTriggers: ['controller.bulkSelectEnabled', 'topic.pinned'],
|
rerenderTriggers: ['controller.bulkSelectEnabled', 'topic.pinned'],
|
||||||
tagName: 'tr',
|
tagName: 'tr',
|
||||||
rawTemplate: 'list/topic_list_item.raw',
|
rawTemplate: 'list/topic_list_item.raw',
|
||||||
@ -8,6 +9,8 @@ export default Discourse.View.extend(StringBuffer, {
|
|||||||
':topic-list-item',
|
':topic-list-item',
|
||||||
'unboundClassNames',
|
'unboundClassNames',
|
||||||
'selected'],
|
'selected'],
|
||||||
|
attributeBindings: ['data-topic-id'],
|
||||||
|
'data-topic-id': Em.computed.alias('topic.id'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
select: function(){
|
select: function(){
|
||||||
@ -47,14 +50,11 @@ export default Discourse.View.extend(StringBuffer, {
|
|||||||
return classes.join(' ');
|
return classes.join(' ');
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
attributeBindings: ['data-topic-id'],
|
|
||||||
'data-topic-id': Em.computed.alias('content.id'),
|
|
||||||
titleColSpan: function(){
|
titleColSpan: function(){
|
||||||
return (!this.get('controller.hideCategory') &&
|
return (!this.get('controller.hideCategory') &&
|
||||||
this.get('content.isPinnedUncategorized') ? 2 : 1);
|
this.get('topic.isPinnedUncategorized') ? 2 : 1);
|
||||||
}.property(),
|
}.property("topic.isPinnedUncategorized"),
|
||||||
|
|
||||||
topic: Em.computed.alias("content"),
|
|
||||||
|
|
||||||
hasLikes: function(){
|
hasLikes: function(){
|
||||||
return this.get('topic.like_count') > 0;
|
return this.get('topic.like_count') > 0;
|
||||||
@ -88,13 +88,13 @@ export default Discourse.View.extend(StringBuffer, {
|
|||||||
if(target.prop('tagName') !== 'A'){
|
if(target.prop('tagName') !== 'A'){
|
||||||
target = target.find('a');
|
target = target.find('a');
|
||||||
}
|
}
|
||||||
this.container.lookup('controller:application').send("showTopicEntrance", {topic: this.get('content'), position: target.offset()});
|
this.container.lookup('controller:application').send("showTopicEntrance", {topic: this.get('topic'), position: target.offset()});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target.hasClass('bulk-select')){
|
if(target.hasClass('bulk-select')){
|
||||||
var selected = this.get('controller.selected');
|
var selected = this.get('controller.selected');
|
||||||
var topic = this.get('content');
|
var topic = this.get('topic');
|
||||||
|
|
||||||
if(target.is(':checked')){
|
if(target.is(':checked')){
|
||||||
selected.addObject(topic);
|
selected.addObject(topic);
|
||||||
@ -122,12 +122,12 @@ export default Discourse.View.extend(StringBuffer, {
|
|||||||
|
|
||||||
_highlightIfNeeded: function() {
|
_highlightIfNeeded: function() {
|
||||||
// highlight the last topic viewed
|
// highlight the last topic viewed
|
||||||
if (this.session.get('lastTopicIdViewed') === this.get('content.id')) {
|
if (this.session.get('lastTopicIdViewed') === this.get('topic.id')) {
|
||||||
this.session.set('lastTopicIdViewed', null);
|
this.session.set('lastTopicIdViewed', null);
|
||||||
this.highlight();
|
this.highlight();
|
||||||
} else if (this.get('content.highlight')) {
|
} else if (this.get('topic.highlight')) {
|
||||||
// highlight new topics that have been loaded from the server or the one we just created
|
// highlight new topics that have been loaded from the server or the one we just created
|
||||||
this.set('content.highlight', false);
|
this.set('topic.highlight', false);
|
||||||
this.highlight();
|
this.highlight();
|
||||||
}
|
}
|
||||||
}.on('didInsertElement')
|
}.on('didInsertElement')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user