diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 34f87e4c3..7dc277f25 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -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); + } +}); diff --git a/app/assets/javascripts/discourse/routes/discourse_location.js b/app/assets/javascripts/discourse/routes/discourse_location.js index 2f8b56da6..0693a65d8 100644 --- a/app/assets/javascripts/discourse/routes/discourse_location.js +++ b/app/assets/javascripts/discourse/routes/discourse_location.js @@ -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 diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb index c6c174e6c..41f259dea 100644 --- a/app/views/common/_discourse_javascript.html.erb +++ b/app/views/common/_discourse_javascript.html.erb @@ -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 %>');