discourse/app/assets/javascripts/admin/addon/routes/admin-badges/show.js
David Taylor 32665cf9dd
DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
2024-11-19 20:45:18 +00:00

32 lines
710 B
JavaScript

import { get } from "@ember/object";
import Route from "@ember/routing/route";
import { service } from "@ember/service";
import Badge from "discourse/models/badge";
import { i18n } from "discourse-i18n";
export default class AdminBadgesShowRoute extends Route {
@service dialog;
serialize(m) {
return { badge_id: get(m, "id") || "new" };
}
model(params) {
if (params.badge_id === "new") {
return Badge.create({
name: i18n("admin.badges.new_badge"),
});
}
return this.modelFor("adminBadges").findBy(
"id",
parseInt(params.badge_id, 10)
);
}
setupController(controller) {
super.setupController(...arguments);
controller.setup();
}
}