summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/lib/Router.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-10 12:00:24 -0400
committerJules Laplace <jules@okfoc.us>2014-06-10 12:00:24 -0400
commit9fb0fe9b7ef614d2248b00ea2b964205f3453f41 (patch)
tree953fd956e1c6b3d641226d7ac36cc749ced92504 /public/assets/javascripts/ui/lib/Router.js
parent3f8e4223cc57bc3fd461881e3d6e9eb331bf4dc5 (diff)
split up builder functionality
Diffstat (limited to 'public/assets/javascripts/ui/lib/Router.js')
-rw-r--r--public/assets/javascripts/ui/lib/Router.js28
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;
+ }
+ }
+ }
+ }
+
+})