diff options
Diffstat (limited to 'public/assets/javascripts/ui/lib/Router.js')
| -rw-r--r-- | public/assets/javascripts/ui/lib/Router.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/public/assets/javascripts/ui/lib/Router.js b/public/assets/javascripts/ui/lib/Router.js index d06c07a..214603c 100644 --- a/public/assets/javascripts/ui/lib/Router.js +++ b/public/assets/javascripts/ui/lib/Router.js @@ -5,7 +5,12 @@ var Router = View.extend({ this.originalPath = window.location.pathname var path = window.location.pathname.split("/") - // console.log(path) + for (var i = 0; i < path.length; i++) { + if (! path[i].length) { + path[i] = null + } + } + for (var route in this.routes) { var routePath = route.split("/") if (routePath[1] == path[1]) { @@ -14,8 +19,20 @@ var Router = View.extend({ break; } else if (routePath[2] == path[2]) { - this[this.routes[route]](null) - break; + if (routePath[3] && path[3]) { + if (routePath[3].indexOf(":") !== -1) { + this[this.routes[route]](null, path[3]) + break; + } + else if (routePath[3] == path[3]) { + this[this.routes[route]](null) + break; + } + } + else if (! routePath[3] && ! path[3]) { + this[this.routes[route]](null) + break; + } } else if (! routePath[2] && (! path[2].length || ! path[2])) { this[this.routes[route]](null) |
