diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-09-17 21:26:52 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-09-17 21:26:52 -0400 |
| commit | 5d68db92b37545fb03332a46b01d0f1aad8ce64b (patch) | |
| tree | 28aea3c304ab5adc01236f60b719dbaff834c375 /StoneIsland/platforms/ios/www/js/lib | |
| parent | 58bf27362c0b3d1d41e135aa8bdbd38297a4d0f9 (diff) | |
populate selector
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib')
6 files changed, 242 insertions, 6 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js index 742ee0f2..31dfd743 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js @@ -8,13 +8,26 @@ var ArchiveView = View.extend({ initialize: function(){ this.$content = this.$(".content") + this.$loader = this.$(".loader") + this.scroller = new IScroll('#archive .scroll') }, show: function(){ document.body.className = "archive" }, - populate: function(){ + populate: function(data){ + this.data = data + this.$loader.hide() + this.$content.empty() + this.data.forEach(function(row){ + var t = this.template.replace({{image}}, row.image.url) + .replace({{code}}, row.code) + .replace({{title}}, row.title) + .replace({{body}}, row.body) + this.$content.append(t) + }.bind(this)) }, + })
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js new file mode 100644 index 00000000..70fc910a --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js @@ -0,0 +1,33 @@ +var BlogView = View.extend({ + + data: null, + loaded: false, + initialize: function(){ + this.loader = new Loader () + this.fetch() + }, + + fetch: function(){ + $.ajax({ + method: "GET", + url: "http://stone.sup.land/db.json", + success: this.success.bind(this), + cache: true, + }) + }, + + success: function(data){ + this.loaded = true + this.data = data + this.loader.preloadImage(data.archive[0].image.url, function(img){ + app.archive.populate(data.archive) + }) + this.loader.preloadImage(data.hub[0].image.url, function(img){ + app.hub.populate(data.hub) + }) + this.loader.preloadImage(data.story[0].image.url, function(img){ + app.story.populate(data.story) + }) + }, + +})
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js index 430464b1..88ae6f1f 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js @@ -8,13 +8,29 @@ var HubView = View.extend({ initialize: function(){ this.$content = this.$(".content") + this.$loader = this.$(".loader") + this.scroller = new IScroll('#hub .scroll') }, show: function(){ document.body.className = "hub" }, - populate: function(){ + populate: function(data){ + this.data = data + this.$loader.hide() + this.$content.empty() + this.data.forEach(function(row){ + var t = this.template.replace({{image}}, row.image.url) + .replace({{date}}, row.date) + .replace({{code}}, row.code) + .replace({{title}}, row.title) + .replace({{subtitle}}, row.subtitle) + .replace({{link}}, row.link) + .replace({{body}}, row.body) + this.$content.append(t) + }.bind(this)) }, + })
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js index ed46af31..0f03a518 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js @@ -8,13 +8,25 @@ var StoryView = View.extend({ initialize: function(){ this.$content = this.$(".content") + this.$loader = this.$(".loader") + this.scroller = new IScroll('#story .scroll') }, show: function(){ document.body.className = "story" }, - - populate: function(){ + + populate: function(data){ + this.data = data + this.$loader.hide() + this.$content.empty() + this.data.forEach(function(row){ + var t = this.template.replace({{image}}, row.image.url) + .replace({{date}}, row.date) + .replace({{title}}, row.title) + .replace({{body}}, row.body) + this.$content.append(t) + }.bind(this)) }, })
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js index 0ce740a8..5d4e45f2 100644 --- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js @@ -7,11 +7,13 @@ var CollectionView = View.extend({ items: {}, events: { + "click .item": "pick", }, initialize: function(){ this.$content = this.$(".content") this.$loader = this.$(".loader") + this.scroller = new IScroll('#collection .scroll') }, show: function(){ @@ -25,7 +27,7 @@ var CollectionView = View.extend({ fetch: function(){ this.$loader.show() sdk.fetch_collection({ - gallery_id: 31617, // STONE ISLAND / SUPREME + gallery_id: 31483, // FOCUS ON CAMO success: this.populate.bind(this) }) }, @@ -43,5 +45,11 @@ var CollectionView = View.extend({ }.bind(this)) }, + + pick: function(e){ + var code = $(e.currentTarget).data("code") + var data = this.items[code] + app.product.load(data) + }, }) diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js index 3c18338e..a98f3ca4 100644 --- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js @@ -1,15 +1,169 @@ +var SIZE_LOOKUP = { + "XS": "X-SMALL", + "S": "SMALL", + "M": "MEDIUM", + "L": "LARGE", + "XL": "X-LARGE", + "XXL": "XX-LARGE", + "XXXL": "XXX-LARGE", +}; + var ProductView = View.extend({ el: "#product", events: { + "click .left": "prev", + "click .right": "next", + "touchstart .gallery": "touchstart", + "touchmove .gallery": "touchmove", + "touchend .gallery": "touchend", + "click .size": "select_size", + "click .color": "select_color", + "click .share": "share", }, initialize: function(){ + this.$num = this.$(".num") + this.$title = this.$(".title") + this.$type = this.$(".type") + this.$price = this.$(".price") + this.$size = this.$(".size") + this.$color = this.$(".color") + this.$body = this.$(".body") }, show: function(){ document.body.className = "product" }, + + load: function(data){ + // + this.item = data + + var name_partz = data['ModelNames'].split(' ') + var num = name_partz.shift() + var title = name_parts.join(' ') + var size = data['Sizes'][0] + var type = data['MicroCategory'].toUpperCase() + var price = "$" + data['DiscountedPrice'] + ".00" + var color = SIZE_LOOKUP[ data['Colors'][0]['Text'] ] + var body = "" + + this.$num.html(num) + this.$title.html(title) + this.$type.html(type) + this.$price.html(price) + this.$size.html(size) + this.$color.html(color) + this.$body.html(body) + }, + + select_size: function(){ + }, + select_color: function(){ + }, + share: function(){ + }, + + prev: function(){ + }, + next: function(){ + }, + touchstart: function(e){ + }, + touchmove: function(e){ + }, + end: function(e){ + }, + +}) + + +/* + +{ + "Code8": "41504876", + "BrandName": "STONE ISLAND", + "DefaultCode10": "41504876MA", + "MicroCategory": "Jacket", + "MacroCategory": "COATS & JACKETS", + "FullPrice": 728, + "DiscountedPrice": 437, + "PriceListId": 155702498, + "ModelNames": "41764 FLOWING CAMO WATRO", + "Sizes": [ + { + "Id": 4, + "Text": "S", + "ClassFamily": "INT", + "Labeled": true + }, + { + "Id": 6, + "Text": "L", + "ClassFamily": "INT", + "Labeled": true + }, + { + "Id": 7, + "Text": "XL", + "ClassFamily": "INT", + "Labeled": true + }, + { + "Id": 8, + "Text": "XXL", + "ClassFamily": "INT", + "Labeled": true + } + ], + "Colors": [ + { + "Id": 3152, + "Code10": { + "Id": 6769575, + "Value": "41504876MA" + }, + "Description": "Green", + "MacroColorId": 3152, + "Rgb": "3C941F" + } + ], + "SizeTypeId": 928, + "HasFlipSide": false, + "SeasonOfSale": "PE15", + "SalesLineId": "126", + "SalesLine": "18_STONE ISLAND", + "MarketId": 19, + "Criteria": { + "Sizes": [ + "3", + "5", + "6", + "7" + ], + "Looks": [], + "Styles": [], + "WashTypes": [], + "WashStories": [], + "WashCodes": [], + "Waists": [], + "Fabrics": [], + "ColorTypes": [], + "ModelNames": [], + "Material": [] + }, + "NoveltyPoints": 0, + "C10Attributes": [ + { + "Key": "MFC", + "Value": "621541764CC-6215-64V0050", + "C10": "41504876MA" + } + ], + "MacroCategoryId": 224, + "MicroCategoryId": 1319 +}, -})
\ No newline at end of file +*/
\ No newline at end of file |
