diff options
-rw-r--r-- | app.js | 12 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | routes/routes.js | 13 | ||||
-rw-r--r-- | views/about.html | 18 | ||||
-rw-r--r-- | views/base.html | 0 | ||||
-rw-r--r-- | views/contact.html | 11 | ||||
-rw-r--r-- | views/index.html | 33 |
7 files changed, 71 insertions, 18 deletions
@@ -4,7 +4,9 @@ var express = require('express'), fs = require('fs'), os = require('os'), shelljs = require('shelljs/global'), - PythonShell = require('python-shell') + PythonShell = require('python-shell'), + ejs = require('ejs') + var app = express(); @@ -12,11 +14,14 @@ var app = express(); var scriptPath = path.join(__dirname,'scripts') //Set views property app.set('views',path.join(__dirname,'views')); -//set Template engine -app.engine('html',require('hogan-express')); + //Set it as View engine app.set('view engine','html'); +//set Template engine +app.engine('html',ejs.renderFile); + + //Set Static public folder app.use(express.static(path.join(__dirname,'public'))); @@ -29,6 +34,7 @@ app.set('host',config.host); //Create server which listen app var server = require('http').createServer(app); + //Socket.io is invoked by passing server var io = require('socket.io')(server); diff --git a/package.json b/package.json index 1f23061..1b727ad 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "author": "Fahim Khan", "license": "ISC", "dependencies": { + "ejs": "^2.5.2", "express": "^4.13.4", - "hogan-express": "^0.5.2", "python-shell": "^0.4.0", "shelljs": "^0.7.0", "socket.io": "^1.4.5" diff --git a/routes/routes.js b/routes/routes.js index 04fb6cc..e20ae07 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -1,14 +1,25 @@ -module.exports = function(express,app,fs,os,io,PythonShell,scriptPath){ +module.exports = function(express,app,fs,os,io,PythonShell,scriptPath){ console.log("Server started!!! "); var router = express.Router(); var pyEnv = '/usr/bin/python' + /*Home Page*/ router.get('/',function(req,res,next){ res.render('index',{host:app.get('host'),title:'Ngspice Simulator'}); }); + /*About Page*/ + router.get('/about',function(req,res,next){ + res.render('about',{title:'Ngspice Simulator'}); + }); + + /*Contact Page*/ + router.get('/contact',function(req,res,next){ + res.render('contact',{title:'Ngspice Simulator'}); + }); + io.on('connection', function (socket) { socketID = getSocketID(socket); var plot_allv_file = '/tmp/plot_allv_'+socketID.toLowerCase()+'.txt' diff --git a/views/about.html b/views/about.html new file mode 100644 index 0000000..c43a799 --- /dev/null +++ b/views/about.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> + <title><%= title %></title> +</head> +<body> + <h1>About</h1> + <section> + <p> + FOSSEE (Free and Open Software in Education) project promotes the use of FOSS tools to improve the quality of education in our country. We aim to reduce dependency on proprietary software in educational institutions. We encourage the use of FOSS tools through various activities to ensure commercial software is replaced by equivalent FOSS tools. We also develop new FOSS tools and upgrade existing tools to meet requirements in academia and research. + </p> + <p> + The FOSSEE project is part of the National Mission on Education through Information and Communication Technology (ICT), Ministry of Human Resources and Development, Government of India. + </p> + </section> + +</body> +</html>
\ No newline at end of file diff --git a/views/base.html b/views/base.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/base.html diff --git a/views/contact.html b/views/contact.html new file mode 100644 index 0000000..946da42 --- /dev/null +++ b/views/contact.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<head> + <title><%= title %></title> +</head> +<body> + <h2>Welcome to contact Page</h2> + +</body> +</html> + diff --git a/views/index.html b/views/index.html index 3471303..64a05e9 100644 --- a/views/index.html +++ b/views/index.html @@ -2,7 +2,7 @@ <html lang="en">
<head>
<meta charset="UTF-8">
- <title>{{title}}</title>
+ <title><%= title %></title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../css/bootstrap.min-3.3.6.css">
@@ -27,17 +27,24 @@ <span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Online Simulator</a>
+
</div>
<div id="navbar" class="navbar-collapse collapse">
- <!--form class="navbar-form navbar-right">
- <div class="form-group">
- <input type="text" placeholder="Email" class="form-control">
- </div>
- <div class="form-group">
- <input type="password" placeholder="Password" class="form-control">
- </div>
- <button type="submit" class="btn btn-success">Sign in</button>
- </form-->
+ <ul class="nav navbar-nav">
+ <li class="active"><a href="#">Home</a></li>
+ <li><a href="/about">About</a></li>
+ <li><a href="/contact">Contact</a></li>
+ </ul>
+ <form class="navbar-form navbar-right">
+ <div class="form-group">
+ <input type="text" placeholder="Email" class="form-control">
+ </div>
+ <div class="form-group">
+ <input type="password" placeholder="Password" class="form-control">
+ </div>
+ <button type="submit" class="btn btn-success">Sign in</button>
+ <button type="submit" class="btn btn-success">Sign up</button>
+ </form
</div><!--/.navbar-collapse -->
</div>
</nav>
@@ -85,9 +92,9 @@ v(in) v(out) </div>
</form>
<div class="buttonArea">
- <button id="doSubmit" class="button">Submit</button>
- <button id="doSaveNetlist" class="button">Save Netlist</button>
- <button id="doClear" class="button">Clear Plots</button>
+ <button id="doSubmit" class="btn btn-success">Submit</button>
+ <button id="doSaveNetlist" class="btn btn-success">Save Netlist</button>
+ <button id="doClear" class="btn btn-danger">Clear Plots</button>
</div>
<hr>
|