fixed topics not appearing after a post in category view

This commit is contained in:
Baris Usakli
2013-09-25 12:30:07 -04:00
parent 585e5cd88f
commit c2aac916aa
2 changed files with 13 additions and 18 deletions

View File

@@ -39,28 +39,25 @@
var html = templates.prepare(templates['category'].blocks['topics']).parse({
topics: [data]
}),
topic = document.createElement('div'),
container = document.getElementById('topics-container'),
topics = document.querySelectorAll('#topics-container a'),
numTopics = topics.length,
x;
topic = $(html),
container = $('#topics-container'),
topics = $('#topics-container').children(),
numTopics = topics.length;
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
topic.innerHTML = html;
topic = topic.querySelector('a');
if (numTopics > 0) {
for (x = 0; x < numTopics; x++) {
if (topics[x].querySelector('.icon-pushpin')) continue;
container.insertBefore(topic, topics[x]);
$(topic).hide().fadeIn('slow');
for (var x = 0; x < numTopics; x++) {
if ($(topics[x]).find('.icon-pushpin').length)
continue;
topic.insertBefore(topics[x]);
topic.hide().fadeIn('slow');
break;
}
} else {
container.insertBefore(topic, null);
$(topic).hide().fadeIn('slow');
container.append(topic);
topic.hide().fadeIn('slow');
}
socket.emit('api:categories.getRecentReplies', cid);