Trust levels order exhibition in the badges page

AI-generated summary

The discussion revolves around the order of trust levels displayed on the badges page, which is currently alphabetical and not reflecting the intended sequence. jenni_alencar notes that trust level 1 appears after level 2, and asks how to fix it. AndreSpecker explains the alphabetical sorting. awesomerobot suggests using CSS with the order property to reorder badges, providing an example for betauser and betatester, while noting potential margin adjustments due to flexbox layout. They also mention that layout improvements with CSS Grid will eliminate this issue once IE11 support is dropped. jenni_alencar asks where to find the relevant CSS, and awesomerobot directs them to the admin > customize > themes section and the user-badges.scss file in Discourse’s source code for reference.

I changed the name of my trust levels, but it changed the order shown on the badges page, for example, trust level 1 is being displayed after trust level 2, is there a way to change that?

BetaUser should be showing up before BetaTester, how can I do it?

It is listed in alphabetical order

You can do it with CSS, for example

.badge-card.betauser {
    order: -1;
}

Because of how the badge page layout is currently built (flexbox), you might also need to adjust some margins at different screen widths if you change the order.

.badge-card.betauser {
    order: -1;
  @media screen and (max-width: 850px) {
    margin-right: 1.63%
  }
}

.badge-card.betatester {
  @media screen and (max-width: 850px) {
    margin-right: 0;
  }
}

The need to fuss with the margins will go away later this year once we drop IE11 support (because we can then build the layout with grid instead of flexbox).

Where can I find the CSS of the badges? Can you show the path to me? Thank you

You can add custom CSS under admin > customize > themes, the easiest way to find the relevant CSS classes is to right click an element on the page you want to edit and inspect it in your browser.

Otherwise you have to dig through Discourse’s source for reference (note, you can’t directly edit Discourse’s CSS… you have to override what you need in a theme) The badge page CSS is in this file discourse/app/assets/stylesheets/common/base/user-badges.scss at main · discourse/discourse · GitHub