Skip to content

Instantly share code, notes, and snippets.

@iheanyi
Forked from ivanvanderbyl/account_routes.js
Last active August 29, 2015 14:13
Show Gist options
  • Save iheanyi/0f9006abb806cff8611d to your computer and use it in GitHub Desktop.
Save iheanyi/0f9006abb806cff8611d to your computer and use it in GitHub Desktop.
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
%noscript
.container
.alert
%strong
Javascript is disabled!
The AppName UI is built entirely in Javascript, as such you need to enable
Javascript in your browser to continue.
:javascript
var currentUser = jQuery.parseJSON('#{current_user_json}');
Ember.Application.initializer({
name: "currentUser",
initialize: function(container, application) {
var store = container.lookup('store:main');
var obj = store.load(CrashLog.User, currentUser);
container.optionsForType('user', { instantiate: false, singleton: true });
container.register('user', 'current', CrashLog.User.find(obj.id));
}
});
Ember.Application.initializer({
name: "injectCurrentUser",
after: 'currentUser',
initialize: function(container) {
container.injection('controller:application', 'currentUser', 'user:current');
container.typeInjection('route', 'currentUser', 'user:current');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment