diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-05-06 15:22:04 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-05-06 15:22:04 +0200 |
| commit | a0a1eb402d84be81000ed608d3da40a495cc6d34 (patch) | |
| tree | eddd5d6c13005cd9ab6b2c8354573fa617e6de14 /StoneIsland/www/js/lib/cart | |
| parent | 9c18073017b5cc2334bf1867c004bfc74ba5a92a (diff) | |
cart accessibility
Diffstat (limited to 'StoneIsland/www/js/lib/cart')
| -rwxr-xr-x | StoneIsland/www/js/lib/cart/CartConfirm.js | 8 | ||||
| -rwxr-xr-x | StoneIsland/www/js/lib/cart/CartPayment.js | 17 | ||||
| -rwxr-xr-x | StoneIsland/www/js/lib/cart/CartShipping.js | 11 | ||||
| -rwxr-xr-x | StoneIsland/www/js/lib/cart/CartSummary.js | 12 |
4 files changed, 36 insertions, 12 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartConfirm.js b/StoneIsland/www/js/lib/cart/CartConfirm.js index 6909dcc3..11d529ff 100755 --- a/StoneIsland/www/js/lib/cart/CartConfirm.js +++ b/StoneIsland/www/js/lib/cart/CartConfirm.js @@ -90,9 +90,9 @@ var CartConfirm = FormView.extend({ .replace(/{{sku}}/, num) .replace(/{{title}}/, title) .replace(/{{type}}/, type) - .replace(/{{size}}/, size_name || "DEFAULT") - .replace(/{{color}}/, color_name || "DEFAULT") - .replace(/{{quantity}}/, 1) + .replace(/{{size}}/g, size_name || "DEFAULT") + .replace(/{{color}}/g, color_name || "DEFAULT") + .replace(/{{quantity}}/g, 1) .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) $el.data("price", details.Item.Price.DiscountedPrice) $el.html(t) @@ -109,6 +109,8 @@ var CartConfirm = FormView.extend({ this.$shipping.html( as_cash(shipping_cost) ) this.$tax.html( as_cash(tax) ) this.$total.html( as_cash(total) ) + this.$(".subtotal_row").attr('aria-label', "Subtotal " + as_cash(subtotal)) + this.$(".total_row").attr('aria-label', "Total " + as_cash(total)) if (data.Receiver) { var street = data.Receiver.StreetWithNumber.replace(/\n$/,"").replace("\n", ", ") diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js index 40d08d9e..0e4c3b84 100755 --- a/StoneIsland/www/js/lib/cart/CartPayment.js +++ b/StoneIsland/www/js/lib/cart/CartPayment.js @@ -73,6 +73,10 @@ var CartPayment = FormView.extend({ this.address.disabled = this.address_list_mode this.$address_form.toggle(! this.address_list_mode) this.$address_list.toggle(this.address_list_mode) + this.scroller.refresh() + this.$("input,select").map(function(i) { + this.setAttribute('tabindex', i+1) + }) }, toggle_cc: function(state){ @@ -86,6 +90,10 @@ var CartPayment = FormView.extend({ this.$cc_form.toggle(! this.cc_list_mode) this.$cc_list.toggle(this.cc_list_mode) this.$cc_confirm.toggle(this.cc_list_mode) + this.scroller.refresh() + this.$("input,select").map(function(i) { + this.setAttribute('tabindex', i+1) + }) }, focus_on_cc: function(e){ @@ -104,8 +112,8 @@ var CartPayment = FormView.extend({ this.toggle_address( !! app.account.ccs.length ) this.toggle_cc( !! app.account.ccs.length ) - app.account.ccs.forEach(function(cc){ - var address_t = this.address_template.replace(/{{id}}/g, cc.Id) + app.account.ccs.forEach(function(cc, i){ + var address_t = this.address_template.replace(/{{id}}/g, (cc.Id || i)) .replace(/{{checked}}/g, cc.IsDefault ? "checked" : "") .replace(/{{name}}/g, (cc.Name + " " + cc.Surname).toUpperCase()) .replace(/{{address}}/g, cc.Address.replace(/\n$/,"").replace("\n", ", ")) @@ -113,7 +121,7 @@ var CartPayment = FormView.extend({ .replace(/{{state}}/g, cc.Province) .replace(/{{zip}}/g, cc.ZipCode) - var cc_t = this.cc_template.replace(/{{id}}/g, cc.Id) + var cc_t = this.cc_template.replace(/{{id}}/g, (cc.Id || i)) .replace(/{{checked}}/g, cc.IsDefault ? "checked" : "") .replace(/{{number}}/g, cc['Number']) .replace(/{{type}}/g, cc.Type.toUpperCase()) @@ -122,6 +130,9 @@ var CartPayment = FormView.extend({ this.$address_list.append(address_t) this.$cc_list.append(cc_t) }.bind(this)) + this.$("input,select").map(function(i) { + this.setAttribute('tabindex', i+1) + }) }, finalize: function(data){ diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js index b5d6647b..157e75f5 100755 --- a/StoneIsland/www/js/lib/cart/CartShipping.js +++ b/StoneIsland/www/js/lib/cart/CartShipping.js @@ -43,8 +43,8 @@ var CartShipping = FormView.extend({ this.toggle_dropdown(false) return } - app.account.addresses.forEach(function(address){ - var t = this.template.replace(/{{id}}/g, address.Id) + app.account.addresses.forEach(function(address, i){ + var t = this.template.replace(/{{id}}/g, (address.Id || i)) .replace(/{{checked}}/g, address.IsDefault ? "checked" : "") .replace(/{{name}}/g, (address.Name + " " + address.Surname).toUpperCase()) .replace(/{{address}}/g, address.Address.replace(/\n$/,"").replace("\n", ", ")) @@ -69,6 +69,9 @@ var CartShipping = FormView.extend({ $("#standard-shipping").prop("checked", cart_data.Cart.DeliveryMethod.Type == 1) $("#express-shipping").prop("checked", cart_data.Cart.DeliveryMethod.Type == 2) } + this.$("input,select").map(function(i) { + this.setAttribute('tabindex', i+1) + }) }, toggle_dropdown: function(state){ @@ -80,6 +83,10 @@ var CartShipping = FormView.extend({ this.address.disabled = this.list_mode this.$address_form.toggle(! this.list_mode) this.$address_list.toggle(this.list_mode) + this.scroller.refresh() + this.$("input,select").map(function(i) { + this.setAttribute('tabindex', i+1) + }) }, // sdk.cart.set_shipping_address diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js index 51aa35ef..9637ae35 100755 --- a/StoneIsland/www/js/lib/cart/CartSummary.js +++ b/StoneIsland/www/js/lib/cart/CartSummary.js @@ -112,11 +112,11 @@ var CartSummary = ScrollableView.extend({ .replace(/{{sku}}/g, num) .replace(/{{code8}}/g, data['Code8']) .replace(/{{title}}/g, title) - .replace(/{{cleantitle}}/g, stonewash(title)) + .replace(/{{cleantitle}}/g, num + ' ' + stonewash(title) + ' ' + descriptions['MicroCategory']) .replace(/{{type}}/, type) - .replace(/{{size}}/, size_name) - .replace(/{{color}}/, color_name) - .replace(/{{quantity}}/, 1) + .replace(/{{size}}/g, size_name) + .replace(/{{color}}/g, color_name) + .replace(/{{quantity}}/g, 1) .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) $el.html(t) this.refreshScroller() @@ -129,6 +129,7 @@ var CartSummary = ScrollableView.extend({ this.updateTotals() + this.$cart_empty.hide() this.el.className = "full" this.refreshScroller() app.curtain.hide("loading") @@ -149,6 +150,8 @@ var CartSummary = ScrollableView.extend({ this.$shipping.html( as_cash(shipping_cost) ) this.$tax.html( as_cash(tax) ) this.$total.html( as_cash(total) ) + this.$(".subtotal_row").attr('aria-label', "Subtotal " + as_cash(subtotal)) + this.$(".total_row").attr('aria-label', "Total " + as_cash(total)) }, empty: function(){ @@ -158,6 +161,7 @@ var CartSummary = ScrollableView.extend({ this.parent.$itemcount.html("0 ITEMS") this.el.className = "empty" this.parent.$steps.hide() + this.$cart_empty.show() app.curtain.hide("loading") }, |
