summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib')
-rw-r--r--StoneIsland/www/js/lib/account/AccountView.js2
-rw-r--r--StoneIsland/www/js/lib/account/ProfileView.js7
-rw-r--r--StoneIsland/www/js/lib/auth/SignupView.js3
-rw-r--r--StoneIsland/www/js/lib/blogs/BlogView.js10
-rw-r--r--StoneIsland/www/js/lib/cart/CartPayment.js64
-rw-r--r--StoneIsland/www/js/lib/cart/CartShipping.js7
-rw-r--r--StoneIsland/www/js/lib/cart/CartSummary.js5
-rw-r--r--StoneIsland/www/js/lib/nav/IntroView.js1
-rw-r--r--StoneIsland/www/js/lib/products/CollectionView.js2
-rw-r--r--StoneIsland/www/js/lib/products/ProductView.js6
10 files changed, 90 insertions, 17 deletions
diff --git a/StoneIsland/www/js/lib/account/AccountView.js b/StoneIsland/www/js/lib/account/AccountView.js
index 116d5ba1..1c5c9f16 100644
--- a/StoneIsland/www/js/lib/account/AccountView.js
+++ b/StoneIsland/www/js/lib/account/AccountView.js
@@ -66,7 +66,7 @@ var AccountView = View.extend({
},
populateCreditCards: function(data, cb){
- console.log(data)
+ console.log("populate ccs:", data.CreditCards)
this.ccs = data.CreditCards
this.ccLookup = {}
if (! data.CreditCards || ! data.CreditCards.length) {
diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js
index 999e8d65..da25fefc 100644
--- a/StoneIsland/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/www/js/lib/account/ProfileView.js
@@ -5,6 +5,8 @@ var ProfileView = FormView.extend({
events: {
},
+ action: sdk.account.update,
+
initialize: function(){
this.$form = this.$("form")
this.$msg = this.$(".msg")
@@ -30,7 +32,7 @@ var ProfileView = FormView.extend({
if (! data.CurrentPassword && (data.NewPassword || data.Email !== auth.user.Email)) { errors.push([ "CurrentPassword", "Please enter your current password." ]) }
if (data.CurrentPassword && ! data.NewPassword) { errors.push([ "NewPassword", "Please enter your new password." ]) }
if (data.NewPassword && data.NewPassword.length < 7) { errors.push([ "CurrentPassword", "New password must be 7 characters or more." ]) }
- if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
+ // if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
},
finalize: function(data){
@@ -50,7 +52,8 @@ var ProfileView = FormView.extend({
})
}
- var submissible_data = _.pick(data, "Name Surname BirthDay Gender YooxLetter".split(" "))
+ var submissible_data = _.pick(data, "Name Surname BirthDay YooxLetter".split(" "))
+ submissible_data.Gender = "U"
// submissible_data.idUser = auth.user_id
// submissible_data.AccessToken = auth.access_token
// submissible_data.Premium = "false"
diff --git a/StoneIsland/www/js/lib/auth/SignupView.js b/StoneIsland/www/js/lib/auth/SignupView.js
index 7e6fc04d..22b310de 100644
--- a/StoneIsland/www/js/lib/auth/SignupView.js
+++ b/StoneIsland/www/js/lib/auth/SignupView.js
@@ -57,7 +57,7 @@ var SignupView = FormView.extend({
if (data.Password !== data.Password2) { errors.push([ "Password2", "Passwords don't match." ]) }
if (! data.Email.match("@")) { errors.push([ "Email", "Email address is not valid." ]) }
if (data.Email.toLowerCase() !== data.ConfirmEmail.toLowerCase()) { errors.push([ "ConfirmEmail", "Email addresses don't match." ]) }
- if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
+ // if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
if (data.DataProfiling !== "true") { errors.push([ "DataProfiling", "You must consent to use this service." ]) }
if (data.DataProfiling2 !== "true") { errors.push([ "DataProfiling2", "You must consent to use this service." ]) }
if (! data.YooxLetter) { data.YooxLetter = false }
@@ -67,6 +67,7 @@ var SignupView = FormView.extend({
delete data.DataProfiling2
delete data.ConfirmEmail
+ data.Gender = "U"
data.BirthDay += "T00:00:00Z"
this.last_data = data
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index 19666f8b..3cfab914 100644
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -42,6 +42,16 @@ var BlogView = View.extend({
if (data.store[0].StoreIsOpen !== "true") {
app.closed.storeIsClosed = true
}
+ var fits_large = (data.store[0].FitsLarge === "true")
+
+ app.product.$fit.toggle( fits_large )
+ app.product.$sizing.toggle( fits_large )
+
+ if (data.store[0].BackgroundIsGray === "true") {
+ app.collection.$el.addClass("gray")
+ app.product.gallery.$el.addClass("gray")
+ }
+
},
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js
index 62dfe32d..fec5e1d1 100644
--- a/StoneIsland/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/www/js/lib/cart/CartPayment.js
@@ -11,7 +11,7 @@ var CartPayment = FormView.extend({
cc_list_mode: false,
events: {
- "change [name=same_as_shipping]": "toggle_shipping",
+ "change [name=SameAsShipping]": "toggle_shipping",
"click .address_dropdown": "toggle_address",
"click .cc_dropdown": "toggle_cc",
},
@@ -20,10 +20,14 @@ var CartPayment = FormView.extend({
this.parent = opt.parent
this.$form = this.$("form")
this.$msg = this.$(".msg")
+ this.$same_as_shipping = this.$("[name=SameAsShipping]")
+ this.$billing_address_rapper = this.$(".billing_address_rapper")
this.$address_list = this.$(".address_list")
this.$address_form = this.$(".address")
+ this.$address_dropdown = this.$(".address_dropdown")
this.$cc_list = this.$(".cc_list")
this.$cc_form = this.$(".cc")
+ this.$cc_dropdown = this.$(".cc_dropdown")
this.address = new AddressView ({ parent: this, checkPhone: false })
this.cc = new CreditCardView ({ parent: this })
@@ -32,13 +36,6 @@ var CartPayment = FormView.extend({
this.cc.disabled = true
},
- // sdk.cart.set_credit_card
- // sdk.payment.list_credit_cards
- // sdk.payment.add_credit_card
- // sdk.payment.delete_credit_card
- // sdk.payment.get_payment_types
- // sdk.cart.use_stored_credit_card
-
show: function(){
document.body.className = "cart"
app.cart.el.className = "payment"
@@ -48,11 +45,20 @@ var CartPayment = FormView.extend({
this.populate()
this.deferScrollToTop()
},
+
+ toggle_shipping: function(){
+ setTimeout(function(){
+ var state = this.$same_as_shipping.prop("checked")
+ this.$billing_address_rapper.toggle( ! state )
+ }.bind(this))
+ },
toggle_address: function(state){
if (! app.account.ccs.length) {
state = false
}
+ // this.$address_dropdown.toggle( !! app.account.ccs.length )
+
this.address_list_mode = typeof state == "boolean" ? state : ! this.list_mode
this.address.disabled = this.address_list_mode
this.$address_form.toggle(! this.address_list_mode)
@@ -63,6 +69,8 @@ var CartPayment = FormView.extend({
if (! app.account.ccs.length) {
state = false
}
+ // this.$cc_dropdown.toggle( !! app.account.ccs.length )
+
this.cc_list_mode = typeof state == "boolean" ? state : ! this.cc_list_mode
this.cc.disabled = this.cc_list_mode
this.$cc_form.toggle(! this.cc_list_mode)
@@ -70,6 +78,12 @@ var CartPayment = FormView.extend({
},
populate: function(){
+ this.$(".save_as_default").show()
+ this.$address_list.empty()
+ this.$cc_list.empty()
+ this.toggle_address( !! app.account.ccs.length )
+ this.toggle_cc( !! app.account.ccs.length )
+
app.account.ccs.forEach(function(cc){
console.log(cc)
@@ -91,6 +105,40 @@ var CartPayment = FormView.extend({
this.$cc_list.append(cc_t)
})
},
+
+ finalize: function(data){
+ var shipping_info = {}, address_data, address_id, cc_info = {}, cc_data, cc_id
+ var shipping_type = $("[name=ShippingType]").filter(function(){ return $(this).prop("checked") }).val()
+
+ if (this.list_mode) {
+ address_id = $("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val()
+ address_data = app.account.addressLookup[ address_id ]
+ }
+ else {
+ address_data = data
+ }
+ if (this.cc_list_mode) {
+ cc_id = $("[name=CCId]").filter(function(){ return $(this).prop("checked") }).val()
+ cc_data = app.account.ccLookup[ cc_id ]
+ }
+ else {
+ cc_data = data
+ }
+
+ shipping_info.Name = address_data.Name
+ shipping_info.Surname = address_data.Surname
+ shipping_info.Email = auth.user.Email
+ shipping_info.Phone = address_data.Phone
+ shipping_info.Mobile = address_data.Phone
+ shipping_info.StreetWithNumber = address_data.Address
+ shipping_info.PostalCode = address_data.ZipCode
+ shipping_info.City = address_data.City
+ shipping_info.Province = address_data.Province
+ shipping_info.Region = address_data.Province
+ shipping_info.CountryCode = "US"
+
+ return shipping_info
+ },
success: function(){
app.router.go('cart/confirm')
diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js
index e52eec4c..1a9653e1 100644
--- a/StoneIsland/www/js/lib/cart/CartShipping.js
+++ b/StoneIsland/www/js/lib/cart/CartShipping.js
@@ -58,7 +58,7 @@ var CartShipping = FormView.extend({
state = false
}
this.list_mode = typeof state == "boolean" ? state : ! this.list_mode
- this.$dropdown_wrapper.toggle( ! app.account.addresses.length )
+ this.$dropdown_wrapper.toggle( !! app.account.addresses.length )
this.address.disabled = this.list_mode
this.$address_form.toggle(! this.list_mode)
this.$address_list.toggle(this.list_mode)
@@ -93,16 +93,17 @@ var CartShipping = FormView.extend({
shipping_info.Name = address_data.Name
shipping_info.Surname = address_data.Surname
- shipping_info.Email = address_data.Name
+ shipping_info.Email = auth.user.Email
shipping_info.Phone = address_data.Phone
shipping_info.Mobile = address_data.Phone
shipping_info.StreetWithNumber = address_data.Address
shipping_info.PostalCode = address_data.ZipCode
shipping_info.City = address_data.City
+ shipping_info.Province = address_data.Province
shipping_info.Region = address_data.Province
shipping_info.CountryCode = "US"
- return address_data
+ return shipping_info
},
success: function(){
diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js
index 7872d32c..9a24afa5 100644
--- a/StoneIsland/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/www/js/lib/cart/CartSummary.js
@@ -158,6 +158,8 @@ var CartSummary = ScrollableView.extend({
var $el = $( e.currentTarget ).closest(".cart_item_row")
var data = $el.data()
+ console.log(this.data.Cart)
+
this.data.Cart.Totals.TotalWithoutPromotions -= data.price
this.data.Cart.Totals.TotalToPay -= data.price
this.data.Cart.Items = this.data.Cart.Items.filter(function(item){
@@ -173,13 +175,14 @@ var CartSummary = ScrollableView.extend({
this.empty()
}
+ app.curtain.show("loading")
sdk.cart.delete_item({
data: {
Code10: data.code,
Size: data.size,
},
success: function(){
- console.log("damn")
+ app.curtain.hide("loading")
},
})
},
diff --git a/StoneIsland/www/js/lib/nav/IntroView.js b/StoneIsland/www/js/lib/nav/IntroView.js
index 87e68959..2d8dca43 100644
--- a/StoneIsland/www/js/lib/nav/IntroView.js
+++ b/StoneIsland/www/js/lib/nav/IntroView.js
@@ -34,6 +34,7 @@ var IntroView = View.extend({
else {
heading = e.alpha || 0
}
+ heading = - heading
this.compass.style[transformProp] = "translateZ(0) translateX(-50%) translateY(-50%) rotate(" + heading + "deg)"
},
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 8ea03bd4..e35b789d 100644
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -36,7 +36,7 @@ var CollectionView = ScrollableView.extend({
this.fetch()
},
- ok: function(){
+ save: function(){
this.filterView.filter()
},
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index e151c208..eacfe989 100644
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/www/js/lib/products/ProductView.js
@@ -4,6 +4,7 @@ var ProductView = ScrollableView.extend({
el: "#product",
events: {
+ "click .fit": "scroll_to_bottom",
"click .size": "select_size",
"click .color": "select_color",
"click .share": "share",
@@ -20,6 +21,8 @@ var ProductView = ScrollableView.extend({
this.$size = this.$(".size")
this.$color = this.$(".color")
this.$body = this.$(".body")
+ this.$fit = this.$(".fit")
+ this.$sizing = this.$(".sizing")
},
show: function(){
@@ -242,6 +245,9 @@ var ProductView = ScrollableView.extend({
app.router.go('store')
},
+ scroll_to_bottom: function(){
+ },
+
share: function(){
},