mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Remove inline script from default.hbs
no issue - added config values as data attributes - removed inline script - removed current-user.js
This commit is contained in:
parent
95d3925c3e
commit
c2c0d1bade
3 changed files with 8 additions and 37 deletions
|
@ -1,36 +0,0 @@
|
|||
var currentUserInitializer = {
|
||||
name: 'currentUser',
|
||||
after: 'store',
|
||||
|
||||
initialize: function (container, application) {
|
||||
var store = container.lookup('store:main'),
|
||||
preloadedUser = application.get('user');
|
||||
|
||||
// If we don't have a user, don't do the injection
|
||||
if (!preloadedUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Push the preloaded user into the data store
|
||||
store.pushPayload({
|
||||
users: [preloadedUser]
|
||||
});
|
||||
|
||||
// Signal to wait until the user is loaded before continuing.
|
||||
application.deferReadiness();
|
||||
|
||||
// Find the user (which should be fast since we just preloaded it in the store)
|
||||
store.find('user', preloadedUser.id).then(function (user) {
|
||||
// Register the value for injection
|
||||
application.register('user:current', user, { instantiate: false });
|
||||
|
||||
// Inject into the routes and controllers as the user property.
|
||||
application.inject('route', 'user', 'user:current');
|
||||
application.inject('controller', 'user', 'user:current');
|
||||
|
||||
application.advanceReadiness();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default currentUserInitializer;
|
|
@ -2,7 +2,10 @@ var ConfigInitializer = {
|
|||
name: 'config',
|
||||
|
||||
initialize: function (container, application) {
|
||||
application.register('ghost:config', application.get('config'), {instantiate: false});
|
||||
var apps = $('body').data('apps'),
|
||||
fileStorage = $('body').data('filestorage');
|
||||
|
||||
application.register('ghost:config', {apps: apps, fileStorage: fileStorage}, {instantiate: false});
|
||||
|
||||
application.inject('route', 'config', 'ghost:config');
|
||||
application.inject('controller', 'config', 'ghost:config');
|
||||
|
|
4
ghost/admin/loader.js
Normal file
4
ghost/admin/loader.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
// Loader to create the Ember.js application
|
||||
/*global require */
|
||||
|
||||
window.App = require('ghost/app')['default'].create();
|
Loading…
Add table
Reference in a new issue