summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/vendor/ModalFormView.js31
-rw-r--r--server/lib/auth.js4
-rw-r--r--server/lib/schemas/User.js1
-rw-r--r--server/lib/util.js2
-rwxr-xr-xviews/editor.ejs21
-rw-r--r--views/partials/footer.ejs2
6 files changed, 42 insertions, 19 deletions
diff --git a/public/assets/javascripts/vendor/ModalFormView.js b/public/assets/javascripts/vendor/ModalFormView.js
index 3cc2691..f99317b 100644
--- a/public/assets/javascripts/vendor/ModalFormView.js
+++ b/public/assets/javascripts/vendor/ModalFormView.js
@@ -35,26 +35,13 @@ var ModalFormView = ModalView.extend({
}
},
- submit: function(e){
- e.preventDefault()
-
- this.$errors.hide().css("opacity", 0.0);
-
- if (this.validate) {
- var errors = this.validate()
- if (errors && errors.length) {
- this.showErrors(errors)
- return
- }
- }
-
+ serialize: function(){
var fd = new FormData()
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]);
- console.log(this.name)
}
}
else if (this.type == "password") {
@@ -66,11 +53,25 @@ var ModalFormView = ModalView.extend({
fd.append(this.name, $(this).val());
}
});
+ },
+
+ submit: function(e){
+ e.preventDefault()
+
+ this.$errors.hide().css("opacity", 0.0);
+
+ if (this.validate) {
+ var errors = this.validate()
+ if (errors && errors.length) {
+ this.showErrors(errors)
+ return
+ }
+ }
var request = $.ajax({
url: this.action,
type: this.method,
- data: fd,
+ data: this.serialize(),
dataType: "json",
processData: false,
contentType: false,
diff --git a/server/lib/auth.js b/server/lib/auth.js
index 47c1c7c..b710a22 100644
--- a/server/lib/auth.js
+++ b/server/lib/auth.js
@@ -122,8 +122,8 @@ var auth = {
displayName: username,
password: password,
email: email,
- created_ip: util.ipToNum(req.connection.remoteAddress),
- last_ip: util.ipToNum(req.connection.remoteAddress),
+ created_ip: util.ip2num(req.connection.remoteAddress),
+ last_ip: util.ip2num(req.connection.remoteAddress),
created_at: new Date ()
}
new User(data).save(function(err, user){
diff --git a/server/lib/schemas/User.js b/server/lib/schemas/User.js
index 9aa2add..77e2e02 100644
--- a/server/lib/schemas/User.js
+++ b/server/lib/schemas/User.js
@@ -3,6 +3,7 @@
var mongoose = require('mongoose'),
uniqueValidator = require('mongoose-unique-validator'),
_ = require('lodash'),
+ util = require('../util'),
crypto = require('crypto'),
config = require('../../../config.json');
diff --git a/server/lib/util.js b/server/lib/util.js
index 228563a..c8771dc 100644
--- a/server/lib/util.js
+++ b/server/lib/util.js
@@ -1,7 +1,7 @@
var _ = require('lodash');
-var whitespace = new RegExp('\s', 'g')
+var whitespace = new RegExp('\\s', 'g')
var whitespaceHead = /^\s+/
var whitespaceTail = /\s+$/
var nonAlphanumerics = new RegExp('[^-_a-zA-Z0-9]', 'g')
diff --git a/views/editor.ejs b/views/editor.ejs
index 889200c..a4887a8 100755
--- a/views/editor.ejs
+++ b/views/editor.ejs
@@ -18,9 +18,30 @@
[[ include controls/editor/light-control ]]
[[ include controls/editor/settings ]]
+<!--
<div id="minimap" class="vvbox">
<span class="el"></span>
</div>
+ -->
+
+ <div id="hud">
+ <div id="map" style="display: block">
+ </div>
+
+ <div id="info">
+ <select id="palette">
+ <option>colors</option>
+ <option>redblue</option>
+ <option>gray</option>
+ <option selected>bone</option>
+ <option>alpha</option>
+ <option>white</option>
+ <option>black</option>
+ </select>
+ <div id="intersects"></div>
+ </div>
+ </div>
+
</div>
</body>
diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs
index 703dab4..685aec1 100644
--- a/views/partials/footer.ejs
+++ b/views/partials/footer.ejs
@@ -7,7 +7,7 @@
<span>©2014 VVALLS Inc.</span>
- [[ if (user) { ]]
+ [[ if (logged_in) { ]]
<br><br>
<span>