mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 22:08:33 +08:00
8dfd0e0374
* DEV: uses with private API for currentPath router.currentRouteName as a slightly different API and application.currentPath is deprecated * another fix
39 lines
974 B
JavaScript
39 lines
974 B
JavaScript
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
export default Ember.Controller.extend({
|
|
router: Ember.inject.service(),
|
|
|
|
@computed("siteSettings.enable_group_directory")
|
|
showGroups(enableGroupDirectory) {
|
|
return !enableGroupDirectory;
|
|
},
|
|
|
|
@computed("siteSettings.enable_badges")
|
|
showBadges(enableBadges) {
|
|
return this.currentUser.get("admin") && enableBadges;
|
|
},
|
|
|
|
@computed("router._router.currentPath")
|
|
adminContentsClassName(currentPath) {
|
|
let cssClasses = currentPath
|
|
.split(".")
|
|
.filter(segment => {
|
|
return (
|
|
segment !== "index" &&
|
|
segment !== "loading" &&
|
|
segment !== "show" &&
|
|
segment !== "admin"
|
|
);
|
|
})
|
|
.map(Ember.String.dasherize)
|
|
.join(" ");
|
|
|
|
// this is done to avoid breaking css customizations
|
|
if (cssClasses.includes("dashboard")) {
|
|
cssClasses = `${cssClasses} dashboard-next`;
|
|
}
|
|
|
|
return cssClasses;
|
|
}
|
|
});
|