diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-19 18:44:57 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-19 18:44:57 -0500 |
| commit | 39b395f28ed7eb0d24eef6b2e50a3a235af0b31e (patch) | |
| tree | 0ab7e4f99e08a4efb5bda62888bfb92312f4b5a7 /StoneIsland/www/js/lib/auth | |
| parent | ee15de014ecfc780c8bd86e00eb8b24bf6149db9 (diff) | |
some js for orders view
Diffstat (limited to 'StoneIsland/www/js/lib/auth')
| -rw-r--r-- | StoneIsland/www/js/lib/auth/LoginView.js | 40 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/auth/LogoutView.js | 13 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/auth/SignupView.js | 60 |
3 files changed, 113 insertions, 0 deletions
diff --git a/StoneIsland/www/js/lib/auth/LoginView.js b/StoneIsland/www/js/lib/auth/LoginView.js new file mode 100644 index 00000000..8c875ae8 --- /dev/null +++ b/StoneIsland/www/js/lib/auth/LoginView.js @@ -0,0 +1,40 @@ +var LoginView = FormView.extend({ + + el: "#login", + + action: sdk.account.login, + + events: { + "click .newuser": "new_user", + "submit form": "save", + }, + + initialize: function(){ + this.$form = this.$("form") + this.$msg = this.$(".msg") + this.scroller = new IScroll('#login', app.iscroll_options) + }, + + show: function(){ + app.footer.show("SUBMIT", "CANCEL") + this.$form.get(0).reset() + this.$msg.html("* Your personal and payment information will always remain private") + document.body.className = "login" + }, + + new_user: function(){ + app.router.go("account/signup") + }, + + validate_presence: { + "Email": "Please enter a valid email address.", + "Password": "Please enter your password.", + }, + + success: function(data){ + }, + + error: function(data){ + }, + +}) diff --git a/StoneIsland/www/js/lib/auth/LogoutView.js b/StoneIsland/www/js/lib/auth/LogoutView.js new file mode 100644 index 00000000..62c925eb --- /dev/null +++ b/StoneIsland/www/js/lib/auth/LogoutView.js @@ -0,0 +1,13 @@ +var LogoutView = View.extend({ + + el: "#logout", + + events: { + }, + + show: function(){ + document.body.className = "logout" + app.footer.hide() + }, + +})
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/auth/SignupView.js b/StoneIsland/www/js/lib/auth/SignupView.js new file mode 100644 index 00000000..123b47a6 --- /dev/null +++ b/StoneIsland/www/js/lib/auth/SignupView.js @@ -0,0 +1,60 @@ +var SignupView = FormView.extend({ + + el: "#signup", + + action: sdk.account.login, + + events: { + "submit form": "save", + }, + + initialize: function(){ + this.$form = this.$("form") + this.$msg = this.$(".msg") + this.scroller = new IScroll('#signup', app.iscroll_options) + }, + + show: function(){ + app.footer.show("SUBMIT", "CANCEL") + this.$form.get(0).reset() + this.$msg.html("* Your personal and payment information will always remain private") + document.body.className = "signup" + }, + + validate_presence: { + "Name": "Please enter your first name.", + "Surname": "Please enter your last name.", + "Email": "Please enter a valid email address.", + "ConfirmEmail": "Please enter a valid email address.", + "Password": "Please enter your password.", + "Password2": "Please enter your password again.", + "YooxLetter": "You must agree to data profiling.", + "DataProfiling": "You must agree to data profiling.", + }, + + validate_fields: function(errors){ + if (data.Password !== data.Password2) { errors.push("Password2", "Passwords don't match.") } + if (data.Email !== data.ConfirmEmail) { errors.push("ConfirmEmail", "Email addresses don't match.") } + if (! data.YooxLetter) { data.YooxLetter = "false" } + if (! data.DataProfiling) { data.DataProfiling = "false" } + }, + + success: function(data){ + auth.view_logged_in() + }, + + error: function(data){ + }, + +/* + var new_user_data = { + "Email": "testit.account" + Math.floor(Math.random() * 10000000) + "@yoox.com", + "Password": "TestPassword", + "Gender": "M", + "Name": "TestName", + "Surname": "TestSurname", + "DataProfiling": true, + } +*/ + +})
\ No newline at end of file |
