summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-07-13 23:41:11 +0200
committerJules Laplace <julescarbon@gmail.com>2019-07-13 23:41:11 +0200
commit20d3f4537a578c581285ae8c90da2af9f929be66 (patch)
tree9afd4c77c3d3529dd6080533775bb450a7c917aa /StoneIsland/www/js
parent90a550943188af41dfe8e82ddc386f56436c5a7e (diff)
many changes to forms. starting to add labels
Diffstat (limited to 'StoneIsland/www/js')
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartSummary.js3
-rw-r--r--StoneIsland/www/js/lib/etc/accessibility.js9
-rwxr-xr-xStoneIsland/www/js/lib/products/CollectionView.js2
-rwxr-xr-xStoneIsland/www/js/lib/products/Selector.js2
-rwxr-xr-xStoneIsland/www/js/lib/view/Serializable.js7
5 files changed, 17 insertions, 6 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js
index 9b5da7b7..0a45d937 100755
--- a/StoneIsland/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/www/js/lib/cart/CartSummary.js
@@ -111,7 +111,8 @@ var CartSummary = ScrollableView.extend({
var t = this.template
.replace(/{{image}}/, sdk.image(item['Code10'], '11_f'))
.replace(/{{sku}}/, num)
- .replace(/{{title}}/, title)
+ .replace(/{{title}}/g, title)
+ .replace(/{{cleantitle}}/g, stonewash(title))
.replace(/{{type}}/, type)
.replace(/{{size}}/, size_name)
.replace(/{{color}}/, color_name)
diff --git a/StoneIsland/www/js/lib/etc/accessibility.js b/StoneIsland/www/js/lib/etc/accessibility.js
index 5acb0723..ad04980c 100644
--- a/StoneIsland/www/js/lib/etc/accessibility.js
+++ b/StoneIsland/www/js/lib/etc/accessibility.js
@@ -1,5 +1,10 @@
$(function(){
$("h1").each(function(el){
- $(el).attr('aria-label', "Page title: " + el.innerText)
+ console.log(el)
+ el['aria-label'] = 'Section title is ' + el.innerText
})
-}) \ No newline at end of file
+})
+
+function stonewash (s) {
+ return s.replace(/'0/g, '20').replace(/_/g, ' ')
+} \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 4674fc18..b7af235a 100755
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -196,6 +196,7 @@ var CollectionView = ScrollableView.extend({
this.items[ item['Code8'] ] = item
var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'], is_single_product ? '13_f' : '11_f'))
.replace(/{{code8}}/, item['Code8'])
+ .replace(/{{title}}/, stonewash(item['ModelNames']))
var $t = $(t)
if (app.store.ShowProductNameOnCollectionPage) {
var $title = $("<span>")
@@ -217,6 +218,7 @@ var CollectionView = ScrollableView.extend({
setCollectionName: function(name){
this.collectionName = name
this.$title.html(this.collectionName)
+ this.$title.attr('aria-label', stonewash(this.collectionName))
},
// filter by department
diff --git a/StoneIsland/www/js/lib/products/Selector.js b/StoneIsland/www/js/lib/products/Selector.js
index 9c1109f6..e3376a4d 100755
--- a/StoneIsland/www/js/lib/products/Selector.js
+++ b/StoneIsland/www/js/lib/products/Selector.js
@@ -21,7 +21,7 @@ var Selector = View.extend({
options.forEach(function(opt){
this.lookup[String(opt.id)] = opt
var t = this.template.replace(/{{id}}/, opt.id)
- .replace(/{{label}}/, opt.label)
+ .replace(/{{label}}/g, opt.label)
this.$options.append(t)
}.bind(this))
this.$el.show()
diff --git a/StoneIsland/www/js/lib/view/Serializable.js b/StoneIsland/www/js/lib/view/Serializable.js
index 4155f102..3181fddd 100755
--- a/StoneIsland/www/js/lib/view/Serializable.js
+++ b/StoneIsland/www/js/lib/view/Serializable.js
@@ -105,6 +105,7 @@ var SerializableView = View.extend({
console.log(errors)
var msgs = []
this.$('.error_hilite').removeClass('error_hilite')
+ this.$('.err').html('')
errors.forEach(function(e, i){
// if (i > 0) { return }
if (e[0]) {
@@ -112,13 +113,15 @@ var SerializableView = View.extend({
var el = $el[0]
if (el && el.nodeName === 'SELECT') {
$el.parent().addClass('error_hilite')
+ $el.parent().next('.err').html(e[1])
} else {
$el.addClass('error_hilite')
+ $el.next('.err').html(e[1])
}
}
- msgs.push(e[1])
+ // msgs.push(e[1])
}.bind(this))
- this.$msg.html(msgs.join("<br>"))
+ // this.$msg.html(msgs.join("<br>"))
this.$msg.addClass('alert-notice')
},