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

41 lines
1.0 KiB
Plaintext
Raw Normal View History

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