add prettier and null responses

This commit is contained in:
2020-12-05 09:46:24 +05:30
parent 577df86ab3
commit b4444c68e2
2 changed files with 11 additions and 3 deletions

View File

@@ -11,6 +11,10 @@
"type": "git",
"url": "git+https://github.com/chrisvrose/nodejs-fm.git"
},
"prettier":{
"tabWidth": 4,
"semi": true
},
"keywords": [
"file-manager",
"file-viewer"

View File

@@ -84,9 +84,13 @@ function updateContents(contentResponse){
$('#files-table').append(`<tr><td>null</td><td class="file-handlers"></td></tr>`)
}else{
$('#files-table').hide().empty();
if(contentResponse.contents.length===0){
$('#files-table').append(`<tr class="files-row"><td>...No files...</td></tr>`);
}else{
contentResponse.contents.forEach(element => {
$('#files-table').append(`<tr class="files-row box-shadow-1-active"><td onclick="doUpdate($(this),${element.isDir})" class="file-name ${(element.isDir?'file-isDir':'file-isFile')}" data-choice="${element.path}">${element.name}</td></tr>`)
});
}
if(contentResponse.back!==null){
$('#files-table').prepend(`<tr class="files-row box-shadow-1-active"><td onclick="doUpdate($(this),true)" class="file-name file-isDir file-isBack" data-choice="${contentResponse.back}">..</td></tr>`)
}