diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-06-10 12:00:24 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-06-10 12:00:24 -0400 |
| commit | 9fb0fe9b7ef614d2248b00ea2b964205f3453f41 (patch) | |
| tree | 953fd956e1c6b3d641226d7ac36cc749ced92504 /public/assets/javascripts/ui/lib/Router.js | |
| parent | 3f8e4223cc57bc3fd461881e3d6e9eb331bf4dc5 (diff) | |
split up builder functionality
Diffstat (limited to 'public/assets/javascripts/ui/lib/Router.js')
| -rw-r--r-- | public/assets/javascripts/ui/lib/Router.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/lib/Router.js b/public/assets/javascripts/ui/lib/Router.js new file mode 100644 index 0000000..d06c07a --- /dev/null +++ b/public/assets/javascripts/ui/lib/Router.js @@ -0,0 +1,28 @@ +var Router = View.extend({ + + route: function(){ + + this.originalPath = window.location.pathname + + var path = window.location.pathname.split("/") + // console.log(path) + for (var route in this.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; + } + else if (routePath[2] == path[2]) { + this[this.routes[route]](null) + break; + } + else if (! routePath[2] && (! path[2].length || ! path[2])) { + this[this.routes[route]](null) + break; + } + } + } + } + +}) |
