summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/products/GalleryView.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-05 18:31:48 -0500
committerJules Laplace <jules@okfoc.us>2015-11-05 18:31:48 -0500
commit229605c8d6dbae52ade11d52a2af76ebb404eab2 (patch)
treec5e4bda7e4ffcb916c04eb03d3f0e6626a90a689 /StoneIsland/www/js/lib/products/GalleryView.js
parent798fc4efb2da2ba0bc730bbb409993239edc0c63 (diff)
scroll stuff and load images for gallery
Diffstat (limited to 'StoneIsland/www/js/lib/products/GalleryView.js')
-rw-r--r--StoneIsland/www/js/lib/products/GalleryView.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/StoneIsland/www/js/lib/products/GalleryView.js b/StoneIsland/www/js/lib/products/GalleryView.js
index 2eabe2a6..44eed9f0 100644
--- a/StoneIsland/www/js/lib/products/GalleryView.js
+++ b/StoneIsland/www/js/lib/products/GalleryView.js
@@ -1,6 +1,7 @@
var GalleryView = View.extend({
el: "#gallery",
+ template: $("#gallery .template").html(),
events: {
"click .left": "prev",
@@ -16,7 +17,23 @@ var GalleryView = View.extend({
this.$slider = this.$(".slider")
},
- populate: function(){
+ populate: function(code, image_ids){
+ var valid_styles = {}
+ image_ids.forEach(function(id){
+ if (id.indexOf("_") == -1) return
+ var partz = id.split("_")
+ var size = parseInt(partz[0]), style = partz[1]
+ if (size > 13) return;
+ if (! valid_styles[style] || valid_styles[style] < size) {
+ valid_styles[style] = size
+ }
+ })
+ Object.keys(valid_styles).forEach(function(style){
+ var id = valid_styles[style] + "_" + style
+ var t = this.template.replace(/{{image}}/, sdk.image(code, id))
+ .replace(/{{id}}/, sdk.image(code, id))
+ this.$slider.append(t)
+ }.bind(this))
},
prev: function(){