summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js')
-rwxr-xr-xStoneIsland/www/js/index.js2
-rwxr-xr-xStoneIsland/www/js/lib/blogs/BlogView.js8
-rwxr-xr-xStoneIsland/www/js/lib/products/CollectionView.js9
-rwxr-xr-xStoneIsland/www/js/lib/products/Selector.js2
-rw-r--r--StoneIsland/www/js/lib/products/filters/DepartmentFilter.js31
5 files changed, 44 insertions, 8 deletions
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 6bea75d0..76a8af05 100755
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -8,7 +8,7 @@ var app = (function(){
app.bind()
app.build()
-
+
app.iscroll_options = {
mouseWheel: true,
scrollbars: true,
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index b7c80520..5ee7f641 100755
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -31,7 +31,7 @@ var BlogView = View.extend({
this.loaded = true
this.data = data = typeof data == "string" ? JSON.parse(data) : data
- switch (data.store[0].StoreStatus) {
+ switch (data.store[0].DepartmentStoreStatus) {
case "open":
app.closed.storeIsClosed = false
break
@@ -46,9 +46,9 @@ var BlogView = View.extend({
app.closed.populate(data.store[0].ClosedStoreImages)
}
else {
- app.gallery_id = data.store[0].CollectionId
- app.department_id = data.store[0].DepartmentId
- app.collection.setCollectionName( data.store[0].collection )
+ app.departments = data.store[0].Departments
+ app.department_id = data.store[0].Departments[0].uri
+ app.collection.setCollectionName( data.store[0].Departments[0].text )
app.collection.loaded = false
app.collection.fetch()
}
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index b9a7755f..671d36b3 100755
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -14,6 +14,7 @@ var CollectionView = ScrollableView.extend({
"mousedown .item": "touchstart",
"mousemove .item": "touchmove",
"mouseup .item": "touchend",
+ "touchstart h1": "showDepartmentSelector",
},
initialize: function(){
@@ -21,7 +22,7 @@ var CollectionView = ScrollableView.extend({
this.$content = this.$(".content")
this.$loader = this.$(".loader")
this.scroller = new IScroll('#collection', app.iscroll_options)
- this.filterView = new CategoryFilter ({ parent: this })
+ this.filterView = new DepartmentFilter ({ parent: this })
},
show: function(){
@@ -85,7 +86,7 @@ var CollectionView = ScrollableView.extend({
}
console.log(">>>>>>>> YES ")
if (! this.loaded) {
- console.log("populate 3")
+ console.log("populate 3", data.SearchResponseFull.Results.Items.length)
this.loaded = true
this.$loader.hide()
this.$content.empty()
@@ -140,6 +141,10 @@ var CollectionView = ScrollableView.extend({
this.$title.html(this.collectionName)
},
+ showDepartmentSelector: function(){
+ this.filterView.filter()
+ },
+
firstTouch: { x: 0, y: 0, id: "" },
lastTouch: { x: 0, y: 0, id: "" },
touchstart: function(e){
diff --git a/StoneIsland/www/js/lib/products/Selector.js b/StoneIsland/www/js/lib/products/Selector.js
index 6db33b68..89130021 100755
--- a/StoneIsland/www/js/lib/products/Selector.js
+++ b/StoneIsland/www/js/lib/products/Selector.js
@@ -5,7 +5,7 @@ var Selector = View.extend({
events: {
"click .close": "hide",
- "click .options div": "pick",
+ "touchstart .options div": "pick",
},
initialize: function(){
diff --git a/StoneIsland/www/js/lib/products/filters/DepartmentFilter.js b/StoneIsland/www/js/lib/products/filters/DepartmentFilter.js
new file mode 100644
index 00000000..cc0d925e
--- /dev/null
+++ b/StoneIsland/www/js/lib/products/filters/DepartmentFilter.js
@@ -0,0 +1,31 @@
+var DepartmentFilter = View.extend({
+
+ initialize: function(opt){
+ this.parent = opt.parent
+ },
+
+ filter: function(){
+ var deps = app.departments.map(function(dep){
+ console.log(dep)
+ return {
+ id: dep.uri,
+ label: dep.text,
+ }
+ })
+ app.selector.select("wide", deps, this.pick.bind(this))
+ },
+
+ last_choice: null,
+
+ pick: function(choice){
+ this.parent.$content.empty()
+ this.last_choice = choice
+ app.department_id = choice.id
+ app.collection.loaded = false
+ app.collection.fetch()
+ app.footer.hide()
+ app.collection.setCollectionName(choice.label)
+ this.parent.deferScrollToTop()
+ },
+
+})