summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js')
-rwxr-xr-xStoneIsland/www/js/lib/account/AccountView.js5
-rwxr-xr-xStoneIsland/www/js/lib/account/ProfileView.js4
-rwxr-xr-xStoneIsland/www/js/lib/auth/SignupView.js2
-rwxr-xr-xStoneIsland/www/js/lib/blogs/BlogView.js10
-rwxr-xr-xStoneIsland/www/js/lib/blogs/HubView.js4
-rwxr-xr-xStoneIsland/www/js/lib/nav/AddressView.js8
-rwxr-xr-xStoneIsland/www/js/lib/products/ProductView.js83
-rwxr-xr-xStoneIsland/www/js/lib/view/Serializable.js7
-rwxr-xr-xStoneIsland/www/js/sdk/address.js2
9 files changed, 77 insertions, 48 deletions
diff --git a/StoneIsland/www/js/lib/account/AccountView.js b/StoneIsland/www/js/lib/account/AccountView.js
index 80738be0..73637cd1 100755
--- a/StoneIsland/www/js/lib/account/AccountView.js
+++ b/StoneIsland/www/js/lib/account/AccountView.js
@@ -103,13 +103,18 @@ var AccountView = View.extend({
else {
cb && cb()
}
+ console.log('logged in')
if ( ! auth.has_cart() ) {
+ console.log('no cart')
app.curtain.show("loading")
auth.create_cart({
success: function(){
+ console.log('got cart')
if (auth.deferred_product) {
+ console.log('adding deferred product')
auth.add_deferred_product_to_cart({
success: function(){
+ console.log('success!')
app.router.go("cart")
setTimeout(function(){
app.curtain.hide("loading")
diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js
index 52ef8056..ee39374b 100755
--- a/StoneIsland/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/www/js/lib/account/ProfileView.js
@@ -26,6 +26,9 @@ var ProfileView = FormView.extend({
if (auth.user.BirthDay.match(/T/)) {
auth.user.BirthDay = auth.user.BirthDay.split("T")[0]
}
+ if (auth.user.BirthDay === '1900-01-01') {
+ auth.user.BirthDay = ''
+ }
if (auth.user.name && ! auth.user.Name) {
auth.user.Name = auth.user.name
}
@@ -51,6 +54,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.Birthday) data.BirthDay = '1900-01-01'
// if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
},
diff --git a/StoneIsland/www/js/lib/auth/SignupView.js b/StoneIsland/www/js/lib/auth/SignupView.js
index 220026c0..ed702a03 100755
--- a/StoneIsland/www/js/lib/auth/SignupView.js
+++ b/StoneIsland/www/js/lib/auth/SignupView.js
@@ -56,12 +56,14 @@ var SignupView = FormView.extend({
},
validate_fields: function(data, errors){
+ console.log(data)
if (data.Password.length < 7) { errors.push([ "Password", "Password must be 7 characters or more." ]) }
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.DataProfiling !== "true") { errors.push([ "DataProfiling", "You must consent to use this service." ]) }
+ if (! data.BirthDay) data.BirthDay = '1900-01-01'
data.YooxLetter = this.$("[name=YooxLetter]").prop("checked")
},
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index fd7b5212..6eea977f 100755
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -2,6 +2,10 @@ var BlogView = View.extend({
data: null,
loaded: false,
+
+ us_states: $("#us_states").html(),
+ ca_states: $("#ca_states").html(),
+
initialize: function(){
this.loader = new Loader ()
},
@@ -99,6 +103,12 @@ var BlogView = View.extend({
app.collection.$el.addClass("gray")
app.product.gallery.$el.addClass("gray")
}
+
+ var states = this.us_states
+ if (! app.store.NotAvailableInCanada) {
+ states += this.ca_states
+ }
+ $('[name=Province]').html(states)
},
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js
index 4164ab0e..ad0fd9b0 100755
--- a/StoneIsland/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/www/js/lib/blogs/HubView.js
@@ -176,8 +176,8 @@ var HubLoader = (function(){
view.append(item)
view.scroller.refresh()
if (count === 3 && ! needed) return
- if (count === 10) return
- setTimeout(HubLoader.load, count < 3 ? 1000 : 5000)
+ // if (count === 10) return
+ setTimeout(HubLoader.load, count < 10 ? 1000 : 5000)
}
return HubLoader
})()
diff --git a/StoneIsland/www/js/lib/nav/AddressView.js b/StoneIsland/www/js/lib/nav/AddressView.js
index 64ea265f..1c9540bc 100755
--- a/StoneIsland/www/js/lib/nav/AddressView.js
+++ b/StoneIsland/www/js/lib/nav/AddressView.js
@@ -2,8 +2,6 @@
var AddressView = SerializableView.extend({
template: $("#address_template").html(),
- us_states: $("#us_states").html(),
- ca_states: $("#ca_states").html(),
disabled: false,
@@ -20,11 +18,7 @@ var AddressView = SerializableView.extend({
},
populate: function(data){
- this.$("[name=Province]").empty()
- this.$("[name=Province]").append(this.us_states)
- if (! app.store.NotAvailableInCanada) {
- this.$("[name=Province]").append(this.ca_states)
- }
+ // console.log( this.$('[name=Province]') )
this.data = data
var address = data.Address.split("\n")
data.Address1 = address[0]
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index f9de3ab3..214819cf 100755
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/www/js/lib/products/ProductView.js
@@ -42,9 +42,11 @@ var ProductView = ScrollableView.extend({
showFooter: function(){
if (this.sold_out) {
+ console.log("FOOTER: SOLD OUT")
app.footer.show("SOLD OUT")
}
else if (this.isNotAvailable) {
+ console.log("FOOTER: NOT AVAILABLE")
app.footer.show("NOT AVAILABLE")
}
else {
@@ -134,9 +136,11 @@ var ProductView = ScrollableView.extend({
app.product.$notAvailableInCanada.toggle( notAvailableInCanada )
if (! ('Price' in details['Item'])) {
+ console.log("NO PRICE, IS NOT AVAILABLE")
this.isNotAvailable = true
}
else {
+ console.log("FOUND PRICE, IS AVAILABLE")
this.isNotAvailable = false
}
@@ -329,35 +333,7 @@ var ProductView = ScrollableView.extend({
}
// if we don't have a cart setup...
else if ( ! auth.has_cart() ) {
- app.curtain.show("loading")
- auth.create_cart({
- success: function(){
- auth.add_deferred_product_to_cart({
- success: function(){
- app.curtain.hide("loading")
- app.router.go("cart")
- },
- error: function(){
- // SHOULD NOT BE A PROBLEM
- console.log("ERROR ADDING PRODUCT TO NEW CART SIMPLE ADD TO CART")
- app.curtain.hide("loading")
- app.router.go("account/login")
- auth.deferred_product = deferred_product
- app.last_view = app.cart
- },
- })
- },
- error: function(){
- // ERROR CREATING CART?
- console.log("ERROR CREATING CART")
- auth.log_out()
- app.account.logged_out()
- app.curtain.hide("loading")
- app.router.go("account/login")
- auth.deferred_product = deferred_product
- app.last_view = app.cart
- },
- })
+ this.create_cart_and_add_product()
}
else {
app.curtain.show("loading")
@@ -368,18 +344,53 @@ var ProductView = ScrollableView.extend({
app.router.go("cart")
}
},
- error: function(){
+ error: function(err){
console.log("CART MIGHT BE OLD")
- // TODO - CART MIGHT BE OLD
- app.curtain.hide("loading")
- app.router.go("account/login")
- auth.deferred_product = deferred_product
- app.last_view = app.cart
- },
+ this.create_cart_and_add_product()
+ // console.log(err)
+ //
+ // // TODO - CART MIGHT BE OLD
+ // app.curtain.hide("loading")
+ // app.router.go("account/login")
+ // auth.deferred_product = deferred_product
+ // app.last_view = app.cart
+ }.bind(this),
})
}
},
+ create_cart_and_add_product: function() {
+ app.curtain.show("loading")
+ auth.create_cart({
+ success: function(){
+ auth.add_deferred_product_to_cart({
+ success: function(){
+ app.curtain.hide("loading")
+ app.router.go("cart")
+ },
+ error: function(){
+ // SHOULD NOT BE A PROBLEM
+ console.log("ERROR ADDING PRODUCT TO NEW CART SIMPLE ADD TO CART")
+ app.curtain.hide("loading")
+ app.router.go("account/login")
+ auth.deferred_product = deferred_product
+ app.last_view = app.cart
+ },
+ })
+ },
+ error: function(){
+ // ERROR CREATING CART?
+ console.log("ERROR CREATING CART")
+ auth.log_out()
+ app.account.logged_out()
+ app.curtain.hide("loading")
+ app.router.go("account/login")
+ auth.deferred_product = deferred_product
+ app.last_view = app.cart
+ },
+ })
+ },
+
back: function(){
app.router.go('store')
},
diff --git a/StoneIsland/www/js/lib/view/Serializable.js b/StoneIsland/www/js/lib/view/Serializable.js
index fa4eba02..ae0a4fbc 100755
--- a/StoneIsland/www/js/lib/view/Serializable.js
+++ b/StoneIsland/www/js/lib/view/Serializable.js
@@ -42,7 +42,7 @@ var SerializableView = View.extend({
this.$("input[name], select[name], textarea[name]").each( function(){
if (this.type == "checkbox") {
if ($(this).prop("checked")) {
- fields[this.name] = this.value
+ fields[this.name] = this.value || "true"
}
}
else {
@@ -77,6 +77,9 @@ var SerializableView = View.extend({
update_date: function(e){
var $target = $(e.currentTarget), value = $target.val()
var label = moment(value).format("MM/DD/YYYY")
+ if (label === 'Invalid date') {
+ label = 'BIRTHDAY (OPTIONAL)'
+ }
$target.parent().addClass("picked")
$target.parent().find("span").html(label)
},
@@ -128,7 +131,7 @@ var SerializableView = View.extend({
}
else {
this.hide_errors()
- cordova.plugins.Keyboard.close()
+ window.cordova && cordova.plugins.Keyboard.close()
}
var finalized_data = this.finalize(valid.data)
diff --git a/StoneIsland/www/js/sdk/address.js b/StoneIsland/www/js/sdk/address.js
index 1256df54..315f3172 100755
--- a/StoneIsland/www/js/sdk/address.js
+++ b/StoneIsland/www/js/sdk/address.js
@@ -16,7 +16,7 @@ sdk.address = (function(){
},
error: opt.error,
complete: function(data){
- console.log("really weird")
+ console.log("address list complete")
console.log(data)
}
})