在主题列表中显示主题作者

Hello!

I would like to change the topic list to only display the topic’s author instead of a list of frequent posters in a topic.

Would there be an easy way to accomplish this?

EDIT: Here’s a more complete solution I threw together that you can download as a theme component:

8 个赞

@tshenry, awesome, I am looking for a similar solution but i would like to display the poster username instead of their image.

Where could we take a look into the repo of your component?

Ah! I definitely goofed by failing to provide a way to download or see the code! It’s just some CSS. I’ll bundle it into a proper theme component on GitHub when I get a chance.

// Hide all posters except the topic author
.topic-list .posters {
    width: 75px;
    text-align: center;
    
    // Only show first poster
    a:not(:first-of-type) {
        display: none;
    }
    // Get rid of offset and decoration
    a:first-child .avatar.latest:not(.single) {
        position: static;
        box-shadow: none;
        border: 0;
    }
    // Adjustment for center alignment
    & > a {
        float: none;
        margin-right: 0;
    }
}

// Make sure the correct user is showing at smaller width
@media screen and (max-width: 850px) {
    .topic-list td.posters {
        // Ensure first poster is showing
        a:not(.latest) {
            display: block;
        }
        // Hide everything else
        a:not(:first-of-type) {
            display: none;
        }
    }
}

What you are trying to accomplish is probably closer to:

4 个赞

这太棒了,谢谢!

移动端 CSS 代码似乎不起作用。Discourse 最近是否更改了移动端帖子作者的组织方式?有什么修复建议吗?

谢谢!

上述 CSS 从未针对移动端设计,但我认为这大概就是你想要的?

1 个赞

是的!我无法像使用你的 CSS 代码那样,通过 CSS 在移动主题中将仅限 OP 的布局限制在特定类别。你有什么建议能帮助我在移动设备上实现这一功能吗?(抱歉,我是 Ember.js 的新手 :/)

不幸的是,仅通过类别进行筛选对于该移动端组件来说是一个相当重大的改动,因为仅凭 Handlebars 文件无法检查类别。你可以尝试以下几种方法:

  • Dev 主题下发帖讨论,看看是否有开发人员能提供一些指导
  • 浏览现有涉及类别的主题组件的代码,寻找灵感或思路
  • Marketplace 发布需求,付费请人帮你实现该功能
2 个赞