-
-
Save devsergiy/7579055 to your computer and use it in GitHub Desktop.
Revisions
-
ivanvanderbyl revised this gist
Jan 17, 2013 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ %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}'); -
ivanvanderbyl created this gist
Jan 17, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ App.AccountEditRoute = Ember.Route.extend({ setupController: function(controller) { controller.set('content', this.get('currentUser')); } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ 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'); } });