diff options
| -rw-r--r-- | StoneIsland/www/css/account.css | 7 | ||||
| -rw-r--r-- | StoneIsland/www/index.html | 11 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/AccountView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/nav/AddressView.js | 19 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/view/Serializable.js | 1 |
5 files changed, 28 insertions, 12 deletions
diff --git a/StoneIsland/www/css/account.css b/StoneIsland/www/css/account.css index d450c42c..31433871 100644 --- a/StoneIsland/www/css/account.css +++ b/StoneIsland/www/css/account.css @@ -396,4 +396,11 @@ input.switch:checked + label:after { } .select-wrapper.picked span { color: #000; +} + +.country-wrapper-static { + text-align: center; + color: #a9a9a9; + padding-top: 9px; + font-size: 14px; }
\ No newline at end of file diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index b06b3297..1ca0ab77 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -738,8 +738,8 @@ <input type="text" name="City" placeholder="City"> <div class="select-wrapper"> <span>STATE</span> - <select name="State"> - <option value="NONE">State</option> + <select name="Province"> + <option value="NONE" selected>State</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> @@ -795,11 +795,14 @@ </div> </div> <div class="half-input"> - <input type="text" name="Zip" placeholder="ZIP" required> - <div id="country-wrapper"> + <input type="text" name="ZipCode" placeholder="ZIP" required> + <div class="country-wrapper-static"> + UNITED STATES +<!-- <div id="country-select"> <input type="text" name="Country" placeholder="UNITED STATES" required> </div> + --> </div> </div> <input type="number" name="Phone" placeholder="Phone Number"> diff --git a/StoneIsland/www/js/lib/account/AccountView.js b/StoneIsland/www/js/lib/account/AccountView.js index 86c02056..e1d7ca71 100644 --- a/StoneIsland/www/js/lib/account/AccountView.js +++ b/StoneIsland/www/js/lib/account/AccountView.js @@ -26,9 +26,11 @@ var AccountView = View.extend({ data.AddressBook.addressBookItem.forEach(function(item){ if (item.isDefault) { // populate app.shipping.address + app.shipping.address.populate(item) } else if (item.isBillingDefault) { // populate app.billing.address + app.payment.address.populate(item) } }) }, diff --git a/StoneIsland/www/js/lib/nav/AddressView.js b/StoneIsland/www/js/lib/nav/AddressView.js index 15a5784d..e63b0330 100644 --- a/StoneIsland/www/js/lib/nav/AddressView.js +++ b/StoneIsland/www/js/lib/nav/AddressView.js @@ -8,32 +8,35 @@ var AddressView = SerializableView.extend({ initialize: function(opt){ this.parent = opt.parent - this.$el = this.parent.$(".address") - this.el = this.$el[0] + this.setElement( this.parent.$(".address") ) this.$el.html(this.template) }, populate: function(data){ - this.parent.$(".address input").val("") + var address = data.Address.split("\n") + data.Address1 = address[0] + data.Address2 = address[1] + this.$(".address input").val("") Object.keys(data).forEach(function(key){ - this.parent$(".address [name=" + key + "]").val(data[key]) + this.$(".address [name=" + key + "]").val(data[key]) }.bind(this)) }, - deserialize: function(){ - }, - validate_presence: { "Name": "Please enter your first name.", "Surname": "Please enter your last name.", "Address1": "Please enter your street address.", "City": "Please enter your city.", - "State": "Please choose your state.", "Phone": "Please enter your phone number.", }, validate_fields: function(data, errors){ if (data.Phone.replace(/[^0-9]/g, "").length < 10) { errors.push([ "Phone", "Phone numbers must be at least 10 digits." ]) } + if (data.Province == "NONE") { errors.push([ "Province", "Please choose your state." ]) } + data.Address = data.Address1 + "\n" + data.Address2 + data.UserId = auth.user_id + delete data.Address1 + delete data.Address2 }, }) diff --git a/StoneIsland/www/js/lib/view/Serializable.js b/StoneIsland/www/js/lib/view/Serializable.js index 8084b9f5..e3ef123c 100644 --- a/StoneIsland/www/js/lib/view/Serializable.js +++ b/StoneIsland/www/js/lib/view/Serializable.js @@ -3,6 +3,7 @@ var SerializableView = View.extend({ events: { "change select": "update_select", "focus input": "focus_input", + "submit form": "save", }, preload: function(data){ |
