summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js')
-rw-r--r--StoneIsland/www/js/lib/account/LoginView.js20
-rw-r--r--StoneIsland/www/js/lib/account/PaymentView.js4
-rw-r--r--StoneIsland/www/js/lib/account/SettingsView.js15
-rw-r--r--StoneIsland/www/js/lib/account/ShippingView.js6
-rw-r--r--StoneIsland/www/js/lib/account/SignupView.js17
-rw-r--r--StoneIsland/www/js/lib/nav/FooterView.js2
-rw-r--r--StoneIsland/www/js/lib/products/CollectionView.js25
-rw-r--r--StoneIsland/www/js/sdk/_sdk.js6
-rw-r--r--StoneIsland/www/js/vendor/util.js1
9 files changed, 70 insertions, 26 deletions
diff --git a/StoneIsland/www/js/lib/account/LoginView.js b/StoneIsland/www/js/lib/account/LoginView.js
index 5058d335..9545b0d8 100644
--- a/StoneIsland/www/js/lib/account/LoginView.js
+++ b/StoneIsland/www/js/lib/account/LoginView.js
@@ -1,10 +1,10 @@
-var LoginView = View.extend({
+var LoginView = SerializableView.extend({
el: "#login",
events: {
"click .newuser": "newuser",
- "submit form": "submit",
+ "submit form": "save",
},
initialize: function(){
@@ -22,11 +22,17 @@ var LoginView = View.extend({
app.router.go("account/signup")
},
- submit: function(e){
- e.preventDefault()
- },
-
- success: function(){
+ save: function(e){
+ e && e.preventDefault()
+
+ var data = this.serialize()
+
+ sdk.account.login({ data: data }).done(function(data){
+ console.log("LOGIN SUCCESS", data)
+ }).fail(function(data){
+ console.log("LOGIN FAIL", data)
+ })
+
},
})
diff --git a/StoneIsland/www/js/lib/account/PaymentView.js b/StoneIsland/www/js/lib/account/PaymentView.js
index 74727648..e43dfc1c 100644
--- a/StoneIsland/www/js/lib/account/PaymentView.js
+++ b/StoneIsland/www/js/lib/account/PaymentView.js
@@ -9,6 +9,10 @@ var PaymentView = View.extend({
this.address = new AddressView ({ parent: this })
},
+ show: function(){
+ document.body.className = "payment"
+ },
+
})
var AddressView = View.extend({
diff --git a/StoneIsland/www/js/lib/account/SettingsView.js b/StoneIsland/www/js/lib/account/SettingsView.js
new file mode 100644
index 00000000..b690ed81
--- /dev/null
+++ b/StoneIsland/www/js/lib/account/SettingsView.js
@@ -0,0 +1,15 @@
+var SettingsView = View.extend({
+
+ el: "#settings",
+
+ events: {
+ },
+
+ initialize: function(){
+ },
+
+ show: function(){
+ document.body.className = "settings"
+ },
+
+}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/account/ShippingView.js b/StoneIsland/www/js/lib/account/ShippingView.js
index d3a5d8df..d22029c7 100644
--- a/StoneIsland/www/js/lib/account/ShippingView.js
+++ b/StoneIsland/www/js/lib/account/ShippingView.js
@@ -8,5 +8,9 @@ var ShippingView = View.extend({
initialize: function(){
this.address = new AddressView ({ parent: this })
},
-
+
+ show: function(){
+ document.body.className = "shipping"
+ },
+
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/account/SignupView.js b/StoneIsland/www/js/lib/account/SignupView.js
index c6cd2930..14fb27a6 100644
--- a/StoneIsland/www/js/lib/account/SignupView.js
+++ b/StoneIsland/www/js/lib/account/SignupView.js
@@ -3,7 +3,7 @@ var SignupView = View.extend({
el: "#signup",
events: {
- "submit form": "submit",
+ "submit form": "save",
},
initialize: function(){
@@ -17,12 +17,23 @@ var SignupView = View.extend({
document.body.className = "signup"
},
- submit: function(e){
- e.preventDefault()
+ save: function(e){
+ e && e.preventDefault()
},
success: function(){
// change login in ui to logout or whatever
},
+/*
+ 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/nav/FooterView.js b/StoneIsland/www/js/lib/nav/FooterView.js
index d5560545..414dc4c1 100644
--- a/StoneIsland/www/js/lib/nav/FooterView.js
+++ b/StoneIsland/www/js/lib/nav/FooterView.js
@@ -26,7 +26,7 @@ var FooterView = View.extend({
},
ok: function(){
- app.view.submit()
+ (app.view.save || app.view.submit || noop)()
},
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 1377277a..490b10fe 100644
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -46,19 +46,20 @@ var CollectionView = ScrollableView.extend({
else {
this.data = data
}
- this.loaded = true
- this.$loader.hide()
- this.$content.empty()
- // DefaultCode10
- data.SearchResponseFull.Results.Items.forEach(function(item){
- this.items[ item['Code8'] ] = item
- var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'], '11_f'))
- .replace(/{{code8}}/, item['Code8'])
- this.$content.append(t)
- }.bind(this))
-
- this.deferScrollToTop()
+ if (! this.loaded) {
+ this.loaded = true
+ this.$loader.hide()
+ this.$content.empty()
+ // DefaultCode10
+ data.SearchResponseFull.Results.Items.forEach(function(item){
+ this.items[ item['Code8'] ] = item
+ var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'], '11_f'))
+ .replace(/{{code8}}/, item['Code8'])
+ this.$content.append(t)
+ }.bind(this))
+ this.deferScrollToTop()
+ }
this.afterFetchCallback && this.afterFetchCallback()
},
diff --git a/StoneIsland/www/js/sdk/_sdk.js b/StoneIsland/www/js/sdk/_sdk.js
index 2054d0dc..d50a99e0 100644
--- a/StoneIsland/www/js/sdk/_sdk.js
+++ b/StoneIsland/www/js/sdk/_sdk.js
@@ -1,11 +1,13 @@
var sdk = (function(){
var sdk = {}
-
+
+ sdk.env = "development"
+
var endpoint = "https://secure.api.yoox.biz/"
// var endpoint = "http://api.yoox.biz/"
sdk.init = function(opt){
- switch (opt.env || "development") {
+ switch (sdk.env = opt.env || "development") {
case 'test':
endpoint = "http://lvh.me:9090/"
break
diff --git a/StoneIsland/www/js/vendor/util.js b/StoneIsland/www/js/vendor/util.js
index 8a58a84c..0e48ce5a 100644
--- a/StoneIsland/www/js/vendor/util.js
+++ b/StoneIsland/www/js/vendor/util.js
@@ -41,6 +41,7 @@ function rand(n){ return (Math.random()*n) }
function randint(n){ return rand(n)|0 }
function randrange(a,b){ return a + rand(b-a) }
function choice(a){ return a[randint(a.length)] }
+function noop(){}
function range(m,n,s){
var a = []