2014-03-22 21:31:45 -05:00
|
|
|
import User from 'ghost/models/user';
|
2014-03-11 11:23:32 -05:00
|
|
|
import userFixtures from 'ghost/fixtures/users';
|
|
|
|
|
|
|
|
var currentUser = {
|
|
|
|
name: 'currentUser',
|
|
|
|
|
|
|
|
initialize: function (container) {
|
2014-03-22 21:31:45 -05:00
|
|
|
container.register('user:current', User);
|
2014-03-11 11:23:32 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var injectCurrentUser = {
|
|
|
|
name: 'injectCurrentUser',
|
|
|
|
|
|
|
|
initialize: function (container) {
|
|
|
|
if (container.lookup('user:current')) {
|
2014-03-22 21:31:45 -05:00
|
|
|
// @TODO: remove userFixture
|
|
|
|
container.lookup('user:current').setProperties(userFixtures.findBy('id', 1));
|
|
|
|
|
2014-03-11 11:23:32 -05:00
|
|
|
container.injection('route', 'user', 'user:current');
|
|
|
|
container.injection('controller', 'user', 'user:current');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export {currentUser, injectCurrentUser};
|