discourse/app/assets/javascripts/admin/controllers/admin.js.es6

42 lines
1.1 KiB
Plaintext
Raw Normal View History

import discourseComputed from "discourse-common/utils/decorators";
2019-10-30 01:31:44 +08:00
import { inject as service } from "@ember/service";
import Controller from "@ember/controller";
import { dasherize } from "@ember/string";
export default Controller.extend({
router: service(),
@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) {
2019-04-01 18:39:49 +08:00
let cssClasses = currentPath
2018-06-15 23:03:24 +08:00
.split(".")
.filter(segment => {
return (
segment !== "index" &&
segment !== "loading" &&
segment !== "show" &&
segment !== "admin"
2018-06-15 23:03:24 +08:00
);
})
.map(dasherize)
2018-06-15 23:03:24 +08:00
.join(" ");
2019-04-01 18:39:49 +08:00
// this is done to avoid breaking css customizations
if (cssClasses.includes("dashboard")) {
cssClasses = `${cssClasses} dashboard-next`;
2019-04-01 18:39:49 +08:00
}
return cssClasses;
}
});