Exibir autor do tópico na lista de tópicos

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 curtidas

@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 curtidas

Isso é super legal. Obrigado!

O código CSS para dispositivos móveis não parece estar funcionando. O Discourse mudou recentemente a forma como organiza os postadores para mobile? Alguma dica sobre como corrigir isso?

Obrigado!

O CSS acima nunca foi destinado a dispositivos móveis, mas acho que isso provavelmente é o que você está procurando?

1 curtida

Sim! Não consegui restringir esse layout exclusivo para OP a categorias específicas via CSS usando o tema móvel, como consigo fazer com o seu código CSS. Você tem alguma dica de como posso fazer isso no mobile? (desculpe, sou novo no Ember.js :/)

Infelizmente, limitar por categoria seria uma adição bastante significativa a esse componente móvel, já que não é possível verificar a categoria apenas com o arquivo Handlebars. Existem algumas opções que você pode seguir:

  • Crie um tópico em Development sobre o assunto e veja se algum desenvolvedor consegue te dar algumas dicas
  • Analise o código de componentes de tema existentes que envolvem categorias e veja se consegue encontrar ideias/inspiração
  • Faça um anúncio no Marketplace e contrate alguém para desenvolvê-lo para você
2 curtidas