From 39b395f28ed7eb0d24eef6b2e50a3a235af0b31e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 19 Nov 2015 18:44:57 -0500 Subject: some js for orders view --- StoneIsland/www/css/account.css | 6 +++ StoneIsland/www/index.html | 38 ++++++++++++-- StoneIsland/www/js/lib/account/LoginView.js | 40 --------------- StoneIsland/www/js/lib/account/LogoutView.js | 13 ----- StoneIsland/www/js/lib/account/OrdersView.js | 25 ++++++++- StoneIsland/www/js/lib/account/SignupView.js | 60 ---------------------- StoneIsland/www/js/lib/account/orders/OrderList.js | 17 ++++++ .../www/js/lib/account/orders/SingleOrder.js | 18 +++++++ StoneIsland/www/js/lib/auth/LoginView.js | 40 +++++++++++++++ StoneIsland/www/js/lib/auth/LogoutView.js | 13 +++++ StoneIsland/www/js/lib/auth/SignupView.js | 60 ++++++++++++++++++++++ 11 files changed, 213 insertions(+), 117 deletions(-) delete mode 100644 StoneIsland/www/js/lib/account/LoginView.js delete mode 100644 StoneIsland/www/js/lib/account/LogoutView.js delete mode 100644 StoneIsland/www/js/lib/account/SignupView.js create mode 100644 StoneIsland/www/js/lib/account/orders/OrderList.js create mode 100644 StoneIsland/www/js/lib/account/orders/SingleOrder.js create mode 100644 StoneIsland/www/js/lib/auth/LoginView.js create mode 100644 StoneIsland/www/js/lib/auth/LogoutView.js create mode 100644 StoneIsland/www/js/lib/auth/SignupView.js diff --git a/StoneIsland/www/css/account.css b/StoneIsland/www/css/account.css index 0d3d0e57..a06dc8f8 100644 --- a/StoneIsland/www/css/account.css +++ b/StoneIsland/www/css/account.css @@ -34,6 +34,12 @@ } +.orders #orders { display: block } +#orders { + display: none; +} + + .settings #settings { display: block } #settings { display: none; diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 4714a279..8537b7bd 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -421,6 +421,35 @@ +
+

ORDERS

+
+
+ +
+
+
+
+
+
+ +
+
+
@@ -653,14 +682,17 @@ - - - + + + + + + diff --git a/StoneIsland/www/js/lib/account/LoginView.js b/StoneIsland/www/js/lib/account/LoginView.js deleted file mode 100644 index 8c875ae8..00000000 --- a/StoneIsland/www/js/lib/account/LoginView.js +++ /dev/null @@ -1,40 +0,0 @@ -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/account/LogoutView.js b/StoneIsland/www/js/lib/account/LogoutView.js deleted file mode 100644 index 62c925eb..00000000 --- a/StoneIsland/www/js/lib/account/LogoutView.js +++ /dev/null @@ -1,13 +0,0 @@ -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/account/OrdersView.js b/StoneIsland/www/js/lib/account/OrdersView.js index f269b7cf..66648b36 100644 --- a/StoneIsland/www/js/lib/account/OrdersView.js +++ b/StoneIsland/www/js/lib/account/OrdersView.js @@ -1,4 +1,27 @@ -var OrdersView = ScrollableView.extend({ +var OrdersView = View.extend({ + el: "#orders", + + events: { + "click .back": "back" + "click .details": "load_single" + }, + + initialize: function(){ + this.single = new SingleOrder () + this.list = new OrderList () + }, + + show: function(){ + document.body.className = "orders" + this.el.className = "list" + }, + + load_single: function(){ + }, + + back: function(){ + this.list.show() + }, }) diff --git a/StoneIsland/www/js/lib/account/SignupView.js b/StoneIsland/www/js/lib/account/SignupView.js deleted file mode 100644 index 123b47a6..00000000 --- a/StoneIsland/www/js/lib/account/SignupView.js +++ /dev/null @@ -1,60 +0,0 @@ -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 diff --git a/StoneIsland/www/js/lib/account/orders/OrderList.js b/StoneIsland/www/js/lib/account/orders/OrderList.js new file mode 100644 index 00000000..876f609e --- /dev/null +++ b/StoneIsland/www/js/lib/account/orders/OrderList.js @@ -0,0 +1,17 @@ +var OrderList = ScrollableView.extend({ + + el: "#order_list", + + template: $("#order_list .template"), + + initialize: function(opt){ + this.parent = opt.parent + this.scroller = new IScroll('#order_list', app.iscroll_options) + }, + + show: function(){ + document.body.className = "orders" + app.orders.el.className = "list" + }, + +}) diff --git a/StoneIsland/www/js/lib/account/orders/SingleOrder.js b/StoneIsland/www/js/lib/account/orders/SingleOrder.js new file mode 100644 index 00000000..21416401 --- /dev/null +++ b/StoneIsland/www/js/lib/account/orders/SingleOrder.js @@ -0,0 +1,18 @@ +var SingleOrder = ScrollableView.extend({ + + el: "#single_order", + + template: $("#single_order .template"), + + initialize: function(opt){ + this.parent = opt.parent + this.scroller = new IScroll('#single_order', app.iscroll_options) + }, + + show: function(id){ + document.body.className = "orders" + app.orders.el.className = "single" + this.deferScrollToTop() + }, + +}) 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 -- cgit v1.2.3-70-g09d2