From 69f24ed92aaced34e7638de275016affdf3a7a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 27 Mar 2023 11:09:22 -0400 Subject: [PATCH] feat: add support for selected topic count --- public/src/modules/topicSelect.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/src/modules/topicSelect.js b/public/src/modules/topicSelect.js index 526dd530bc..446989d5b8 100644 --- a/public/src/modules/topicSelect.js +++ b/public/src/modules/topicSelect.js @@ -35,6 +35,15 @@ define('topicSelect', ['components'], function (components) { select.toggleClass('fa-check-square-o', isSelected); select.toggleClass('fa-square-o', !isSelected); select.parents('[component="category/topic"]').toggleClass('selected', isSelected); + updateSelectedBadgeCount(); + } + + function updateSelectedBadgeCount() { + const badge = $('[component="topic/selected/badge"]'); + if (badge.length) { + const count = topicsContainer.find('[component="category/topic"].selected').length; + badge.text(count > 0 ? count : ''); + } } TopicSelect.getSelectedTids = function () {