2018-06-15 23:03:24 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
2017-10-31 02:13:49 +08:00
|
|
|
|
2015-08-12 00:27:07 +08:00
|
|
|
export default Ember.Controller.extend({
|
2019-07-19 01:29:37 +08:00
|
|
|
router: Ember.inject.service(),
|
2017-10-31 02:13:49 +08:00
|
|
|
|
2018-10-12 07:34:47 +08:00
|
|
|
@computed("siteSettings.enable_group_directory")
|
|
|
|
showGroups(enableGroupDirectory) {
|
|
|
|
return !enableGroupDirectory;
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed("siteSettings.enable_badges")
|
|
|
|
showBadges(enableBadges) {
|
|
|
|
return this.currentUser.get("admin") && enableBadges;
|
2017-10-31 02:13:49 +08:00
|
|
|
},
|
|
|
|
|
2019-07-19 05:00:39 +08:00
|
|
|
@computed("router._router.currentPath")
|
2017-10-31 02:13:49 +08:00
|
|
|
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" &&
|
2019-07-19 05:00:39 +08:00
|
|
|
segment !== "admin"
|
2018-06-15 23:03:24 +08:00
|
|
|
);
|
|
|
|
})
|
|
|
|
.map(Ember.String.dasherize)
|
|
|
|
.join(" ");
|
2019-04-01 18:39:49 +08:00
|
|
|
|
|
|
|
// this is done to avoid breaking css customizations
|
2019-07-19 05:00:39 +08:00
|
|
|
if (cssClasses.includes("dashboard")) {
|
|
|
|
cssClasses = `${cssClasses} dashboard-next`;
|
2019-04-01 18:39:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return cssClasses;
|
2017-10-31 02:13:49 +08:00
|
|
|
}
|
2014-03-19 12:18:04 +08:00
|
|
|
});
|