summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib')
-rw-r--r--StoneIsland/www/js/lib/_router.js3
-rw-r--r--StoneIsland/www/js/lib/products/CollectionView.js31
-rw-r--r--StoneIsland/www/js/lib/products/Selector.js10
3 files changed, 41 insertions, 3 deletions
diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js
index d45ffdc2..08b8b819 100644
--- a/StoneIsland/www/js/lib/_router.js
+++ b/StoneIsland/www/js/lib/_router.js
@@ -53,8 +53,9 @@ var SiteRouter = Router.extend({
app.archive.show()
},
-
cart: function(){
+ app.view = app.cart
+ app.cart.show()
},
})
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 7e178a8a..0ce740a8 100644
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -2,19 +2,46 @@ var CollectionView = View.extend({
el: "#collection",
template: $("#collection .template").html(),
+ loaded: false,
+ data: null,
+ items: {},
events: {
},
initialize: function(){
this.$content = this.$(".content")
+ this.$loader = this.$(".loader")
},
show: function(){
document.body.className = "collection"
+ if (this.loaded) {
+ return this.populate(this.data)
+ }
+ this.fetch()
+ },
+
+ fetch: function(){
+ this.$loader.show()
+ sdk.fetch_collection({
+ gallery_id: 31617, // STONE ISLAND / SUPREME
+ success: this.populate.bind(this)
+ })
},
- populate: function(){
+ populate: function(data){
+ this.$loader.hide()
+ this.$content.empty()
+ // DefaultCode10
+ console.log(data)
+ data.SearchResponseFull.Results.Items.forEach(function(item){
+ this.items[ item['Code8'] ] = item
+ var t = this.template.replace(/{{image}}/, sdk.image(item['DefaultCode10']))
+ .replace(/{{code8}}/, item['Code8'])
+ this.$content.append(t)
+
+ }.bind(this))
},
-}) \ No newline at end of file
+})
diff --git a/StoneIsland/www/js/lib/products/Selector.js b/StoneIsland/www/js/lib/products/Selector.js
index 3d3d5ccc..c81aa121 100644
--- a/StoneIsland/www/js/lib/products/Selector.js
+++ b/StoneIsland/www/js/lib/products/Selector.js
@@ -3,6 +3,8 @@ var Selector = View.extend({
el: "#selector",
events: {
+ "click .close": "hide",
+ "click span": "pick",
},
initialize: function(){
@@ -10,5 +12,13 @@ var Selector = View.extend({
select: function(options, callback){
},
+
+ hide: function(){
+ },
+
+ pick: function(e){
+ var el = $(e.currentTarget)
+
+ },
}) \ No newline at end of file