diff options
Diffstat (limited to 'StoneIsland')
| -rw-r--r-- | StoneIsland/www/css/nav.css | 12 | ||||
| -rw-r--r-- | StoneIsland/www/index.html | 358 | ||||
| -rw-r--r-- | StoneIsland/www/js/index.js | 7 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/LoginView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/LogoutView.js | 7 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/PaymentView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/ProfileView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/SettingsView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/ShippingView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/SignupView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/nav/IntroView.js | 1 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/nav/NavView.js | 31 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/ProductView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/auth.js | 55 | ||||
| -rw-r--r-- | StoneIsland/www/js/vendor/view/formview.js | 146 | ||||
| -rw-r--r-- | StoneIsland/www/js/vendor/view/serializable.js | 6 |
16 files changed, 297 insertions, 340 deletions
diff --git a/StoneIsland/www/css/nav.css b/StoneIsland/www/css/nav.css index 0b6ebe85..bcbc3e69 100644 --- a/StoneIsland/www/css/nav.css +++ b/StoneIsland/www/css/nav.css @@ -28,7 +28,7 @@ .nav #content { -webkit-transform: translateZ(0) translateX(249px); } -.nav .logo { +#nav .logo { background-image: url(../img/wide-logo.png); background-repeat: no-repeat; background-position: center center; @@ -240,11 +240,17 @@ #signup, #shipping, #payment, #profile, #settings { position: absolute; top: 43px; - height: -webkit-calc(100% - 43px); - height: calc(100% - 43px); + height: -webkit-calc(100% - 43px - 39px); + height: calc(100% - 43px - 39px); width: 100%; overflow: hidden; } +#story, #hub, #archive, .page { + /* these things do not have a footer */ + height: -webkit-calc(100% - 43px); + height: calc(100% - 43px); +} + h1 { text-align: center; margin: 0; diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 6b0b1770..886a3b70 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -55,11 +55,21 @@ <span class="care">CUSTOMER CARE</span> </div> </span> - + <span class="submenu"> - <span class="login">ACCOUNT / LOGIN</span> - <span class="faq">FAQ</span> - <span class="search">SEARCH</span> + <div class="main_menu"> + <span class="account">ACCOUNT</span> + <span class="login">LOGIN</span> + <span class="faq">FAQ</span> + </div> + <div class="account_menu"> + <span class="logout">LOGOUT</span> + <span class="faq">FAQ</span> + </div> + <div class="faq_menu"> + <span class="login">LOGIN</span> + <span class="logout">LOGOUT</span> + </div> </span> <span class="social"> @@ -224,144 +234,165 @@ <!-- ACCOUNT ================================================ --> <div id="login"> - <h1>LOGIN</h1> - <form> - <input type="email" name="Email" placeholder="EMAIL ADDRESS" required> - <input type="password" name="Password" placeholder="PASSWORD" required> + <div class="scroll"> + <h1>LOGIN</h1> + <form> + <input type="email" name="Email" placeholder="EMAIL ADDRESS" required> + <input type="password" name="Password" placeholder="PASSWORD" required> - <span class="newuser">New User?</span> + <span class="newuser">New User?</span> - <span class="msg"></span> - </form> + <span class="msg"></span> + </form> + </div> + </div> + + <div id="logout"> + <div class="scroll"> + <h1>LOGOUT</h1> + <span class="msg"> + You are now logged out. + </span> + </div> </div> <div id="signup"> - <h1>NEW USER</h1> - <form> - <input type="text" name="Name" placeholder="FIRST NAME" required> - <input type="text" name="Surname" placeholder="LAST NAME" required> - <input type="email" name="Email" placeholder="EMAIL ADDRESS" required> - <select name="Gender"> - <option value="M">Male</option> - <option value="F">Female</option> - </select> - <h2>PASSWORD</h2> - <input type="password" name="Password" placeholder="PASSWORD (7 CHARACTERS OR MORE)" required> - <input type="password" name="Password2" placeholder="CONFIRM PASSWORD" required> - <input type="checkbox" name="DataProfiling" value="true" required> I agree to share my personal information with Stone Island. - <span class="msg"></span> - </form> + <div class="scroll"> + <h1>NEW USER</h1> + <form> + <input type="text" name="Name" placeholder="FIRST NAME" required> + <input type="text" name="Surname" placeholder="LAST NAME" required> + <input type="email" name="Email" placeholder="EMAIL ADDRESS" required> + <select name="Gender"> + <option value="M">Male</option> + <option value="F">Female</option> + </select> + <h2>PASSWORD</h2> + <input type="password" name="Password" placeholder="PASSWORD (7 CHARACTERS OR MORE)" required> + <input type="password" name="Password2" placeholder="CONFIRM PASSWORD" required> + <input type="checkbox" name="DataProfiling" value="true" required> I agree to share my personal information with Stone Island. + <span class="msg"></span> + </form> + </div> </div> <div id="profile"> - <h1>PROFILE</h1> - <form> - <div class="container"> - <div class="container-row"> - <input type="text" name="Name" placeholder="FIRST NAME" required> - <input type="text" name="Surname" placeholder="LAST NAME" required> - <input type="email" name="Email" placeholder="EMAIL ADDRESS" required> - <div class="half-input"> - <input type="text" name="Zip" placeholder="ZIP" required> - <div id="country-wrapper"> - <div id="country-select"> - <input type="text" name="Country" placeholder="UNITED STATES" required> + <div class="scroll"> + <h1>PROFILE</h1> + <form> + <div class="container"> + <div class="container-row"> + <input type="text" name="Name" placeholder="FIRST NAME" required> + <input type="text" name="Surname" placeholder="LAST NAME" required> + <input type="email" name="Email" placeholder="EMAIL ADDRESS" required> + <div class="half-input"> + <input type="text" name="Zip" placeholder="ZIP" required> + <div id="country-wrapper"> + <div id="country-select"> + <input type="text" name="Country" placeholder="UNITED STATES" required> + </div> + </div> </div> + <h2>CHANGE PASSWORD</h2> + <input type="password" name="CurrentPassword" placeholder="CURRENT PASSWORD" required> + <input type="password" name="NewPassword" placeholder="NEW PASSWORD (7 CHARACTERS OR MORE)" required> + <div class="toggle-container"> + <div class="caption"> + <h3>Newsletter</h3> + Receive Stone Island Newsletter + </div> + <div class="toggle"> + <input type="checkbox" id="receive-newsletter" name="switch" class="switch"> + <label for="receive-newsletter"></label> + </div> </div> </div> - <h2>CHANGE PASSWORD</h2> - <input type="password" name="CurrentPassword" placeholder="CURRENT PASSWORD" required> - <input type="password" name="NewPassword" placeholder="NEW PASSWORD (7 CHARACTERS OR MORE)" required> - <div class="toggle-container"> - <div class="caption"> - <h3>Newsletter</h3> - Receive Stone Island Newsletter + <div class="container-fill"> + <div class="container-message"> + <!-- addClass ".alert-notice" to make the + error message text red in the span below --> + <span class="msg"> + * Your personal and payment<br> + information will always remain private + </span> </div> - <div class="toggle"> - <input type="checkbox" id="receive-newsletter" name="switch" class="switch"> - <label for="receive-newsletter"></label> - </div> - </div> - </div> - <div class="container-fill"> - <div class="container-message"> - <!-- addClass ".alert-notice" to make the - error message text red in the span below --> - <span class="msg"> - * Your personal and payment<br> - information will always remain private - </span> </div> </div> - </div> - </form> + </form> + </div> </div> <div id="shipping"> - <h1>SHIPPING</h1> - <form> - <div class="container"> - <div class="container-row"> - <div class="address"></div> - </div> - <div class="container-fill"> - <div class="container-message"> - <span class="msg"> - * Your personal and payment<br> - information will always remain private - </span> + <div class="scroll"> + <h1>SHIPPING</h1> + <form> + <div class="container"> + <div class="container-row"> + <div class="address"></div> + </div> + <div class="container-fill"> + <div class="container-message"> + <span class="msg"> + * Your personal and payment<br> + information will always remain private + </span> + </div> </div> </div> - </div> - </form> + </form> + </div> </div> <div id="payment"> - <h1>PAYMENT</h1> - <form> - <div class="container"> - <div class="container-row"> - <div class="cc"></div> - <div class="address"></div> - </div> - <div class="container-fill"> - <div class="container-message"> - <span class="msg"> - * Your personal and payment<br> - information will always remain private - </span> + <div class="scroll"> + <h1>PAYMENT</h1> + <form> + <div class="container"> + <div class="container-row"> + <div class="cc"></div> + <div class="address"></div> + </div> + <div class="container-fill"> + <div class="container-message"> + <span class="msg"> + * Your personal and payment<br> + information will always remain private + </span> + </div> </div> </div> - </div> - </form> + </form> + </div> </div> <div id="settings"> <div class="scroll"> <h1>NOTIFICATIONS</h1> - <div class="toggle-container"> - <div class="toggle-row"> - <div class="caption"> - <h3>Store</h3> - Receive notifications for Store + <form> + <div class="toggle-container"> + <div class="toggle-row"> + <div class="caption"> + <h3>Store</h3> + Receive notifications for Store + </div> + <div class="toggle"> + <input type="checkbox" id="store-notifications" name="switch" class="switch"> + <label for="store-notifications"></label> + </div> </div> - <div class="toggle"> - <input type="checkbox" id="store-notifications" name="switch" class="switch"> - <label for="store-notifications"></label> - </div> - </div> - <div class="toggle-row"> - <div class="caption"> - <h3>Hub</h3> - Receive notifications for Hub + <div class="toggle-row"> + <div class="caption"> + <h3>Hub</h3> + Receive notifications for Hub + </div> + <div class="toggle"> + <input type="checkbox" id="hub-notifications" name="switch" class="switch"> + <label for="hub-notifications"></label> + </div> </div> - <div class="toggle"> - <input type="checkbox" id="hub-notifications" name="switch" class="switch"> - <label for="hub-notifications"></label> - </div> </div> - </div> + </form> </div> </div> @@ -378,70 +409,78 @@ </div> <div id="cart_summary"> - <div class="rows"> - <script type="text/html" class="template"> - <div> - <img src="{{image}}"> - <b>{{sku}}</b><br> - <span class="title">{{title}}</span> - <span class="type">{{type}}</span> - <span class="meta"> - <b>SIZE:</b> {{size}}<br> - <b>COLOR:</b> {{color}}<br> - <b>QUANTITY:</b> {{quantity}}<br> - </span> - <span class="price">{{price}}</span> - </div> - </script> - </div> - <div> - <span class="label">SUB TOTAL</span> - <span class="subtotal"></span> - </div> - <div> - <span class="label">ESTIMATED SHIPPING<br>& HANDLING</span> - <span class="shipping"></span> - </div> - <div> - <span class="label">TAX</span> - <span class="tax"></span> - </div> - <div> - <span class="label">TOTAL</span> - <span class="total"></span> + <div class="scroll"> + <div class="rows"> + <script type="text/html" class="template"> + <div> + <img src="{{image}}"> + <b>{{sku}}</b><br> + <span class="title">{{title}}</span> + <span class="type">{{type}}</span> + <span class="meta"> + <b>SIZE:</b> {{size}}<br> + <b>COLOR:</b> {{color}}<br> + <b>QUANTITY:</b> {{quantity}}<br> + </span> + <span class="price">{{price}}</span> + </div> + </script> + </div> + <div> + <span class="label">SUB TOTAL</span> + <span class="subtotal"></span> + </div> + <div> + <span class="label">ESTIMATED SHIPPING<br>& HANDLING</span> + <span class="shipping"></span> + </div> + <div> + <span class="label">TAX</span> + <span class="tax"></span> + </div> + <div> + <span class="label">TOTAL</span> + <span class="total"></span> + </div> </div> </div> <div id="cart_shipping"> - <div class="select_address"> - ADDRESS - </div> + <div class="scroll"> + <div class="select_address"> + ADDRESS + </div> - <h3>SHIPPING METHOD</h3> + <h3>SHIPPING METHOD</h3> - <div class="checkbox"> - <div class="box"></div> - <b>STANDARD $10</b> - (DELIVERY IN 5-8 WORKING DAYS) - </div> + <div class="checkbox"> + <div class="box"></div> + <b>STANDARD $10</b> + (DELIVERY IN 5-8 WORKING DAYS) + </div> - <div class="checkbox"> - <div class="box"></div> - <b>EXPRESS $20</b> - (DELIVERY IN 2-4 WORKING DAYS) + <div class="checkbox"> + <div class="box"></div> + <b>EXPRESS $20</b> + (DELIVERY IN 2-4 WORKING DAYS) + </div> </div> </div> <div id="cart_payment"> - <form> - <div class="cc"></div> - <div class="address"></div> - <span class="msg"></span> - </form> + <div class="scroll"> + <form> + <div class="cc"></div> + <div class="address"></div> + <span class="msg"></span> + </form> + </div> </div> <div id="cart_confirm"> - <h1>CONFIRM</h1> + <div class="scroll"> + <h1>CONFIRM</h1> + </div> </div> <div id="cart_thanks"> @@ -559,7 +598,6 @@ <script src="js/vendor/flickity.pkgd.js"></script> <script src="js/vendor/util.js"></script> <script src="js/vendor/view/view.js"></script> -<script src="js/vendor/view/formview.js"></script> <script src="js/vendor/view/router.js"></script> <script src="js/vendor/view/scrollable.js"></script> <script src="js/vendor/view/serializable.js"></script> diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 5a4efec8..4350e383 100644 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -63,7 +63,12 @@ var app = (function(){ if (window.cordova) { // cordova.plugins.Keyboard.disableScroll(true) } - + else { + auth.init() + app.launch() + } + } + app.launch = function(){ app.view = null app.router = new SiteRouter () app.router.route() diff --git a/StoneIsland/www/js/lib/account/LoginView.js b/StoneIsland/www/js/lib/account/LoginView.js index 30a4a735..329cf984 100644 --- a/StoneIsland/www/js/lib/account/LoginView.js +++ b/StoneIsland/www/js/lib/account/LoginView.js @@ -1,4 +1,4 @@ -var LoginView = SerializableView.extend({ +var LoginView = FormView.extend({ el: "#login", diff --git a/StoneIsland/www/js/lib/account/LogoutView.js b/StoneIsland/www/js/lib/account/LogoutView.js index 71e0bc31..62c925eb 100644 --- a/StoneIsland/www/js/lib/account/LogoutView.js +++ b/StoneIsland/www/js/lib/account/LogoutView.js @@ -9,12 +9,5 @@ var LogoutView = View.extend({ document.body.className = "logout" app.footer.hide() }, - - submit: function(e){ - e.preventDefault() - }, - - success: function(){ - }, })
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/account/PaymentView.js b/StoneIsland/www/js/lib/account/PaymentView.js index 103cbf8f..e8dd1dc2 100644 --- a/StoneIsland/www/js/lib/account/PaymentView.js +++ b/StoneIsland/www/js/lib/account/PaymentView.js @@ -1,4 +1,4 @@ -var PaymentView = View.extend({ +var PaymentView = FormView.extend({ el: "#payment", diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js index 892ccbec..342e831a 100644 --- a/StoneIsland/www/js/lib/account/ProfileView.js +++ b/StoneIsland/www/js/lib/account/ProfileView.js @@ -1,4 +1,4 @@ -var ProfileView = View.extend({ +var ProfileView = FormView.extend({ el: "#profile", diff --git a/StoneIsland/www/js/lib/account/SettingsView.js b/StoneIsland/www/js/lib/account/SettingsView.js index f6b2a992..37274b24 100644 --- a/StoneIsland/www/js/lib/account/SettingsView.js +++ b/StoneIsland/www/js/lib/account/SettingsView.js @@ -1,4 +1,4 @@ -var SettingsView = View.extend({ +var SettingsView = FormView.extend({ el: "#settings", diff --git a/StoneIsland/www/js/lib/account/ShippingView.js b/StoneIsland/www/js/lib/account/ShippingView.js index 37ba9df9..e7f44949 100644 --- a/StoneIsland/www/js/lib/account/ShippingView.js +++ b/StoneIsland/www/js/lib/account/ShippingView.js @@ -1,4 +1,4 @@ -var ShippingView = View.extend({ +var ShippingView = FormView.extend({ el: "#shipping", diff --git a/StoneIsland/www/js/lib/account/SignupView.js b/StoneIsland/www/js/lib/account/SignupView.js index 616fd9ea..62a8f498 100644 --- a/StoneIsland/www/js/lib/account/SignupView.js +++ b/StoneIsland/www/js/lib/account/SignupView.js @@ -1,4 +1,4 @@ -var SignupView = SerializableView.extend({ +var SignupView = FormView.extend({ el: "#signup", diff --git a/StoneIsland/www/js/lib/nav/IntroView.js b/StoneIsland/www/js/lib/nav/IntroView.js index 93602eb5..87e68959 100644 --- a/StoneIsland/www/js/lib/nav/IntroView.js +++ b/StoneIsland/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/www/js/lib/nav/NavView.js b/StoneIsland/www/js/lib/nav/NavView.js index a9129650..2145c163 100644 --- a/StoneIsland/www/js/lib/nav/NavView.js +++ b/StoneIsland/www/js/lib/nav/NavView.js @@ -3,6 +3,8 @@ var NavView = View.extend({ el: "#nav", events: { + "click .logo": "intro", + "click .store": "store", "click .hub": "hub", "click .story": "story", @@ -12,13 +14,13 @@ var NavView = View.extend({ "click .faq": "faq", "click .search": "search", - "click .account_back": "account_back", + "click .account_back": "back", "click .profile": "profile", "click .payment": "payment", "click .shipping": "shipping", "click .settings": "settings", - "click .faq_back": "faq_back", + "click .faq_back": "back", "click .privacy": "privacy", "click .returns": "returns", "click .terms": "terms", @@ -32,9 +34,14 @@ var NavView = View.extend({ initialize: function(){ }, - show: function(){ + show: function(klass){ $("body").addClass("nav") app.curtain.show() + if (klass) { + setTimeout(function(){ + this.addClass(klass) + }.bind(this), 500) + } }, hide: function(){ @@ -42,6 +49,10 @@ var NavView = View.extend({ app.curtain.hide() }, + intro: function(){ + this.hide() + app.router.go("intro") + }, store: function(){ this.hide() app.router.go("store") @@ -60,16 +71,17 @@ var NavView = View.extend({ }, login: function(){ - if (true || auth.logged_in()) { - this.$el.addClass("account") + if (auth.logged_in()) { + this.el.className = "account" } else { this.hide() app.router.go("account/login") } }, - account_back: function(){ - this.$el.removeClass("account") + + back: function(){ + this.el.className = "" }, profile: function(){ @@ -90,10 +102,7 @@ var NavView = View.extend({ }, faq: function(){ - this.$el.addClass("faq") - }, - faq_back: function(){ - this.$el.removeClass("faq") + this.el.className = "faq" }, privacy: function(){ this.hide() diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index df604d5b..75f62ac6 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -116,6 +116,8 @@ var ProductView = ScrollableView.extend({ else { this.$color.hide() } + + this.deferScrollToTop() }, find_sizes_for_color: function(color_id){ diff --git a/StoneIsland/www/js/sdk/auth.js b/StoneIsland/www/js/sdk/auth.js index 134107c2..95a1dc56 100644 --- a/StoneIsland/www/js/sdk/auth.js +++ b/StoneIsland/www/js/sdk/auth.js @@ -20,21 +20,66 @@ var auth = sdk.auth = (function(){ // ios: integrate keychain api // android: cordova.file.externalRootDirectory api - auth.set_user = function(user_id, access_token){ - // persist user data - auth.user_id = user_id + auth.init = function(fn){ + auth.get_user(function(){ + if (auth.logged_in()) { + auth.get_cart() + auth.view_logged_in() + } + else { + auth.view_logged_out() + } + fn && fn() + }) + } + + auth.set_user = function(user_id, access_token, cb){ auth.access_token = access_token + auth.user_id = user_id + + localStorage.setItem("yoox.access_token", access_token) + localStorage.setItem("yoox.user_id", user_id) + cb && cb() } auth.get_user = function(cb){ - // fetch user data + access_token = localStorage.getItem("yoox.access_token") || "" + user_id = localStorage.getItem("yoox.user_id") || -1 + cb && cb() + } + + auth.set_cart = function(cart_id, cart_token, cb){ + localStorage.setItem("yoox.cart_token", cart_token) + localStorage.setItem("yoox.cart_id", cart_id) + cb && cb() + } + auth.get_cart = function(cb){ + cart.token = localStorage.getItem("yoox.cart_token") || "" + cart.id = localStorage.getItem("yoox.cart_id") || -1 + cb && cb() } + + auth.view_logged_in = function(){ + $("#nav .login").hide() + $("#nav .account").show() + } + auth.view_logged_out = function(){ + $("#nav .login").show() + $("#nav .account").hide() + } + auth.log_out = function(){ - auth.user_id = -1 auth.access_token = "" + auth.user_id = -1 + cart.token = "" + cart.id = -1 + auth.view_logged_out() } auth.logged_in = function(){ return (auth.user_id !== -1) } + auth.has_cart = function(){ + return (cart.id !== -1) + } return auth })()
\ No newline at end of file diff --git a/StoneIsland/www/js/vendor/view/formview.js b/StoneIsland/www/js/vendor/view/formview.js deleted file mode 100644 index 8cd222e3..00000000 --- a/StoneIsland/www/js/vendor/view/formview.js +++ /dev/null @@ -1,146 +0,0 @@ -var FormView = View.extend({ - - method: "post", - useMinotaur: false, - - events: { - "submit form": "save" - }, - - initialize: function(opt){ - if (opt && opt.parent) { - this.parent = opt.parent - } - this.$form = this.$("form") - this.$errors = this.$(".errors") - this.$errorList = this.$(".errorList") - }, - - reset: function(){ - this.$("input,textarea").not("[type='submit']").not("[type='hidden']").val("") - }, - - showErrors: function(errors){ - if (errors && errors.length) { - this.$errorList.empty(); - for (var i in errors) { - this.$errorList.append('<div>' + errors[i] + '</div>'); - } - this.$errors.css("opacity", 1.0); - setTimeout(function(){ - this.$errors.show().css("opacity", 1.0); - }.bind(this), 200) - } - }, - - serialize: function(){ - var fd = new FormData(), hasCSRF = false - - this.$("input[name], select[name], textarea[name]").each( function(){ - if (this.type == "file") { - if (this.files.length > 0) { - fd.append(this.name, this.files[0]); - } - } -// else if (this.type == "password") { -// if (this.value.length > 0) { -// fd.append(this.name, SHA1.hex('bucky$' + this.value + '$bucky')) -// } -// } - else { - fd.append(this.name, this.value); - hasCSRF = hasCSRF || this.name == "_csrf" - } - }); - -// if (! hasCSRF) { -// fd.append("_csrf", $("[name=_csrf]").attr("value")) -// } -// - return fd - }, - - save: function(e, successCallback, errorCallback){ - e && e.preventDefault() - - this.$errors.hide().css("opacity", 0.0); - - if (this.validate) { - var errors = this.validate() - if (errors && errors.length) { - if (errorCallback) { - errorCallback(errors) - } - else { - this.showErrors(errors) - } - return - } - } - - var action = typeof this.action == "function" ? this.action() : this.action - if (! action) return - - var request = $.ajax({ - url: action, - type: this.method, - data: this.serialize(), -// headers: { "csrf-token": $("[name=_csrf]").attr("value") }, - dataType: "json", - processData: false, - contentType: false, - success: function(response){ - - if (response.error) { - var errors = [] - for (var key in response.error.errors) { - errors.push(response.error.errors[key].message); - } - if (errorCallback) { - errorCallback(errors) - } - else { - this.showErrors(errors) - } - return - } - else { - if (successCallback) { - successCallback(response) - } - if (this.success) { - this.success(response) - } - } - - - }.bind(this), - error: function(response){ - }.bind(this), - complete: function(response){ - if (this.useMinotaur) { - Minotaur.hide() - } - }.bind(this), - }) - - if (this.useMinotaur) { - Minotaur.show() - } - - }, - -}) - -/* - -var ModalFormView = ModalView.extend(FormView.prototype).extend({ - - load: function(){ - this.reset() - this.show() - } - -}) - -*/
\ No newline at end of file diff --git a/StoneIsland/www/js/vendor/view/serializable.js b/StoneIsland/www/js/vendor/view/serializable.js index ae742d75..5dfca06e 100644 --- a/StoneIsland/www/js/vendor/view/serializable.js +++ b/StoneIsland/www/js/vendor/view/serializable.js @@ -35,9 +35,11 @@ var SerializableView = View.extend({ msgs.push(e[1]) }.bind(this)) this.$msg.html(msgs.join("<br>")) + this.$msg.addClass('alert-notice') }, hide_errors: function(){ + this.$msg.removeClass('alert-notice') this.$msg.html("") }, @@ -76,4 +78,6 @@ var SerializableView = View.extend({ console.log("FAIL", data) }, -})
\ No newline at end of file +}) + +var FormView = View.extend(SerializableView).extend(ScrollableView) |
