-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Description
RangeCollectionCell.prototype.drawCell = function() {
this.addClass("rangeCollection");
this.viewElement.style.width = "50%";
this.viewElement.style.display = "inline-block"
this.row_content.style.position = "relative";
this.imageView = document.createElement('a');
this.imageView.className = "range-image";
this.imageView.style.display = "block";
this.imageView.style.position = "absolute";
this.imageView.style.left = "9px";
this.imageView.style.right = "9px";
this.imageView.style.top = "20px";
this.imageView.style.height = "165px";
this.imageView.style.border = "1px solid #aaa";
this.imageView.style.backgroundImage = "url('"+app.url+"/app/brand/placeholder')";
this.imageView.href = "/uploads/product_images/"+this.range.RANGECODE+".jpg";
this.imageView.style.backgroundSize = "contain";
this.imageView.style.backgroundRepeat = "no-repeat";
this.imageView.style.backgroundPosition = "center center";
//Lazy load the product image
if(this.range.IMAGE_EXISTS) {
var self = this;
var img = new Image();
ImgCache.isCached(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg", function(path, success){
if(success){
ImgCache.getCachedFileURL(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg",
function (src, url) {
if (device.platform == "browser") {
url = src;
}
img.src = url;
self.imageView.href = url;
self.imageView.style.backgroundImage = "url(" + url + ")";
self.imageView.setAttribute("data-fresco-group", "gallery");
self.imageView.className += " fresco";
}
);
} else {
ImgCache.cacheFile(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg", function () {
ImgCache.getCachedFileURL(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg",
function (src, url) {
if (device.platform == "browser") {
url = src;
}
img.src = url;
self.imageView.href = url;
self.imageView.style.backgroundImage = "url(" + url + ")";
self.imageView.setAttribute("data-fresco-group", "gallery");
self.imageView.className += " fresco";
}
);
});
}
})
}
this.row_content.appendChild(this.imageView);
var name = document.createTextNode(this.range.RANGE_NAME);
this.textLabel = document.createElement('label');
this.textLabel.className = "rangeLabel";
this.textLabel.appendChild(name);
this.textLabel.style.position = "absolute";
this.textLabel.style.left = "9px";
this.textLabel.style.right = "9px";
this.textLabel.style.bottom = "10px";
this.textLabel.style.textAlign = "center";
this.row_content.appendChild(this.textLabel);
return this.row_content;
}
Metadata
Metadata
Assignees
Labels
No labels