add file stuff

This commit is contained in:
HRG @ SCExC 2024-06-03 20:19:26 -04:00
parent c33a49e817
commit 7aac7aabdd
5 changed files with 195 additions and 26 deletions

42
views/workshop/files.eta Normal file
View file

@ -0,0 +1,42 @@
<html>
<head>
<link rel="stylesheet" href="/css/xp.css">
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="flex flex-col w-full h-full window">
<div class="title-bar">
<div class="title-bar-text">Workshop - <%~ include('/workshop/structure_name', {structure: it.structure}) %>
</div>
</div>
<div class="flex flex-row flex-grow window-body">
<div class="w-1/5 h-full">
<%~ include('/workshop/sidebar', it) %>
</div>
<div id="main-editor" class="flex flex-grow flex-col">
<h1>Files</h1>
<div>
<form hx-encoding='multipart/form-data' hx-post='/workshop/<%= it.structure.id %>/files' hx-target="#files-list" hx-swap="afterbegin" _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'>
<input type='file' name='file'>
<button type="submit">
Upload
</button>
<progress id='progress' value='0' max='100'></progress>
</form>
</div>
<div>
<ul id="files-list">
<% for (let file of it.files) { %>
<%~ include('/workshop/file_detail', { file }) %>
<% } %>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>