From 4d414d0b63221df8658c2f133035ffba1b9aee8c Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sun, 12 Apr 2015 11:19:22 -0400 Subject: [PATCH] .category-box and .post-preview now components --- public/src/client/categories.js | 12 ++++-------- public/src/modules/components.js | 6 +++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/src/client/categories.js b/public/src/client/categories.js index f3ec819130..33db4ef784 100644 --- a/public/src/client/categories.js +++ b/public/src/client/categories.js @@ -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(); } diff --git a/public/src/modules/components.js b/public/src/modules/components.js index 85f8b04526..71ae09ab99 100644 --- a/public/src/modules/components.js +++ b/public/src/modules/components.js @@ -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 + '"]'); } };