summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/nav
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-24 20:57:41 -0500
committerJules Laplace <jules@okfoc.us>2015-11-24 20:57:41 -0500
commit612561818f907f0f9988247c82ec158ba4494986 (patch)
tree8bbc773dad7a6364cbdb8aed2ef4cab04854f49a /StoneIsland/platforms/ios/www/js/lib/nav
parentd548a7d02ce6349ca9a820b6824e4374b759812b (diff)
build
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/nav')
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js39
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js27
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js18
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js36
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/HeaderView.js31
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js1
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js57
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/NavView.js103
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/nav/SearchView.js16
9 files changed, 243 insertions, 85 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
new file mode 100644
index 00000000..15a5784d
--- /dev/null
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js
@@ -0,0 +1,39 @@
+
+var AddressView = SerializableView.extend({
+
+ template: $("#address_template").html(),
+
+ events: {
+ },
+
+ initialize: function(opt){
+ this.parent = opt.parent
+ this.$el = this.parent.$(".address")
+ this.el = this.$el[0]
+ this.$el.html(this.template)
+ },
+
+ populate: function(data){
+ this.parent.$(".address input").val("")
+ Object.keys(data).forEach(function(key){
+ this.parent$(".address [name=" + key + "]").val(data[key])
+ }.bind(this))
+ },
+
+ deserialize: function(){
+ },
+
+ validate_presence: {
+ "Name": "Please enter your first name.",
+ "Surname": "Please enter your last name.",
+ "Address1": "Please enter your street address.",
+ "City": "Please enter your city.",
+ "State": "Please choose your state.",
+ "Phone": "Please enter your phone number.",
+ },
+
+ validate_fields: function(data, errors){
+ if (data.Phone.replace(/[^0-9]/g, "").length < 10) { errors.push([ "Phone", "Phone numbers must be at least 10 digits." ]) }
+ },
+
+})
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js b/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
new file mode 100644
index 00000000..33ecab79
--- /dev/null
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/CreditCardView.js
@@ -0,0 +1,27 @@
+
+var CreditCardView = View.extend({
+
+ template: $("#creditcard_template").html(),
+
+ events: {
+ },
+
+ initialize: function(opt){
+ this.parent = opt.parent
+ this.parent.$(".cc").html(this.template)
+ },
+
+ populate: function(data){
+ this.parent.$(".cc input").val("")
+ Object.keys(data).forEach(function(key){
+ this.parent$(".cc [name=" + key + "]").val(data[key])
+ }.bind(this))
+ },
+
+ validate_presence: {
+ },
+
+ validate_fields: function(data, errors){
+ },
+
+})
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js b/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js
index ba10e232..d444fd60 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js
@@ -9,20 +9,30 @@ var CurtainView = View.extend({
initialize: function(){
},
- show: function(){
+ klass: null,
+ show: function(klass){
this.$el.addClass("visible")
+ if (klass) {
+ this.klass = klass
+ this.$el.addClass(klass)
+ }
},
- hide: function(){
+ hide: function(k){
this.$el.removeClass("visible")
+ if (this.klass) {
+ setTimeout( function(){
+ this.$el.removeClass(this.klass)
+ }.bind(this), 200 )
+ }
},
click: function(){
if (document.body.classList.contains("nav")) {
app.nav.hide()
}
- else if (document.body.classList.contains("login")) {
- app.login.hide()
+ if (app.selector.visible) {
+ app.selector.hide()
}
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js b/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js
index 76126102..74b249e6 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/FooterView.js
@@ -3,28 +3,38 @@ var FooterView = View.extend({
el: "#footer",
events: {
- "click .filter": "filter",
- "click .buynow": "buynow",
- "click .addtocart": "addtocart",
+ "click .ok": "ok",
"click .cancel": "cancel",
- "click .checkout": "checkout",
- "click .checkout_proceed": "checkout_proceed",
},
initialize: function(){
+ this.$ok = this.$(".ok")
+ this.$cancel = this.$(".cancel")
},
- filter: function(){
+ show: function(ok, cancel){
+ if (cancel) {
+ this.$ok.removeClass("wide")
+ this.$cancel.show().html(cancel)
+ }
+ else {
+ this.$ok.addClass("wide")
+ this.$cancel.hide()
+ }
+ this.$ok.html(ok)
+ this.$el.show()
},
- buynow: function(){
+
+ hide: function(){
+ this.$el.hide()
},
- addtocart: function(){
+
+ ok: function(){
+ (app.view.save || app.view.ok).bind(app.view)()
},
+
cancel: function(){
+ app.view.cancel ? app.view.cancel() : app.intro.show()
},
- checkout: function(){
- },
- checkout_proceed: function(){
- },
-
+
}) \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/HeaderView.js b/StoneIsland/platforms/ios/www/js/lib/nav/HeaderView.js
index bbf18274..7563be2d 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/HeaderView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/HeaderView.js
@@ -9,10 +9,27 @@ var HeaderView = View.extend({
},
initialize: function(){
+ this.$burger = this.$(".burger")
+ this.$cart = this.$(".cart")
+ this.$cart_count = this.$(".cart_count")
+ },
+
+ 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(){
@@ -22,5 +39,17 @@ var HeaderView = View.extend({
cart: function(){
app.router.go("cart")
},
+
+ count: 0,
+ set_cart_count: function(n){
+ this.count = n
+ this.$cart_count.html(n)
+ },
+ increment_cart_count: function(){
+ this.$cart_count.html( ++this.count )
+ },
+ decrement_cart_count: function(){
+ this.$cart_count.html( --this.count )
+ },
}) \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js b/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js
index 93602eb5..87e68959 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/IntroView.js
@@ -17,6 +17,7 @@ var IntroView = View.extend({
show: function(){
document.body.className = "intro"
window.addEventListener("deviceorientation", this.orient)
+ app.footer.hide()
this.orient({ alpha: 0 })
// get location..
},
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js b/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js
deleted file mode 100644
index 60f6263e..00000000
--- a/StoneIsland/platforms/ios/www/js/lib/nav/LoginView.js
+++ /dev/null
@@ -1,57 +0,0 @@
-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("")
- app.curtain.show()
- document.body.classList.add("login")
- },
-
- hide: function(){
- app.curtain.hide()
- 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/nav/NavView.js b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
index 3949c3c5..1445a0d5 100644
--- a/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/NavView.js
@@ -3,33 +3,61 @@ var NavView = View.extend({
el: "#nav",
events: {
+ "click .logo": "intro",
+
"click .store": "store",
"click .hub": "hub",
"click .story": "story",
"click .archive": "archive",
"click .login": "login",
+ "click .logout": "logout",
+ "click .account": "account",
"click .faq": "faq",
"click .search": "search",
+ "click .main": "back",
+ "click .account_back": "back",
+ "click .profile": "profile",
+ "click .payment": "payment",
+ "click .shipping": "shipping",
+ "click .settings": "settings",
+ "click .orders": "orders",
+ "click .return_link": "return_link",
+
+ "click .faq_back": "back",
+ "click .privacy": "privacy",
+ "click .returns": "returns",
+ "click .terms": "terms",
+ "click .care": "care",
+
"click .fb": "fb",
"click .insta": "insta",
"click .tw": "tw",
},
- initialize: function(){
- },
+ initialize: function(){
+ },
- show: function(){
+ show: function(klass){
$("body").addClass("nav")
- app.curtain.show()
+ app.curtain.show("dark")
+ if (klass) {
+ setTimeout(function(){
+ this.addClass(klass)
+ }.bind(this), 500)
+ }
},
hide: function(){
$("body").removeClass("nav")
- app.curtain.hide()
+ app.curtain.hide("dark")
},
+ intro: function(){
+ this.hide()
+ app.router.go("intro")
+ },
store: function(){
this.hide()
app.router.go("store")
@@ -49,18 +77,74 @@ var NavView = View.extend({
login: function(){
this.hide()
- app.router.go("login")
+ auth.last_view = app.view
+ app.router.go("account/login")
+ },
+ logout: function(){
+ this.hide()
+ auth.last_view = app.view
+ app.router.go("account/logout")
+ },
+ account: function(){
+ this.el.className = "account"
},
- search: function(){
+ back: function(){
+ this.el.className = ""
+ },
+
+ profile: function(){
this.hide()
- app.router.go("search")
+ app.router.go("account/profile")
+ },
+ payment: function(){
+ this.hide()
+ app.router.go("account/payment")
},
+ shipping: function(){
+ this.hide()
+ app.router.go("account/shipping")
+ },
+ orders: function(){
+ this.hide()
+ app.router.go("account/orders")
+ },
+ settings: function(){
+ this.hide()
+ app.router.go("account/settings")
+ },
+ return_link: function(){
+ window.open("http://www.stoneisland.com/", '_system')
+ },
+
+
faq: function(){
+ this.el.className = "faq"
+ },
+ privacy: function(){
this.hide()
- app.router.go("faq")
+ app.router.go("page/privacy")
+ },
+ returns: function(){
+ this.hide()
+ app.router.go("page/returns")
+ },
+ terms: function(){
+ this.hide()
+ app.router.go("page/terms")
+ },
+ care: function(){
+ this.hide()
+ app.router.go("page/care")
+ },
+
+
+ search: function(){
+ this.hide()
+ app.router.go("search")
},
+
fb: function(){
window.open("https://www.facebook.com/StoneIsland", '_system')
},
@@ -70,6 +154,5 @@ var NavView = View.extend({
tw: function(){
window.open("https://twitter.com/stoneisland", '_system')
},
-
})
diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/SearchView.js b/StoneIsland/platforms/ios/www/js/lib/nav/SearchView.js
new file mode 100644
index 00000000..f21634a5
--- /dev/null
+++ b/StoneIsland/platforms/ios/www/js/lib/nav/SearchView.js
@@ -0,0 +1,16 @@
+var SearchView = View.extend({
+
+ el: "#search",
+
+ events: {
+ },
+
+ show: function(){
+ app.footer.show("SEARCH", "CANCEL")
+ document.body.className = "search"
+ },
+
+ save: function(){
+ },
+
+}) \ No newline at end of file