From f768ab296c07ce93efe9f2507cdf4b795aa10013 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 3 Sep 2015 13:52:20 -0400 Subject: pull in app skeleton from asdf-yt --- public/assets/js/lib/router.js | 31 +++++++++++++++++++++++++++++++ public/assets/js/lib/views/index/index.js | 14 ++++++++++++++ public/assets/js/lib/views/login/login.js | 14 ++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 public/assets/js/lib/router.js create mode 100644 public/assets/js/lib/views/index/index.js create mode 100644 public/assets/js/lib/views/login/login.js (limited to 'public/assets/js/lib') 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 -- cgit v1.2.3-70-g09d2