mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 17:35:46 +01:00
.category-box and .post-preview now components
This commit is contained in:
@@ -29,23 +29,19 @@ define('forum/categories', ['components', 'translator'], function(components, tr
|
||||
};
|
||||
|
||||
function renderNewPost(cid, post) {
|
||||
var category = components.get('category/topic', 'cid', cid);
|
||||
if (!category.length) {
|
||||
return;
|
||||
}
|
||||
var categoryBox = category.find('.category-box');
|
||||
var category = components.get('categories/category', 'cid', cid);
|
||||
var numRecentReplies = category.attr('data-numRecentReplies');
|
||||
if (!numRecentReplies || !parseInt(numRecentReplies, 10)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var recentPosts = categoryBox.find('.post-preview');
|
||||
var recentPosts = category.find('[component="category/posts"]');
|
||||
var insertBefore = recentPosts.first();
|
||||
|
||||
parseAndTranslate([post], function(html) {
|
||||
html.hide();
|
||||
if(recentPosts.length === 0) {
|
||||
html.appendTo(categoryBox);
|
||||
html.appendTo(category);
|
||||
} else {
|
||||
html.insertBefore(recentPosts.first());
|
||||
}
|
||||
@@ -54,7 +50,7 @@ define('forum/categories', ['components', 'translator'], function(components, tr
|
||||
|
||||
app.createUserTooltips();
|
||||
|
||||
if (categoryBox.find('.post-preview').length > parseInt(numRecentReplies, 10)) {
|
||||
if (category.find('[component="category/posts"]').length > parseInt(numRecentReplies, 10)) {
|
||||
recentPosts.last().remove();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@ define('components', function() {
|
||||
},
|
||||
|
||||
'category/topic': function(name, value) {
|
||||
return $('[data-' + name + '="' + value + '"]');
|
||||
return $('[component="category/topic"][data-' + name + '="' + value + '"]');
|
||||
},
|
||||
|
||||
'categories/category': function(name, value) {
|
||||
return $('[component="categories/category"][data-' + name + '="' + value + '"]');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user