diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-10 17:15:14 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-10 17:15:14 +0200 |
| commit | 2fb2e09bb24340a7cc33ae30037f45125791131c (patch) | |
| tree | 45afccf7b9455ab48f7725a24bae5c28ad02ca9e /StoneIsland/platforms/android/assets/www/js/lib/nav/HeaderView.js | |
| parent | 6196541cf993d5a1a4b8b7f511bf7daf8f849608 (diff) | |
androidz
Diffstat (limited to 'StoneIsland/platforms/android/assets/www/js/lib/nav/HeaderView.js')
| -rwxr-xr-x | StoneIsland/platforms/android/assets/www/js/lib/nav/HeaderView.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/nav/HeaderView.js b/StoneIsland/platforms/android/assets/www/js/lib/nav/HeaderView.js new file mode 100755 index 00000000..0961a5e8 --- /dev/null +++ b/StoneIsland/platforms/android/assets/www/js/lib/nav/HeaderView.js @@ -0,0 +1,57 @@ +var HeaderView = View.extend({ + + el: "#header", + + events: { + "click .burger": "nav", + "click .logo": "logo", + "click .cart_rapper": "cart", + }, + + initialize: function(){ + this.$burger = this.$(".burger") + this.$cart = this.$(".cart") + this.$cart_count = this.$(".cart_count") + }, + + back_state: false, + set_back: function(state){ + this.back_state = state + if (state) { + this.$burger[0].className = "burger ion-ios-arrow-left" + } + else { + this.$burger[0].className = "burger ion-android-menu" + } + }, + + nav: function(){ + if (this.back_state) { + app.view.back() + } + else { + app.nav.show() + } + }, + + logo: function(){ + app.router.go("intro") + }, + + cart: function(){ + app.router.go("cart") + }, + + count: 0, + set_cart_count: function(n){ + this.count = n + this.$cart_count.html(n || "0") + }, + increment_cart_count: function(){ + this.$cart_count.html( ++this.count ) + }, + decrement_cart_count: function(){ + this.$cart_count.html( --this.count ) + }, + +}) |
