added translation to new post creation, closes #627

v1.18.x
psychobunny 11 years ago
parent 34fc326a37
commit 5c3c2623f2

@ -83,36 +83,39 @@ define(function () {
Category.onNewTopic = function(data) { Category.onNewTopic = function(data) {
var html = templates.prepare(templates['category'].blocks['topics']).parse({ var html = templates.prepare(templates['category'].blocks['topics']).parse({
topics: [data] topics: [data]
}), });
topic = $(html),
container = $('#topics-container'),
topics = $('#topics-container').children('.category-item'),
numTopics = topics.length;
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
if (numTopics > 0) { translator.translate(html, function(translatedHTML) {
for (var x = 0; x < numTopics; x++) { var topic = $(translatedHTML),
if ($(topics[x]).find('.fa-thumb-tack').length) { container = $('#topics-container'),
if(x === numTopics - 1) { topics = $('#topics-container').children('.category-item'),
topic.insertAfter(topics[x]); numTopics = topics.length;
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
if (numTopics > 0) {
for (var x = 0; x < numTopics; x++) {
if ($(topics[x]).find('.fa-thumb-tack').length) {
if(x === numTopics - 1) {
topic.insertAfter(topics[x]);
}
continue;
} }
continue; topic.insertBefore(topics[x]);
break;
} }
topic.insertBefore(topics[x]); } else {
break; container.append(topic);
} }
} else {
container.append(topic);
}
topic.hide().fadeIn('slow'); topic.hide().fadeIn('slow');
socket.emit('api:categories.getRecentReplies', templates.get('category_id')); socket.emit('api:categories.getRecentReplies', templates.get('category_id'));
addActiveUser(data); addActiveUser(data);
$('#topics-container span.timeago').timeago(); $('#topics-container span.timeago').timeago();
});
} }
function addActiveUser(data) { function addActiveUser(data) {

Loading…
Cancel
Save