feat: allow passing in container to threadTools

This commit is contained in:
Barış Soner Uşaklı
2020-09-15 16:05:45 -04:00
parent 99f24c5997
commit 7148be2fd1
3 changed files with 17 additions and 17 deletions

View File

@@ -7,10 +7,8 @@ define('forum/topic/threadTools', [
], function (components, translator) {
var ThreadTools = {};
ThreadTools.init = function (tid) {
renderMenu();
var topicContainer = $('.topic');
ThreadTools.init = function (tid, topicContainer) {
renderMenu(topicContainer);
topicContainer.on('click', '[component="topic/delete"]', function () {
topicCommand('delete', tid);
@@ -139,8 +137,8 @@ define('forum/topic/threadTools', [
}
};
function renderMenu() {
$('.topic').on('show.bs.dropdown', '.thread-tools', function () {
function renderMenu(container) {
container.on('show.bs.dropdown', '.thread-tools', function () {
var $this = $(this);
var dropdownMenu = $this.find('.dropdown-menu');
if (dropdownMenu.html()) {