From da4618a99a4e7fcb5ca663b93457a774fba4385a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 8 Aug 2025 13:20:53 -0400 Subject: [PATCH] feat: use topic thumbnails in recent/top/popular topics --- library.js | 5 ++- public/templates/widgets/partials/topics.tpl | 36 ++++++++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/library.js b/library.js index 24281ba..4a06e8b 100644 --- a/library.js +++ b/library.js @@ -294,6 +294,7 @@ Widget.renderRecentTopicsWidget = async function (widget) { topics: data.topics, numTopics: numTopics, relative_path: nconf.get('relative_path'), + sidebar: sidebarLocations.includes(widget.location), }); return widget; }; @@ -352,6 +353,7 @@ Widget.renderPopularTopics = async function (widget) { topics: data.topics, numTopics: numTopics, relative_path: nconf.get('relative_path'), + sidebar: sidebarLocations.includes(widget.location), }); return widget; }; @@ -369,6 +371,7 @@ Widget.renderTopTopics = async function (widget) { topics: data.topics, numTopics: numTopics, relative_path: nconf.get('relative_path'), + sidebar: sidebarLocations.includes(widget.location), }); return widget; }; @@ -434,7 +437,7 @@ Widget.renderSuggestedTopics = async function (widget) { topicData = topicData.filter(topic => topic && !topic.deleted); } - const sidebarLocations = ['left', 'right', 'sidebar']; + widget.html = await app.renderAsync('widgets/suggestedtopics', { topics: topicData, config: widget.templateData.config, diff --git a/public/templates/widgets/partials/topics.tpl b/public/templates/widgets/partials/topics.tpl index 6acd986..3d75fc6 100644 --- a/public/templates/widgets/partials/topics.tpl +++ b/public/templates/widgets/partials/topics.tpl @@ -1,25 +1,33 @@ {{{ each topics }}}
  • -
    - {./title} +
    + {{{ if ./thumbs.length }}} + + + + {{{ end }}} -
    - - {buildAvatar(./teaser.user, "24px", true)} - +
    + {./title} - -
    - +
    + - + - + +
    {{{ if !@last}}}