Skip to content

Commit

Permalink
feat: allow adding nested replies to a target component
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Sep 18, 2020
1 parent 43571ba commit ddc0ac3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions public/src/client/topic/replies.js
Expand Up @@ -34,8 +34,14 @@ define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'],
hideReplies: config.hasOwnProperty('showNestedReplies') ? !config.showNestedReplies : true,
};
app.parseAndTranslate('topic', 'posts', tplData, function (html) {
$('<div>', { component: 'post/replies' }).html(html).hide().insertAfter(button)
.slideDown('fast');
var repliesEl = $('<div>', { component: 'post/replies' }).html(html).hide();
if (button.attr('data-target-component')) {
post.find('[component="' + button.attr('data-target-component') + '"]').html(repliesEl);
} else {
repliesEl.insertAfter(button);
}

repliesEl.slideDown('fast');
posts.onNewPostsAddedToDom(html);
$(window).trigger('action:posts.loaded', { posts: data });
});
Expand Down

0 comments on commit ddc0ac3

Please sign in to comment.