wabbajack/Wabbajack.Server/Controllers/Templates/AuthorControls.html
2021-12-20 09:22:40 -07:00

73 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Author Controls - {{$.User}} - {{$.TotalUsage}}</title>
</head>
<body>
<h2>Author Controls - {{$.User}} - {{$.TotalUsage}}</h2>
<br/>
<h3>Wabbajack Files</h3>
<table>
<tr>
<td><b>Commands</b></td>
<td><b>Name</b></td>
<td><b>Size</b></td>
<td><b>Finished Uploading</b></td>
<td><b>Unique Name</b></td>
</tr>
{{each $.WabbajackFiles }}
<tr>
<td>
<button onclick="deleteFile('{{@Escape($.MangledName)}}');">Delete</button>
</td>
<td>{{$.Name}}</td>
<td>{{$.Size}}</td>
<td>{{$.UploadedDate}}</td>
<td>{{$.MangledName}}</td>
</tr>
{{/each}}
</table>
<h3>Other Files</h3>
<table>
<tr>
<td><b>Commands</b></td>
<td><b>Name</b></td>
<td><b>Size</b></td>
<td><b>Finished Uploading</b></td>
<td><b>Unique Name</b></td>
</tr>
{{each $.OtherFiles }}
<tr>
<td>
<button onclick="deleteFile('{{@Escape($.MangledName)}}');">Delete</button>
</td>
<td>{{$.Name}}</td>
<td>{{$.Size}}</td>
<td>{{$.UploadedDate}}</td>
<td>{{$.MangledName}}</td>
</tr>
{{/each}}
</table>
<script lang="javascript">
if (!Array.prototype.last) {
Array.prototype.last = function () {
return this[this.length - 1];
};
}
function deleteFile(mangled) {
if (window.confirm("Are you sure you want to delete: " + mangled)) {
fetch("/authored_files/" + mangled.split("_").last(), {method: "DELETE"})
.then(r => location.reload());
}
}
</script>
</body>
</html>