summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/products/CollectionView.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-03-04 22:37:20 +0100
committerJules Laplace <jules@okfoc.us>2016-03-04 22:37:20 +0100
commit08c203b4dc4b9fdacd9aa0f2f2074dbd7d431a80 (patch)
tree40719f082ec67774654d10f50a332ea06ba23bb8 /StoneIsland/www/js/lib/products/CollectionView.js
parent3a7ab01806ec52c048284029613b9bdaa0f6ec25 (diff)
checkin stuff
Diffstat (limited to 'StoneIsland/www/js/lib/products/CollectionView.js')
-rwxr-xr-xStoneIsland/www/js/lib/products/CollectionView.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 1c50c80d..3fd4a757 100755
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -80,8 +80,10 @@ var CollectionView = ScrollableView.extend({
else {
console.log("populate 2")
this.data = data
+ this.loaded = false
console.log(data)
}
+ console.log(">>>>>>>> YES ")
if (! this.loaded) {
console.log("populate 3")
this.loaded = true
@@ -89,7 +91,16 @@ var CollectionView = ScrollableView.extend({
this.$content.empty()
// DefaultCode10
// data.SearchResponseFull.Results.Items.length = 1
- this.$content.toggleClass("single", (data.SearchResponseFull.Results.Items.length == 1))
+ var is_single_product = (data.SearchResponseFull.Results.Items.length == 1)
+ this.$content.toggleClass("single", is_single_product)
+
+ if (is_single_product) {
+ console.log("IS SINGLE PRODUCT")
+ var item = data.SearchResponseFull.Results.Items[0]
+ var url = sdk.image(item['DefaultCode10'], '13_f')
+ var img = new Image ()
+ img.src = url
+ }
// if (data.SearchResponseFull.Results.Items.length == 1) {
// app.footer.hide()
@@ -98,16 +109,20 @@ var CollectionView = ScrollableView.extend({
// app.footer.show("FILTER")
// }
- data.SearchResponseFull.Results.Items.forEach(this.append.bind(this))
+ console.log( data.SearchResponseFull.Results.Items.length )
+ data.SearchResponseFull.Results.Items.forEach(function(item){
+ console.log(">>> ITEM")
+ this.append(item, is_single_product)
+ }.bind(this))
this.deferScrollToTop()
}
this.afterFetchCallback && this.afterFetchCallback()
app.collection.deferRefresh()
},
- append: function(item){
+ append: function(item, is_single_product){
this.items[ item['Code8'] ] = item
- var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'], '11_f'))
+ var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10'], is_single_product ? '13_f' : '11_f'))
.replace(/{{code8}}/, item['Code8'])
this.$content.append(t)
},