discourse/app/assets/javascripts/admin/addon/components/admin-badges-list.gjs
Ted Johansson e8997b6202
DEV: Add Settings tab to admin Badges page (#32251)
This change does two things:

Modernizes the admin badges UI implementation. (Routes + controllers → components + services.)
Adds a Settings tab to the new badges page.
For all intents and purposes, this change is a lift-and-shift modernization. The addition of the settings tab is trivial once that is covered.
2025-04-21 09:41:29 +08:00

39 lines
1.1 KiB
Text

import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import BadgeButton from "discourse/components/badge-button";
import { i18n } from "discourse-i18n";
export default class AdminBadgesList extends Component {
@service router;
get selectedRoute() {
const currentRoute = this.router.currentRouteName;
if (currentRoute === "adminBadges.index") {
return "adminBadges.show";
} else {
return currentRoute;
}
}
<template>
<div class="content-list">
<ul class="admin-badge-list">
{{#each @badges as |badge|}}
<li class="admin-badge-list-item">
<LinkTo @route={{this.selectedRoute}} @model={{badge.id}}>
<BadgeButton @badge={{badge}} />
{{#if badge.newBadge}}
<span class="list-badge">{{i18n
"filters.new.lower_title"
}}</span>
{{/if}}
</LinkTo>
</li>
{{/each}}
</ul>
</div>
{{outlet}}
</template>
}