summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/lib/Router.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-12 14:52:34 -0400
committerJules Laplace <jules@okfoc.us>2014-06-12 14:52:34 -0400
commit5a215e1b00e4fd026a83e81baa7a45c28435f73c (patch)
tree6f4cbfab683b03e546951d526a0127dce012a7d9 /public/assets/javascripts/ui/lib/Router.js
parent2525d1c20120ecb5224c9896a2e1acd77385cbc4 (diff)
routes for starting a new project
Diffstat (limited to 'public/assets/javascripts/ui/lib/Router.js')
-rw-r--r--public/assets/javascripts/ui/lib/Router.js23
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)