summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-17 22:19:52 -0400
committerJules Laplace <jules@okfoc.us>2015-09-17 22:19:52 -0400
commit4e62771a27bdb318ace378eff31a9c6eb67cfd8d (patch)
tree308342220d6499d68b12c96aef7b49e4e68beaa5 /StoneIsland/platforms/ios/www/js/lib
parent7d35fbd21d4f31132ae62a07c1863db5d0325cb2 (diff)
build
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib')
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/cart/CartView.js3
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js19
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js36
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js33
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/products/ProductView.js75
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/products/Selector.js22
6 files changed, 161 insertions, 27 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js
index f958f716..5d741492 100644
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js
@@ -6,6 +6,9 @@ var CartView = View.extend({
},
initialize: function(){
+ this.summary = new CartSummary ()
+ this.billing = new CartBilling ()
+ this.shipping = new CartShipping ()
},
show: function(){
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js b/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js
index 15c6425f..76126102 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js
@@ -3,9 +3,28 @@ var FooterView = View.extend({
el: "#footer",
events: {
+ "click .filter": "filter",
+ "click .buynow": "buynow",
+ "click .addtocart": "addtocart",
+ "click .cancel": "cancel",
+ "click .checkout": "checkout",
+ "click .checkout_proceed": "checkout_proceed",
},
initialize: function(){
},
+
+ filter: function(){
+ },
+ buynow: function(){
+ },
+ addtocart: function(){
+ },
+ cancel: function(){
+ },
+ checkout: function(){
+ },
+ checkout_proceed: function(){
+ },
}) \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js b/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js
index 0f30db3d..de534e32 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js
@@ -3,17 +3,53 @@ var LoginView = View.extend({
el: "#login",
events: {
+ "click .close": "hide",
+ "click .login_ask": "login",
+ "click .signup_ask": "signup",
+ "submit form": "submit",
},
+ mode: null,
+
initialize: function(){
+ this.$form = this.$("form")
+ this.$email = this.$("[name=email]")
+ this.$password = this.$("[name=password]")
},
show: function(){
+ this.$form.hide()
+ this.$email.val("")
+ this.$password.val("")
document.body.classList.add("login")
},
hide: function(){
document.body.classList.remove("login")
},
+
+ login: function(){
+ this.mode = "login"
+ this.$form.show()
+ },
+
+ signup: function(){
+ this.mode = "signup"
+ this.$form.show()
+ },
+
+ submit: function(e){
+ e.preventDefault()
+ if (this.mode == "login") {
+ // login api
+ }
+ else {
+ // signup api
+ }
+ },
+
+ success: function(){
+ // change login in ui to logout or whatever
+ },
}) \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
new file mode 100644
index 00000000..2eabe2a6
--- /dev/null
+++ b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js
@@ -0,0 +1,33 @@
+var GalleryView = View.extend({
+
+ el: "#gallery",
+
+ events: {
+ "click .left": "prev",
+ "click .right": "next",
+ "touchstart .gallery": "touchstart",
+ "touchmove .gallery": "touchmove",
+ "touchend .gallery": "touchend",
+ },
+
+ initialize: function(){
+ this.$prev = this.$(".prev")
+ this.$next = this.$(".next")
+ this.$slider = this.$(".slider")
+ },
+
+ populate: function(){
+ },
+
+ prev: function(){
+ },
+ next: function(){
+ },
+ touchstart: function(e){
+ },
+ touchmove: function(e){
+ },
+ touchend: function(e){
+ },
+
+}) \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
index a98f3ca4..e87fa398 100644
--- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js
@@ -13,17 +13,14 @@ 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",
+ "click .size": "select_size",
+ "click .color": "select_color",
+ "click .share": "share",
},
initialize: function(){
+ this.gallery = new GalleryView ()
+
this.$num = this.$(".num")
this.$title = this.$(".title")
this.$type = this.$(".type")
@@ -36,47 +33,75 @@ var ProductView = View.extend({
show: function(){
document.body.className = "product"
},
+ hide: function(){
+ },
+
+ item: null,
+ size: null,
+ color: null,
+ code: null,
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 size = data['Sizes'][0]
+ var size_label = SIZE_LOOKUP[size]
+ var color = data['Colors'][0]
+ var color_label = color['Text']
var body = ""
+ this.item = data
+ this.color = color
+ this.size = size
+ this.code = data['DefaultCode10']
+
this.$num.html(num)
this.$title.html(title)
this.$type.html(type)
this.$price.html(price)
- this.$size.html(size)
+ this.$size.html(size_label)
this.$color.html(color)
this.$body.html(body)
+
+ // TODO: fetch product from item API, get other Code10s so you can populate the gallery
},
select_size: function(){
+ if (this.item['Sizes'].length == 0) { return }
+ var mapped_sizes = this.item['Sizes'].map(function(size){
+ return {
+ id: size['Id'],
+ label: SIZE_LOOKUP[ size['Text'] ],
+ value: size,
+ }
+ })
+ app.selector.select(mapped_sizes, function(size){
+ this.size = size.value
+ this.$size.html(size.label)
+ }.bind(this))
},
+
select_color: function(){
+ if (this.item['Colors'].length == 0) { return }
+ var mapped_colors = this.item['Colors'].map(function(color){
+ return {
+ id: color['Id'],
+ label: color['Text'],
+ value: color,
+ }
+ })
+ app.selector.select(mapped_colors, function(color){
+ this.color = color.value
+ this.$color.html(color.label)
+ }.bind(this))
},
+
share: function(){
},
- prev: function(){
- },
- next: function(){
- },
- touchstart: function(e){
- },
- touchmove: function(e){
- },
- end: function(e){
- },
-
})
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/Selector.js b/StoneIsland/platforms/ios/www/js/lib/products/Selector.js
index c81aa121..1580624b 100644
--- a/StoneIsland/platforms/ios/www/js/lib/products/Selector.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/Selector.js
@@ -1,6 +1,7 @@
var Selector = View.extend({
el: "#selector",
+ template: $("#selector .template").html(),
events: {
"click .close": "hide",
@@ -8,17 +9,34 @@ var Selector = View.extend({
},
initialize: function(){
+ this.$options = this.$(".options")
},
+ lookup: null,
+ callback: null,
select: function(options, callback){
+ var lookup = this.lookup = {}
+ this.$options.empty()
+ options.forEach(function(opt){
+ lookup[opt.id] = opt
+ var t = this.template.replace(/{{id}}/, opt.id)
+ .replace(/{{label}}/, opt.label)
+ this.$options.append(t)
+ })
+ this.$el.show()
},
hide: function(){
+ this.lookup = this.callback = null
+ this.$el.hide()
},
pick: function(e){
- var el = $(e.currentTarget)
-
+ var $option = $(e.currentTarget)
+ var id = $option.data("id")
+ var selection = this.lookup[id]
+ this.callback( selection )
+ this.hide()
},
}) \ No newline at end of file