From 7d35fbd21d4f31132ae62a07c1863db5d0325cb2 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 17 Sep 2015 22:15:28 -0400 Subject: loginview --- StoneIsland/www/index.html | 11 +++++----- StoneIsland/www/js/lib/nav/LoginView.js | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) (limited to 'StoneIsland') diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 25220af4..2cbe762b 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -184,14 +184,13 @@ -
- - +
+ + SIGN IN -
+ - - +

YOUR CART / 2 ITEMS

diff --git a/StoneIsland/www/js/lib/nav/LoginView.js b/StoneIsland/www/js/lib/nav/LoginView.js index 0f30db3d..de534e32 100644 --- a/StoneIsland/www/js/lib/nav/LoginView.js +++ b/StoneIsland/www/js/lib/nav/LoginView.js @@ -3,17 +3,53 @@ var LoginView = View.extend({ el: "#login", events: { + "click .close": "hide", + "click .login_ask": "login", + "click .signup_ask": "signup", + "submit form": "submit", }, + mode: null, + initialize: function(){ + this.$form = this.$("form") + this.$email = this.$("[name=email]") + this.$password = this.$("[name=password]") }, show: function(){ + this.$form.hide() + this.$email.val("") + this.$password.val("") document.body.classList.add("login") }, hide: function(){ document.body.classList.remove("login") }, + + login: function(){ + this.mode = "login" + this.$form.show() + }, + + signup: function(){ + this.mode = "signup" + this.$form.show() + }, + + submit: function(e){ + e.preventDefault() + if (this.mode == "login") { + // login api + } + else { + // signup api + } + }, + + success: function(){ + // change login in ui to logout or whatever + }, }) \ No newline at end of file -- cgit v1.2.3-70-g09d2