Merge pull request #3043 from jaswilli/initializers

Switch Ember initializers to public API methods
This commit is contained in:
Hannah Wolfe 2014-06-23 21:43:04 +01:00
commit 9d4b40fd81
4 changed files with 17 additions and 17 deletions

View File

@ -1,12 +1,12 @@
var CSRFTokenInitializer = { var CSRFTokenInitializer = {
name: 'csrf-token', name: 'csrf-token',
initialize: function (container) { initialize: function (container, application) {
container.register('csrf:token', $('meta[name="csrf-param"]').attr('content'), { instantiate: false }); application.register('csrf:token', $('meta[name="csrf-param"]').attr('content'), { instantiate: false });
container.injection('route', 'csrf', 'csrf:token'); application.inject('route', 'csrf', 'csrf:token');
container.injection('model', 'csrf', 'csrf:token'); application.inject('model', 'csrf', 'csrf:token');
container.injection('controller', 'csrf', 'csrf:token'); application.inject('controller', 'csrf', 'csrf:token');
} }
}; };

View File

@ -1,11 +1,11 @@
var CSRFInitializer = { var CSRFInitializer = {
name: 'csrf', name: 'csrf',
initialize: function (container) { initialize: function (container, application) {
container.register('csrf:current', $('meta[name="csrf-param"]').attr('content'), { instantiate: false }); application.register('csrf:current', $('meta[name="csrf-param"]').attr('content'), { instantiate: false });
container.injection('route', 'csrf', 'csrf:current'); application.inject('route', 'csrf', 'csrf:current');
container.injection('controller', 'csrf', 'csrf:current'); application.inject('controller', 'csrf', 'csrf:current');
} }
}; };

View File

@ -22,11 +22,11 @@ var currentUserInitializer = {
// Find the user (which should be fast since we just preloaded it in the store) // Find the user (which should be fast since we just preloaded it in the store)
store.find('user', preloadedUser.id).then(function (user) { store.find('user', preloadedUser.id).then(function (user) {
// Register the value for injection // Register the value for injection
container.register('user:current', user, { instantiate: false }); application.register('user:current', user, { instantiate: false });
// Inject into the routes and controllers as the user property. // Inject into the routes and controllers as the user property.
container.injection('route', 'user', 'user:current'); application.inject('route', 'user', 'user:current');
container.injection('controller', 'user', 'user:current'); application.inject('controller', 'user', 'user:current');
application.advanceReadiness(); application.advanceReadiness();
}); });

View File

@ -4,12 +4,12 @@ var ghostPathsInitializer = {
name: 'ghost-paths', name: 'ghost-paths',
after: 'store', after: 'store',
initialize: function (container) { initialize: function (container, application) {
container.register('ghost:paths', ghostPaths(), {instantiate: false}); application.register('ghost:paths', ghostPaths(), { instantiate: false });
container.injection('route', 'ghostPaths', 'ghost:paths'); application.inject('route', 'ghostPaths', 'ghost:paths');
container.injection('model', 'ghostPaths', 'ghost:paths'); application.inject('model', 'ghostPaths', 'ghost:paths');
container.injection('controller', 'ghostPaths', 'ghost:paths'); application.inject('controller', 'ghostPaths', 'ghost:paths');
} }
}; };