summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/lib/Router.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-06-10 19:46:53 -0400
committerJulie Lala <jules@okfoc.us>2014-06-10 19:46:53 -0400
commit4e4b5b5668835097f335efaf55dfe837eec7dc3c (patch)
tree5cd6cb12a203c5dd7c8cf9f62b9cd9235e52513c /public/assets/javascripts/ui/lib/Router.js
parent3074488306e041718dec221ff9142748e2e68916 (diff)
parentb231af3e38b8f066f18031fd69b0fdb30a5e244a (diff)
Merge branch 'master' of github.com:okfocus/vvalls
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;
+ }
+ }
+ }
+ }
+
+})