2019-10-23 13:06:54 -04:00
|
|
|
import Controller from "@ember/controller";
|
2019-11-05 13:43:49 -05:00
|
|
|
import { dasherize } from "@ember/string";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-10-29 13:31:44 -04:00
|
|
|
import { inject as service } from "@ember/service";
|
2017-10-30 14:13:49 -04:00
|
|
|
|
2019-10-23 13:06:54 -04:00
|
|
|
export default Controller.extend({
|
2019-10-29 13:29:08 -04:00
|
|
|
router: service(),
|
2017-10-30 14:13:49 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("siteSettings.enable_group_directory")
|
2018-10-11 19:34:47 -04:00
|
|
|
showGroups(enableGroupDirectory) {
|
|
|
|
return !enableGroupDirectory;
|
|
|
|
},
|
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("siteSettings.enable_badges")
|
2018-10-11 19:34:47 -04:00
|
|
|
showBadges(enableBadges) {
|
|
|
|
return this.currentUser.get("admin") && enableBadges;
|
2017-10-30 14:13:49 -04:00
|
|
|
},
|
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("router._router.currentPath")
|
2017-10-30 14:13:49 -04:00
|
|
|
adminContentsClassName(currentPath) {
|
2019-04-01 06:39:49 -04:00
|
|
|
let cssClasses = currentPath
|
2017-10-30 14:13:49 -04:00
|
|
|
.split(".")
|
|
|
|
.filter((segment) => {
|
|
|
|
return (
|
|
|
|
segment !== "index" &&
|
|
|
|
segment !== "loading" &&
|
|
|
|
segment !== "show" &&
|
2019-07-18 17:00:39 -04:00
|
|
|
segment !== "admin"
|
2017-10-30 14:13:49 -04:00
|
|
|
);
|
|
|
|
})
|
2019-11-05 13:43:49 -05:00
|
|
|
.map(dasherize)
|
2017-10-30 14:13:49 -04:00
|
|
|
.join(" ");
|
2019-04-01 06:39:49 -04:00
|
|
|
|
|
|
|
// this is done to avoid breaking css customizations
|
2019-07-18 17:00:39 -04:00
|
|
|
if (cssClasses.includes("dashboard")) {
|
|
|
|
cssClasses = `${cssClasses} dashboard-next`;
|
2019-04-01 06:39:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return cssClasses;
|
2017-10-30 14:13:49 -04:00
|
|
|
},
|
2014-03-19 00:18:04 -04:00
|
|
|
});
|