diff options
Diffstat (limited to 'public/assets/javascripts/ui/lib/Router.js')
| -rw-r--r-- | public/assets/javascripts/ui/lib/Router.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/public/assets/javascripts/ui/lib/Router.js b/public/assets/javascripts/ui/lib/Router.js index 5877f93..0b6385c 100644 --- a/public/assets/javascripts/ui/lib/Router.js +++ b/public/assets/javascripts/ui/lib/Router.js @@ -4,7 +4,8 @@ var Router = View.extend({ this.originalPath = window.location.pathname - var pathname = window.location.pathname, + var routes = is_mobile ? this.mobileRoutes : this.routes, + pathname = window.location.pathname, path = pathname.split("/"); for (var i = 0; i < path.length; i++) { @@ -13,7 +14,7 @@ var Router = View.extend({ } } - if (pathname in this.routes) { + if (pathname in routes) { this[this.routes[pathname]](null) } @@ -21,35 +22,39 @@ var Router = View.extend({ path.pop() } - for (var route in this.routes) { + for (var route in routes) { var routePath = route.split("/") if (routePath[1] == path[1]) { if (routePath[2] && routePath[2].indexOf(":") !== -1 && path[2] && (path[3] === routePath[3]) ) { this[this.routes[route]](null, path[2]) - break; + return } else if (routePath[2] == path[2]) { if (routePath[3] && path[3]) { if (routePath[3].indexOf(":") !== -1) { this[this.routes[route]](null, path[3]) - break; + return } else if (routePath[3] == path[3]) { this[this.routes[route]](null) - break; + return } } else if (! routePath[3] && ! path[3]) { this[this.routes[route]](null) - break; + return } } else if (! routePath[2] && (! path[2].length || ! path[2])) { this[this.routes[route]](null) - break; + return } } } + + if (is_mobile) { + window.location.href = "/" + } } }) |
