Node.js based forum software built for the modern web
compiling JS as well now
psychobunny1f2bd9390d6d
diff --git a/install/web.js b/install/web.jsindex 351f512868..c462c24e6a 100644--- a/install/web.js+++ b/install/web.js@@ -5,15 +5,26 @@ var winston = require('winston'),fs = require('fs'),path = require('path'),less = require('less'),+ async = require('async'),+ uglify = require('uglify-js'),app = express();-var web = {};+var web = {},+ scripts = [+ 'public/vendor/jquery/js/jquery.js',+ 'public/vendor/bootstrap/js/bootstrap.min.js',+ 'public/vendor/bootbox/bootbox.min.js',+ 'public/vendor/xregexp/xregexp.js',+ 'public/vendor/xregexp/unicode/unicode-base.js',+ 'public/src/utils.js',+ 'public/src/installer/install.js'+ ];web.install = function(port) {port = port || 8080;winston.info('Launching web installer on port ', port);- compileLess(function() {+ async.parallel([compileLess, compileJS], function() {setupRoutes();launchExpress(port);});@@ -52,4 +63,14 @@ function compileLess(callback) {});}+function compileJS(callback) {+ var scriptPath = path.join(__dirname, '..'),+ result = uglify.minify(scripts.map(function(script) {+ return path.join(scriptPath, script);+ }));+++ fs.writeFile(path.join(__dirname, '../public/nodebb.min.js'), result.code, callback);+}+module.exports = web;\ No newline at end of filediff --git a/public/src/installer/install.js b/public/src/installer/install.jsindex 48464808ff..fe86a5642e 100644--- a/public/src/installer/install.js+++ b/public/src/installer/install.js@@ -1,4 +1,5 @@"use strict";+/*global utils*/$('document').ready(function() {setupInputs();@@ -10,5 +11,20 @@ $('document').ready(function() {$('.input-row.active').removeClass('active');$(this).parents('.input-row').addClass('active');});++ $('[name="username"]').on('blur', validateUsername);+ }+++ function validateUsername() {+ var $this = $(this),+ username = $this.val(),+ help = $this.parents('.input-row').children('.help-text');++ if (!utils.isUserNameValid(username) || !utils.slugify(username)) {+ help.html('Invalid Username.');+ } else {+ help.html('');+ }}});\ No newline at end of filediff --git a/src/views/install/index.tpl b/src/views/install/index.tplindex 29b45dd0de..8d10af37d7 100644--- a/src/views/install/index.tpl+++ b/src/views/install/index.tpl@@ -54,13 +54,13 @@<input type="text" class="form-control" name="username" placeholder="Username" /></div><div class="col-sm-4 help-text">- Here is some sample help text. Username should be between <strong>6</strong> and <strong>12</strong> characters long.+</div></div><div class="row input-row"><div class="col-sm-8 col-xs-12 input-field">- <label for="username">Username</label>- <input type="text" class="form-control" name="username" placeholder="Username" />+ <label for="password">Password</label>+ <input type="password" class="form-control" name="password" placeholder="Username" /></div><div class="col-sm-4 help-text">Here is some sample help text. Username should be between <strong>6</strong> and <strong>12</strong> characters long.@@ -71,6 +71,6 @@<script src="//code.jquery.com/jquery-1.11.2.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>- <script type="text/javascript" src="src/installer/install.js"></script>+ <script type="text/javascript" src="nodebb.min.js"></script></body></html>\ No newline at end of file