Commit d270fa6f authored by Leo Iannacone's avatar Leo Iannacone

update breadcrump

parent 9bbe4a18
...@@ -17,6 +17,7 @@ function get_path(path) { ...@@ -17,6 +17,7 @@ function get_path(path) {
data.file.name = info[3] data.file.name = info[3]
socket.emit("get_file", data) socket.emit("get_file", data)
} }
update_breadcrumb(path)
} }
function build_hash(data) { function build_hash(data) {
...@@ -32,6 +33,22 @@ function build_hash(data) { ...@@ -32,6 +33,22 @@ function build_hash(data) {
return hash return hash
} }
function update_breadcrumb(hash) {
new_html = ''
new_hash = '#'
info = hash.split('/')
for (var i = 0; i < info.length ; i++) {
new_hash += info[i]
if (i == (info.length - 1))
new_html += '<li class="active">' + info[i] + '</li>'
else
new_html += '<li><a href="' + new_hash + '">' + info[i] + '</a>'
new_hash += '/'
}
console.log(new_html)
$('.breadcrumb').html(new_html)
}
var socket = io.connect('//localhost:3000'); var socket = io.connect('//localhost:3000');
socket.on('distributions', function(distributions) { socket.on('distributions', function(distributions) {
...@@ -56,7 +73,15 @@ socket.on('package_file_list', function(data){ ...@@ -56,7 +73,15 @@ socket.on('package_file_list', function(data){
tmp = data tmp = data
data.package.files.forEach(function(f){ data.package.files.forEach(function(f){
tmp.file = f tmp.file = f
$('#files ul').append('<li><a href="'+ build_hash(tmp) + '">' + f.name + '</a></li>') $('#files ul').append('<li><a name="'+ f.orig_name +'" href="'+ build_hash(tmp) + '">' + f.name + '</a></li>')
})
data.package.debs.forEach(function(f){
$('#debs ul').append('<li><a name="'+ f.orig_name +'" href="' + f.path + '">' + f.name +'</a> <span>.' + f.label + '</span></li>')
})
data.package.archives.forEach(function(f){
$('#archives ul').append('<li><a name="'+ f.orig_name +'" href="' + f.path + '">' + f.name +'</a></li>')
}) })
}) })
......
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