summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/nav
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/nav')
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/AddressView.js18
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js4
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/nav/NavView.js12
3 files changed, 24 insertions, 10 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
index 9e0c49b6..fd0fa59d 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
@@ -1,4 +1,6 @@
+var AddressViewID = Math.round(Date.now() % 1000)
+
var AddressView = SerializableView.extend({
template: $("#address_template").html(),
@@ -14,7 +16,7 @@ var AddressView = SerializableView.extend({
this.parent = opt.parent
this.checkPhone = 'checkPhone' in opt ? opt.checkPhone : true
this.setElement( this.parent.$(".address") )
- this.$el.html(this.template)
+ this.$el.html(this.template.replace(/{{_id}}/g, AddressViewID++))
},
populate: function(data){
@@ -34,12 +36,15 @@ var AddressView = SerializableView.extend({
"Address1": "Please enter your street address.",
"City": "Please enter your city.",
"ZipCode": "Please enter your zip code.",
+ "Phone": "Please enter your phone number.",
},
validate_fields: function(data, errors){
if (this.disabled) { return }
if (this.checkPhone) {
- var phone_number = data.Phone ? data.Phone.replace(/[^0-9]/g, "") : ""
+ var phone_number = data.Phone ? String(data.Phone).replace(/[^0-9]/g, "").replace(/^[01]+/, '') : ""
+ data.Phone = phone_number
+ this.$('[name=Phone]').val(phone_number)
var phone_length = phone_number.length
if (phone_length === 0 || ! data.Phone) {
errors.push([ "Phone", "Please enter your phone number." ])
@@ -50,10 +55,10 @@ var AddressView = SerializableView.extend({
else if (phone_length > 10) {
errors.push([ "Phone", "International phone numbers are not accepted." ])
}
- else if (data.Phone[0] === '+') {
+ else if (phone_number.charAt(0) === '+') {
errors.push([ "Phone", "Please enter a valid 10 digit US/Canada phone number. International phone numbers are not accepted." ])
}
- else if (phone_number[0] === '1') {
+ else if (phone_number.charAt(0) === '1') {
errors.push([ "Phone", "Please enter a valid 10 digit US/Canada phone number. International phone numbers are not accepted." ])
}
}
@@ -81,7 +86,10 @@ var AddressView = SerializableView.extend({
},
scroll_up_to_phone: function(e){
- app.view.scroller && app.view.scroller.scrollTo(0, -$(e.currentTarget).position().top)
+ var position = $(e.currentTarget).prev('label').position()
+ if (app.view.scroller && position) {
+ app.view.scroller.scrollTo(0, -position.top)
+ }
},
})
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js b/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
index 63784618..af53d964 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
@@ -1,4 +1,6 @@
+var CreditCardViewID = Math.round(Date.now() % 1000)
+
var CreditCardView = SerializableView.extend({
template: $("#creditcard_template").html(),
@@ -13,7 +15,7 @@ var CreditCardView = SerializableView.extend({
initialize: function(opt){
this.parent = opt.parent
this.setElement( this.parent.$(".cc") )
- this.$el.html(this.template)
+ this.$el.html(this.template.replace(/{{_id}}/g, CreditCardViewID++))
this.$number = this.$("[name=Number]")
this.$number.validateCreditCard(this.updateCard.bind(this), this.cardOptions)
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
index 86c8ecaf..958bc8ad 100755
--- a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
@@ -23,7 +23,8 @@ var NavView = View.extend({
"click .shipping": "shipping",
"click .settings": "settings",
"click .orders": "orders",
- "click .return_link": "return_link",
+ "click .return_link_us": "return_link_us",
+ "click .return_link_ca": "return_link_ca",
"click .faq_back": "back",
"click .privacy": "privacy",
@@ -115,8 +116,11 @@ var NavView = View.extend({
this.hide()
app.router.go("account/settings")
},
- return_link: function(){
- window.open("http://www.stoneisland.com/yTos/Plugins/AreaLocalizer/Redirectarea?area=ProductExchange&controllerName=SearchOrder&actionName=Index", '_system')
+ return_link_us: function(){
+ window.open("https://www.stoneisland.com/us/ProductExchange/SearchOrder/Index?utm_source=AppMobile&utm_medium=referral&utm_campaign=ReturnForm", '_system')
+ },
+ return_link_ca: function(){
+ window.open("https://www.stoneisland.com/ca/ProductExchange/SearchOrder/Index?utm_source=AppMobile&utm_medium=referral&utm_campaign=ReturnForm", '_system')
},
@@ -141,7 +145,7 @@ var NavView = View.extend({
},
care: function(e){
e.preventDefault()
- window.open("http://www.stoneisland.com/system/web/custom/hp/email.jsp", '_system')
+ window.open("https://www.stoneisland.com/customercare?utm_source=AppMobile&utm_medium=referral&utm_campaign=CustomerCare", '_system')
},