mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 10:43:43 +08:00
be354e7950
This commit was generated using the ember-native-class-codemod along with a handful of manual updates
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import { inject as service } from "@ember/service";
|
|
import Controller from "@ember/controller";
|
|
import { dasherize } from "@ember/string";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
export default class AdminController extends Controller {
|
|
@service router;
|
|
|
|
@discourseComputed("siteSettings.enable_group_directory")
|
|
showGroups(enableGroupDirectory) {
|
|
return !enableGroupDirectory;
|
|
}
|
|
|
|
@discourseComputed("siteSettings.enable_badges")
|
|
showBadges(enableBadges) {
|
|
return this.currentUser.get("admin") && enableBadges;
|
|
}
|
|
|
|
@discourseComputed("router._router.currentPath")
|
|
adminContentsClassName(currentPath) {
|
|
let cssClasses = currentPath
|
|
.split(".")
|
|
.filter((segment) => {
|
|
return (
|
|
segment !== "index" &&
|
|
segment !== "loading" &&
|
|
segment !== "show" &&
|
|
segment !== "admin"
|
|
);
|
|
})
|
|
.map(dasherize)
|
|
.join(" ");
|
|
|
|
// this is done to avoid breaking css customizations
|
|
if (cssClasses.includes("dashboard")) {
|
|
cssClasses = `${cssClasses} dashboard-next`;
|
|
}
|
|
|
|
return cssClasses;
|
|
}
|
|
}
|