From c2c0d1badebce7c6562e8e148e1ef447dcd8f3ac Mon Sep 17 00:00:00 2001 From: Sebastian Gierlinger Date: Mon, 21 Jul 2014 20:00:54 +0200 Subject: [PATCH] Remove inline script from default.hbs no issue - added config values as data attributes - removed inline script - removed current-user.js --- ghost/admin/initializers/current-user.js | 36 ------------------------ ghost/admin/initializers/ghost-config.js | 5 +++- ghost/admin/loader.js | 4 +++ 3 files changed, 8 insertions(+), 37 deletions(-) delete mode 100644 ghost/admin/initializers/current-user.js create mode 100644 ghost/admin/loader.js diff --git a/ghost/admin/initializers/current-user.js b/ghost/admin/initializers/current-user.js deleted file mode 100644 index 3c7045b117..0000000000 --- a/ghost/admin/initializers/current-user.js +++ /dev/null @@ -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; diff --git a/ghost/admin/initializers/ghost-config.js b/ghost/admin/initializers/ghost-config.js index e6a47bc2ba..bc812c859c 100644 --- a/ghost/admin/initializers/ghost-config.js +++ b/ghost/admin/initializers/ghost-config.js @@ -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'); diff --git a/ghost/admin/loader.js b/ghost/admin/loader.js new file mode 100644 index 0000000000..e102b3a95c --- /dev/null +++ b/ghost/admin/loader.js @@ -0,0 +1,4 @@ +// Loader to create the Ember.js application +/*global require */ + +window.App = require('ghost/app')['default'].create(); \ No newline at end of file