aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2019-05-04 21:41:14 +0200
committerMarvin Borner2019-05-04 21:41:14 +0200
commite5cf2266d703e84873c008604874d88954c2bb2a (patch)
treef39fa88d95c4c19ca035cb34936754eac6538628
parentb7540fb2b1bbe016d23b8a7f3e7ab3edafb219c8 (diff)
Minor bug fixes
Co-authored-by: LarsVomMars <lars@kroenner.eu>
-rw-r--r--src/main/kotlin/App.kt2
-rw-r--r--src/main/resources/js/files.js11
-rw-r--r--src/main/resources/views/files.rocker.html2
3 files changed, 10 insertions, 5 deletions
diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt
index f3cb8a0..5370f4b 100644
--- a/src/main/kotlin/App.kt
+++ b/src/main/kotlin/App.kt
@@ -50,7 +50,7 @@ fun main(args: Array<String>) {
)
get(
"/js/*", { ctx ->
- ctx.contentType("text/js")
+ ctx.contentType("text/javascript")
ctx.result(Thread.currentThread().contextClassLoader.getResourceAsStream("js/" + ctx.splat(0)))
},
roles(Roles.GUEST, Roles.USER)
diff --git a/src/main/resources/js/files.js b/src/main/resources/js/files.js
index 0102296..2225aa0 100644
--- a/src/main/resources/js/files.js
+++ b/src/main/resources/js/files.js
@@ -27,9 +27,14 @@ drop.addEventListener('drop', e => {
const row = document.getElementById("table").insertRow(-1);
row.setAttribute("data-href", file.name);
- // TODO: Differentiate between file and directory upload in frontend
- row.insertCell(0).innerHTML = "<td><i class='icon ion-md-document'></i></td>";
- row.insertCell(1).innerHTML = file.name;
+
+ if (item.isDirectory) {
+ row.insertCell(0).innerHTML = "<td><i class='icon ion-md-folder'></i></td>";
+ row.insertCell(1).innerHTML = file.name + "/";
+ } else {
+ row.insertCell(0).innerHTML = "<td><i class='icon ion-md-document'></i></td>";
+ row.insertCell(1).innerHTML = file.name;
+ }
row.insertCell(2).innerHTML = bytesToSize(file.size);
row.insertCell(3).innerHTML = `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
row.insertCell(4).innerHTML = "<td><button class='share'><i class='icon ion-md-share'></i></button></td>";
diff --git a/src/main/resources/views/files.rocker.html b/src/main/resources/views/files.rocker.html
index 7b2e58b..43a3488 100644
--- a/src/main/resources/views/files.rocker.html
+++ b/src/main/resources/views/files.rocker.html
@@ -57,7 +57,7 @@
<th></th>
}
</tr>
- <tr data-href="../">
+ <tr data-href="/../">
<td></td>
<td>../</td>
<td></td>