summaryrefslogtreecommitdiff
path: root/public/assets/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib')
-rw-r--r--public/assets/js/lib/router.js31
-rw-r--r--public/assets/js/lib/views/index/index.js14
-rw-r--r--public/assets/js/lib/views/login/login.js14
3 files changed, 59 insertions, 0 deletions
diff --git a/public/assets/js/lib/router.js b/public/assets/js/lib/router.js
new file mode 100644
index 0000000..30646c1
--- /dev/null
+++ b/public/assets/js/lib/router.js
@@ -0,0 +1,31 @@
+var lobby, room
+
+var SiteRouter = Router.extend({
+
+ el: "body",
+
+ routes: {
+ "/": 'lobby',
+ "/index": 'index',
+ "/login": 'login',
+ "/details/:id": 'room',
+ },
+
+ initialize: function(){
+ if (! user.username) {
+ app.view = new LoginView()
+ }
+ else {
+ this.route()
+ }
+ },
+
+ index: function(){
+ app.view = new IndexView ()
+ },
+
+ login: function(){
+ app.view = new LoginView ()
+ },
+
+}) \ No newline at end of file
diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js
new file mode 100644
index 0000000..095909d
--- /dev/null
+++ b/public/assets/js/lib/views/index/index.js
@@ -0,0 +1,14 @@
+var IndexView = View.extend({
+
+ events: {
+ },
+
+ initialize: function(opt){
+ // opt.parent = parent
+ },
+
+ success: function(){
+ window.location.href = "/index"
+ },
+
+}) \ No newline at end of file
diff --git a/public/assets/js/lib/views/login/login.js b/public/assets/js/lib/views/login/login.js
new file mode 100644
index 0000000..06d8808
--- /dev/null
+++ b/public/assets/js/lib/views/login/login.js
@@ -0,0 +1,14 @@
+var LoginView = FormView.extend({
+
+ events: {
+ },
+
+ initialize: function(opt){
+ // opt.parent = parent
+ },
+
+ success: function(){
+ window.location.href = "/index"
+ },
+
+}) \ No newline at end of file