Commit e6bde7a5 authored by Efthymia Bika's avatar Efthymia Bika

Render timeview contents when there is no error

parent 05db1e34
...@@ -34,49 +34,51 @@ function show_contents_by_date(error, stdout, stderr) { ...@@ -34,49 +34,51 @@ function show_contents_by_date(error, stdout, stderr) {
toggle_error(error, stderr); toggle_error(error, stderr);
$("#time-contents").empty(); $("#time-contents").empty();
var ul = $("<ul></ul>") if(!error) {
.attr("class", "no-bullet") var ul = $("<ul></ul>")
.attr("id", "timeview-contents-list"); .attr("class", "no-bullet")
var contents = JSON.parse(stdout); .attr("id", "timeview-contents-list");
$.each(contents, function(i, el) { var contents = JSON.parse(stdout);
var f = "open_folder('" + escape_illegal_chars(el.name) + "')"; $.each(contents, function(i, el) {
var restore_f = "show_rest_icon('" + i + "')"; var f = "open_folder('" + escape_illegal_chars(el.name) + "')";
var title = (el.name.length > 30) ? el.name : ""; var restore_f = "show_rest_icon('" + i + "')";
var el_link = $("<a></a>") var title = (el.name.length > 30) ? el.name : "";
.attr("href", "#") var el_link = $("<a></a>")
.attr("title", title) .attr("href", "#")
.attr("onclick", restore_f); .attr("title", title)
if(el.type == 'dir') { .attr("onclick", restore_f);
el_link.attr("ondblclick", f); if(el.type == 'dir') {
} el_link.attr("ondblclick", f);
var locale_date = new Date(el.timestamp).toLocaleString(); }
var filename = (el.name.length > 30) ? var locale_date = new Date(el.timestamp).toLocaleString();
el.name.substring(0,7) + "..." + var filename = (el.name.length > 30) ?
el.name.substring(el.name.length-7, el.name.length) : el.name.substring(0,7) + "..." +
el.name; el.name.substring(el.name.length-7, el.name.length) :
var li = $("<li>&nbsp;<span>" + filename + el.name;
"&nbsp;</span><span class='right'>" var li = $("<li>&nbsp;<span>" + filename +
+ locale_date + "</span></li>") "&nbsp;</span><span class='right'>"
.attr("id", el.name); + locale_date + "</span></li>")
var icon_class = (el.type == 'dir') .attr("id", el.name);
? "fa fa-folder yellow-folder left" : var icon_class = (el.type == 'dir')
"fa fa-file-text-o green-file left"; ? "fa fa-folder yellow-folder left" :
var icon = $("<i></i>") "fa fa-file-text-o green-file left";
.attr("class", icon_class); var icon = $("<i></i>")
var rest_icon = $("<i></i>") .attr("class", icon_class);
.attr("id", "rest_icon_" + i) var rest_icon = $("<i></i>")
.attr("title", "Restore") .attr("id", "rest_icon_" + i)
.attr("class", "hide") .attr("title", "Restore")
.attr("onclick", "go_to_restore_single('" + .attr("class", "hide")
escape_illegal_chars(el.name) + "')"); .attr("onclick", "go_to_restore_single('" +
escape_illegal_chars(el.name) + "')");
li.append(icon);
li.append(rest_icon); li.append(icon);
el_link.append(li); li.append(rest_icon);
ul.append(el_link); el_link.append(li);
}); ul.append(el_link);
});
$("#time-contents").append(ul); $("#time-contents").append(ul);
}
$("#loader").hide(); $("#loader").hide();
} }
......
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