FIX: Use the container to register Discourse's custom location handler

This commit is contained in:
Robin Ward 2014-04-15 11:45:45 -04:00
parent 2f9bb6b88f
commit fc65bc28be
3 changed files with 7 additions and 3 deletions

View file

@ -165,4 +165,9 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
});
Discourse.Router = Discourse.Router.reopen({ location: 'discourse_location' });
Discourse.initializer({
name: "register-discourse-location",
initialize: function(container, application) {
application.register('location:discourse-location', Ember.DiscourseLocation);
}
});

View file

@ -255,8 +255,6 @@ Ember.DiscourseLocation = Ember.Object.extend({
});
Ember.Location.registerImplementation('discourse_location', Ember.DiscourseLocation);
/**
Since we're using pushState/replaceState let's add extra hooks to cloakedView to
eject itself when the popState occurs. This results in better back button

View file

@ -35,6 +35,7 @@
Discourse.BaseUri = '<%= Discourse::base_uri "/" %>';
Discourse.Environment = '<%= Rails.env %>';
Discourse.SiteSettings = PreloadStore.get('siteSettings');
Discourse.Router = Ember.Router.extend({ location: 'discourse-location' });
Discourse.Router.map(function() { Discourse.routeBuilder.call(this); });
Discourse.start();
Discourse.set('assetVersion','<%= Discourse.assets_digest %>');