summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-19 21:35:37 -0500
committerJules Laplace <jules@okfoc.us>2015-11-19 21:35:37 -0500
commite458c052238c5f5bebd33affc7e5750671beeb23 (patch)
tree6c827251b71fe078071a44e2cd6fa0ad4c4ab223
parent6500cf422563eac86341a1fbc937e5554a66ee78 (diff)
back button
-rw-r--r--StoneIsland/www/js/lib/_router.js5
-rw-r--r--StoneIsland/www/js/lib/blogs/BlogView.js1
-rw-r--r--StoneIsland/www/js/lib/nav/HeaderView.js18
-rw-r--r--StoneIsland/www/js/lib/products/ClosedStoreView.js1
-rw-r--r--StoneIsland/www/js/lib/products/CollectionView.js7
-rw-r--r--StoneIsland/www/js/lib/products/ProductView.js12
6 files changed, 41 insertions, 3 deletions
diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js
index 712d3db2..bbc6bb5f 100644
--- a/StoneIsland/www/js/lib/_router.js
+++ b/StoneIsland/www/js/lib/_router.js
@@ -70,13 +70,18 @@ var SiteRouter = Router.extend({
else {
app.view = app[name]
}
+ app.header.set_back( !! app.view.back )
app.view.show()
}.bind(this)
return fn
},
product: function(code){
+ if (app.view && app.view.hide) {
+ app.view.hide()
+ }
app.view = app.product
+ app.header.set_back( true )
app.product.load(code)
app.product.show()
},
diff --git a/StoneIsland/www/js/lib/blogs/BlogView.js b/StoneIsland/www/js/lib/blogs/BlogView.js
index 4f888e8d..fb9c2157 100644
--- a/StoneIsland/www/js/lib/blogs/BlogView.js
+++ b/StoneIsland/www/js/lib/blogs/BlogView.js
@@ -31,6 +31,7 @@ var BlogView = View.extend({
data.page.forEach(function(page){
app[page.tag].populate(page)
})
+ app.collection.setCollectionName( data.store[0].collection )
if (data.store[0].StoreIsOpen !== "true") {
app.closed.populate(data.store[0].ClosedStoreImages)
}
diff --git a/StoneIsland/www/js/lib/nav/HeaderView.js b/StoneIsland/www/js/lib/nav/HeaderView.js
index bbf18274..4425917d 100644
--- a/StoneIsland/www/js/lib/nav/HeaderView.js
+++ b/StoneIsland/www/js/lib/nav/HeaderView.js
@@ -9,10 +9,26 @@ var HeaderView = View.extend({
},
initialize: function(){
+ this.$burger = this.$(".burger")
+ this.$cart = this.$(".cart")
+ },
+
+ set_back: function(state){
+ if (state) {
+ this.$burger[0].className = "burger ion-ios-arrow-left"
+ }
+ else {
+ this.$burger[0].className = "burger ion-android-menu"
+ }
},
nav: function(){
- app.nav.show()
+ if (app.view.back) {
+ app.view.back()
+ }
+ else {
+ app.nav.show()
+ }
},
logo: function(){
diff --git a/StoneIsland/www/js/lib/products/ClosedStoreView.js b/StoneIsland/www/js/lib/products/ClosedStoreView.js
index ec951a4c..3949f11f 100644
--- a/StoneIsland/www/js/lib/products/ClosedStoreView.js
+++ b/StoneIsland/www/js/lib/products/ClosedStoreView.js
@@ -37,7 +37,6 @@ var ClosedStoreView = View.extend({
},
populate: function(data){
- console.log("OPULATEP")
this.storeIsClosed = true
this.images = data.map(function(img){ return img.uri })
},
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 03ff5451..8ea03bd4 100644
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -17,6 +17,7 @@ var CollectionView = ScrollableView.extend({
},
initialize: function(){
+ this.$title = this.$("h1")
this.$content = this.$(".content")
this.$loader = this.$(".loader")
this.scroller = new IScroll('#collection', app.iscroll_options)
@@ -79,6 +80,12 @@ var CollectionView = ScrollableView.extend({
app.product.load(code, data)
},
+ collectionName: "STONE ISLAND",
+ setCollectionName: function(name){
+ this.collectionName = name
+ this.$title.html(this.collectionName)
+ },
+
firstTouch: { x: 0, y: 0, id: "" },
lastTouch: { x: 0, y: 0, id: "" },
touchstart: function(e){
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index 75f62ac6..e21c28f1 100644
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/www/js/lib/products/ProductView.js
@@ -23,7 +23,7 @@ var ProductView = ScrollableView.extend({
},
show: function(){
- app.footer.show("ADD TO CART", "&lt; BACK TO SHOPPING")
+ app.footer.show("ADD TO CART", "BUY NOW")
document.body.className = "product"
},
hide: function(){
@@ -43,6 +43,12 @@ var ProductView = ScrollableView.extend({
load: function(code, data){
this.gallery.reset()
this.show()
+ if (app.view && app.view.hide) {
+ app.view.hide()
+ }
+ app.view = this
+ app.header.set_back(true)
+
if (! app.collection.loaded) {
this.el.className = "loading"
app.collection.afterFetchCallback = this.load.bind(this, code, data)
@@ -189,6 +195,10 @@ var ProductView = ScrollableView.extend({
},
cancel: function(){
+ // buy now
+ },
+
+ back: function(){
app.router.go('store')
},