0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Hide settings/apps unless apps:true is in config.js

fixes #3031

- Adds an initializer for passing config to the frontend, it's not pretty but it works
- Forwards the apps route and hides the apps menu item if apps:true is not present in config.js
This commit is contained in:
Hannah Wolfe 2014-06-23 17:01:43 +01:00
parent bcc135360c
commit 725e00442d
4 changed files with 29 additions and 5 deletions

View file

@ -0,0 +1,5 @@
var SettingsController = Ember.Controller.extend({
showApps: Ember.computed.bool('config.apps')
});
export default SettingsController;

View file

@ -0,0 +1,12 @@
var ConfigInitializer = {
name: 'config',
initialize: function (container, application) {
application.register('ghost:config', application.get('config'), {instantiate: false});
application.inject('route', 'config', 'ghost:config');
application.inject('controller', 'config', 'ghost:config');
}
};
export default ConfigInitializer;

View file

@ -1,6 +1,11 @@
import AuthenticatedRoute from 'ghost/routes/authenticated';
var AppsRoute = AuthenticatedRoute.extend({
beforeModel: function () {
if (!this.get('config.apps')) {
this.transitionTo('settings.general');
}
},
model: function () {
return this.store.find('app');
}

View file

@ -13,9 +13,11 @@
{{#link-to "settings.user"}}User{{/link-to}}
{{/view}}
{{#if showApps}}
{{#view "item-view" tagName="li" class="apps"}}
{{#link-to "settings.apps"}}Apps{{/link-to}}
{{/view}}
{{/if}}
</ul>
</nav>
</aside>