Commit 40d4005b authored by Leo Iannacone's avatar Leo Iannacone

some html tests

parent 5682fd79
...@@ -18,8 +18,33 @@ ...@@ -18,8 +18,33 @@
data.package.name = info[1]; data.package.name = info[1];
data.package.version = info[2]; data.package.version = info[2];
} }
if (info.length == 4) {
data.file = info[3]
socket.emit('get-file', data)
}
else
socket.emit('get-view', data); socket.emit('get-view', data);
} }
function set_up_view(data) {
if (data) {
if (data.distribution) {
if (data.distribution.name && data.distribution.packages) {
$('#packages').html('')
data.distribution.packages.forEach(function(p){
div = $('#packages').append('<li><a href="#' + data.distribution.name + '/' + p.name + '/'+ p.version + '">'+ p.name + ' <span>'+p.version+'</span></a></li>')
})
}
if (data.package) {
$('#files').html('');
data.package.files.forEach(function(f){
p = data.package
$('#files').append('<li><a href="#' + data.distribution.name + '/' + p.name + '/'+ p.version + '/' + f.name + '">' + f.label + '</a></li>')
})
}
}
}
}
var socket = io.connect('//localhost:3000'); var socket = io.connect('//localhost:3000');
socket.on('distributions', function(distributions) { socket.on('distributions', function(distributions) {
...@@ -31,6 +56,7 @@ ...@@ -31,6 +56,7 @@
socket.on('view', function(data){ socket.on('view', function(data){
console.log(data) console.log(data)
set_up_view(data)
}); });
socket.on('error', function() { console.error(arguments) }); socket.on('error', function() { console.error(arguments) });
......
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