summaryrefslogtreecommitdiff
path: root/StoneIsland/www
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-22 22:25:34 -0500
committerJules Laplace <jules@okfoc.us>2015-11-22 22:25:34 -0500
commitafde9fd65fd6221b47504cc2c32d7f80c8654aa4 (patch)
treea462ee46b093961d49381f7fae478c7afe876660 /StoneIsland/www
parentfa9d1c62c8cc4b39caee69b1ba31401f0d4aac66 (diff)
ability to preload data
Diffstat (limited to 'StoneIsland/www')
-rw-r--r--StoneIsland/www/js/lib/auth/LoginView.js6
-rw-r--r--StoneIsland/www/js/lib/auth/SignupView.js16
-rw-r--r--StoneIsland/www/js/vendor/view/serializable.js22
3 files changed, 43 insertions, 1 deletions
diff --git a/StoneIsland/www/js/lib/auth/LoginView.js b/StoneIsland/www/js/lib/auth/LoginView.js
index 701a6a36..b088190f 100644
--- a/StoneIsland/www/js/lib/auth/LoginView.js
+++ b/StoneIsland/www/js/lib/auth/LoginView.js
@@ -16,9 +16,13 @@ var LoginView = FormView.extend({
},
show: function(){
+ var msg = "* Your personal and payment<br>information will always remain private"
+ if (auth.logged_in()) {
+ msg += "<br><br>You are already logged in."
+ }
app.footer.show("SUBMIT", "CANCEL")
this.$form.get(0).reset()
- this.$msg.html("* Your personal and payment<br />information will always remain private")
+ this.$msg.html(msg)
document.body.className = "login"
},
diff --git a/StoneIsland/www/js/lib/auth/SignupView.js b/StoneIsland/www/js/lib/auth/SignupView.js
index 0fccc06d..3293b3aa 100644
--- a/StoneIsland/www/js/lib/auth/SignupView.js
+++ b/StoneIsland/www/js/lib/auth/SignupView.js
@@ -5,6 +5,18 @@ var SignupView = FormView.extend({
action: sdk.account.signup,
last_data: null,
+ test_data: {
+ "Email": "testit.account" + Math.floor(Math.random() * 10000000) + "@yoox.com",
+ "Password": "TestPassword",
+ "Password2": "TestPassword",
+ "Gender": "U",
+ "Name": "TestName",
+ "Surname": "TestSurname",
+ "Birthday": "1978-11-12",
+ "DataProfiling": true,
+ "DataProfiling2": true,
+ },
+
events: {
"click .privacy-msg": "privacy_link",
"submit form": "save",
@@ -25,6 +37,8 @@ var SignupView = FormView.extend({
this.$form.get(0).reset()
this.$msg.html(msg)
document.body.className = "signup"
+
+ this.preload()
},
validate_presence: {
@@ -49,6 +63,8 @@ var SignupView = FormView.extend({
delete data.DataProfiling2
delete data.ConfirmEmail
+ data.Birthday += "T00:00:00Z"
+
this.last_data = data
console.log(data)
},
diff --git a/StoneIsland/www/js/vendor/view/serializable.js b/StoneIsland/www/js/vendor/view/serializable.js
index 83c7cdc3..a2ff1147 100644
--- a/StoneIsland/www/js/vendor/view/serializable.js
+++ b/StoneIsland/www/js/vendor/view/serializable.js
@@ -4,6 +4,28 @@ var SerializableView = View.extend({
"change select": "update_select",
"focus input": "focus_input",
},
+
+ preload: function(){
+ if (sdk.env == "production") { return }
+
+ this.test_data['ConfirmEmail'] = this.test_data['Email']
+ Object.keys(this.test_data).forEach(function(key){
+
+ var value = this.test_data[key]
+ var $el = this.$("[name=" + key + "]")
+
+ if ($el.attr("type") == "checkbox") {
+ $el.prop("checked", value)
+ }
+ else if ($el.prop("tagName") == "SELECT") {
+ $el.val( value )
+ this.update_select({ currentTarget: $el })
+ }
+ else {
+ $el.val( value )
+ }
+ }.bind(this))
+ },
serialize: function(){
var fields = {}