diff --git a/assets/scripts/app/routes.coffee b/assets/scripts/app/routes.coffee index 43e1394e..7172aa63 100644 --- a/assets/scripts/app/routes.coffee +++ b/assets/scripts/app/routes.coffee @@ -77,6 +77,7 @@ Travis.Router = Ember.Router.extend auth: Ember.Route.extend route: '/auth' + customRegexp: /^\/?auth($|\/)/ connectOutlets: (router) -> router.get('applicationView').connectLayout 'simple' $('body').attr('id', 'auth') @@ -88,6 +89,7 @@ Travis.Router = Ember.Router.extend stats: Ember.Route.extend route: '/stats' + customRegexp: /^\/?stats($|\/)/ connectOutlets: (router) -> router.get('applicationView').connectLayout 'simple' $('body').attr('id', 'stats') diff --git a/assets/scripts/vendor/ember.js b/assets/scripts/vendor/ember.js index 12e7d06e..557a6605 100644 --- a/assets/scripts/vendor/ember.js +++ b/assets/scripts/vendor/ember.js @@ -17772,7 +17772,8 @@ Ember.Routable = Ember.Mixin.create({ return Ember._RouteMatcher.create({ route: route, dynamicSegmentPattern: get(this, 'dynamicSegmentPattern'), - dynamicSegmentTerminators: get(this, 'dynamicSegmentTerminators') + dynamicSegmentTerminators: get(this, 'dynamicSegmentTerminators'), + customRegexp: get(this, 'customRegexp') }); } }), @@ -18160,34 +18161,42 @@ Ember._RouteMatcher = Ember.Object.extend({ state: null, init: function() { - var route = this.route, - dynamicSegmentPattern = this.dynamicSegmentPattern || "([^/]+)", - terminators = this.dynamicSegmentTerminators || [], - identifiers = [], - count = 1, - escaped, - segmentRegexp; + var route = this.route; // Strip off leading slash if present if (route.charAt(0) === '/') { route = this.route = route.substr(1); } - escaped = escapeForRegex(route); + if(this.customRegexp) { + this.identifiers = []; + this.regex = this.customRegexp; + } else { + var dynamicSegmentPattern = this.dynamicSegmentPattern || "([^/]+)", + terminators = this.dynamicSegmentTerminators || [], + identifiers = [], + count = 1, + escaped, + segmentRegexp; - terminators.push('$|/'); - str = ':([a-z_]+)(?=' + terminators.join('|') + ')' - segmentRegexp = new RegExp(str, 'gi'); - var regex = escaped.replace(segmentRegexp, function(match, id) { - identifiers[count++] = id; - return dynamicSegmentPattern; - }); - this.identifiers = identifiers; - this.regex = new RegExp("^/?" + regex); + escaped = escapeForRegex(route); + + terminators.push('$|/'); + str = ':([a-z_]+)(?=' + terminators.join('|') + ')' + segmentRegexp = new RegExp(str, 'gi'); + var regex = escaped.replace(segmentRegexp, function(match, id) { + identifiers[count++] = id; + return dynamicSegmentPattern; + }); + + this.identifiers = identifiers; + this.regex = new RegExp("^/?" + regex); + } }, match: function(path) { + console.log(path, this.regex); var match = path.match(this.regex); if (match) {