Commit a8a51f69 authored by Leo Iannacone's avatar Leo Iannacone

made routes configurable

parent 28541eec
...@@ -21,8 +21,8 @@ app.configure(function(){ ...@@ -21,8 +21,8 @@ app.configure(function(){
app.use(express.methodOverride()); app.use(express.methodOverride());
app.use(app.router); app.use(app.router);
app.use(express.static(__dirname + '/public')); app.use(express.static(__dirname + '/public'));
app.use(config.debomatic.webpath, express.directory(config.debomatic.path)); app.use(config.routes.debomatic, express.directory(config.debomatic.path));
app.use(config.debomatic.webpath, express.static(config.debomatic.path)); app.use(config.routes.debomatic, express.static(config.debomatic.path));
}); });
app.configure('development', function(){ app.configure('development', function(){
...@@ -37,7 +37,7 @@ var io = require('socket.io').listen(app); ...@@ -37,7 +37,7 @@ var io = require('socket.io').listen(app);
// Routes // Routes
app.get('/', routes.index); app.get('/', routes.index);
app.get('/distribution', routes.distribution) app.get(config.routes.distribution, routes.distribution)
io.sockets.on('connection', function(socket) { io.sockets.on('connection', function(socket) {
send.distributions(socket); send.distributions(socket);
......
...@@ -5,12 +5,16 @@ config.port = 3000 ...@@ -5,12 +5,16 @@ config.port = 3000
config.debomatic = {} config.debomatic = {}
config.debomatic.path = '/srv/debomatic-amd64' config.debomatic.path = '/srv/debomatic-amd64'
config.debomatic.webpath = '/debomatic'
config.routes = {}
config.routes.debomatic = '/debomatic'
config.routes.distribution = '/distribution'
config.web = {} config.web = {}
config.web.title = "deb-o-matic web.ui" config.web.title = "deb-o-matic web.ui"
config.web.description = "This is a web interface for debomatic" config.web.description = "This is a web interface for debomatic"
config.web.footer = "Fork me on github.com" config.web.footer = "Fork me on github.com"
config.web.autoscroll = true config.web.autoscroll = true
config.web.paths = config.routes
module.exports = config module.exports = config
...@@ -4,11 +4,11 @@ var socket = io.connect('//localhost:3000'); ...@@ -4,11 +4,11 @@ var socket = io.connect('//localhost:3000');
socket.on('distributions', function(distributions) { socket.on('distributions', function(distributions) {
$('#distributions ul').html(''); $('#distributions ul').html('');
distributions.forEach(function (name){ distributions.forEach(function (name){
$('#distributions ul').append('<li id="distribution-' + name +'"><a href="/distribution#' + name + '">' + name + '</li>'); $('#distributions ul').append('<li id="distribution-' + name +'"><a href="'+ DISTRIBUTION_PAGE + '#'+ name + '">' + name + '</li>');
}); });
}); });
if (window.location.pathname == '/distribution') { if (window.location.pathname == DISTRIBUTION_PAGE) {
function __check_hash_has_sense() { function __check_hash_has_sense() {
info = window.location.hash.split('/') info = window.location.hash.split('/')
......
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
<script src='/socket.io/socket.io.js'></script> <script src='/socket.io/socket.io.js'></script>
<script src="/libs/bootstrap/3.1.1/js/bootstrap.min.js"></script> <script src="/libs/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src='/javascripts/utils.js'></script>
<script src='/javascripts/page_distribution.js'></script>
<script src='/javascripts/main.js'></script>
<script> <script>
var AUTOSCROLL = <%= autoscroll %> var AUTOSCROLL = <%= autoscroll %>
var DISTRIBUTION_PAGE = '<%= paths.distribution %>'
</script> </script>
<script src='/javascripts/utils.js'></script>
<script src='/javascripts/page_distribution.js'></script>
<script src='/javascripts/main.js'></script>
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment