mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Switch Ember initializers to public API methods
This commit is contained in:
parent
d135930344
commit
ee7c274ba7
@ -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');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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();
|
||||||
});
|
});
|
||||||
|
@ -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');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user