From a0ef9177365dbf281f83e7ab9aa0eae54ef9c806 Mon Sep 17 00:00:00 2001
From: Wojciech Kocjan <wojciech@kocjan.org>
Date: Wed, 3 Apr 2013 14:10:47 +0200
Subject: [PATCH] Reworked rootURL in ember.js and allow handling of
 back/forward buttons in browser

---
 .../javascripts/discourse/routes/discourse_location.js     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/assets/javascripts/discourse/routes/discourse_location.js b/app/assets/javascripts/discourse/routes/discourse_location.js
index bb8c55d43..e01c1d636 100644
--- a/app/assets/javascripts/discourse/routes/discourse_location.js
+++ b/app/assets/javascripts/discourse/routes/discourse_location.js
@@ -153,7 +153,12 @@ Ember.DiscourseLocation = Ember.Object.extend({
       if (e.state) {
         var currentState = self.get('currentState');
         if (currentState) {
-          callback(e.state.path);
+          var url = e.state.path,
+              rootURL = get(self, 'rootURL');
+
+          rootURL = rootURL.replace(/\/$/, '');
+          url = url.replace(rootURL, '');
+          callback(url);
         } else {
           this.set('currentState', e.state);
         }