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:
parent
bcc135360c
commit
725e00442d
4 changed files with 29 additions and 5 deletions
5
ghost/admin/controllers/settings.js
Normal file
5
ghost/admin/controllers/settings.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
var SettingsController = Ember.Controller.extend({
|
||||||
|
showApps: Ember.computed.bool('config.apps')
|
||||||
|
});
|
||||||
|
|
||||||
|
export default SettingsController;
|
12
ghost/admin/initializers/ghost-config.js
Normal file
12
ghost/admin/initializers/ghost-config.js
Normal 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;
|
|
@ -1,6 +1,11 @@
|
||||||
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||||
|
|
||||||
var AppsRoute = AuthenticatedRoute.extend({
|
var AppsRoute = AuthenticatedRoute.extend({
|
||||||
|
beforeModel: function () {
|
||||||
|
if (!this.get('config.apps')) {
|
||||||
|
this.transitionTo('settings.general');
|
||||||
|
}
|
||||||
|
},
|
||||||
model: function () {
|
model: function () {
|
||||||
return this.store.find('app');
|
return this.store.find('app');
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,11 @@
|
||||||
{{#link-to "settings.user"}}User{{/link-to}}
|
{{#link-to "settings.user"}}User{{/link-to}}
|
||||||
{{/view}}
|
{{/view}}
|
||||||
|
|
||||||
{{#view "item-view" tagName="li" class="apps"}}
|
{{#if showApps}}
|
||||||
{{#link-to "settings.apps"}}Apps{{/link-to}}
|
{{#view "item-view" tagName="li" class="apps"}}
|
||||||
{{/view}}
|
{{#link-to "settings.apps"}}Apps{{/link-to}}
|
||||||
|
{{/view}}
|
||||||
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
Loading…
Add table
Reference in a new issue