FastBlog/src/FastBlog.Web/Views/Files/Index.cshtml

99 lines
3.3 KiB
Plaintext

@using FastBlog.Web.Helpers
@model FastBlog.Core.Models.PagedResponse<FastBlog.Core.Models.Files.FileMeta>
@{
ViewBag.Title = "Files";
}
<div class="container" id="file-list">
<br/>
<article>
<header>
<h3>Upload a file</h3>
</header>
<form hx-encoding="multipart/form-data"
hx-post="/files"
hx-swap="outerHTML"
hx-target="#file-list">
<input type="file" name="file" required/>
<label for="upload-path">Path to upload (optional)</label>
<input type="text" id="upload-path" name="sourcePath" placeholder="/subfolders/"/>
<input type="radio" id="age1" name="age" value="30">
<label for="age1">0 - 30</label><br>
<input type="radio" id="age2" name="age" value="60">
<label for="age2">31 - 60</label><br>
<input type="radio" id="age3" name="age" value="100">
<label for="age3">61 - 100</label><br><br>
<input type="submit" value="Submit">
<button type="submit" class="btn-fw">
Upload
</button>
</form>
</article>
<article>
<header>
<h3>Manage files</h3>
</header>
<body>
@if (Model.Data.Length is 0)
{
<h4>No files have been found</h4>
}
@foreach (var file in Model.Data)
{
<div class="grid">
<div style="display: flex; font-size: 16px">
<p class="no-margin" style="margin-right: 10px; font-weight: bold">
<a target="_blank" href="/static/@file.SourceLocation">@file.SourceLocation</a>
</p>
<p class="no-margin">
<a class="pico-color-red" hx-delete="/files/@file.Id"
hx-swap="outerHTML"
hx-target="#file-list">
[ Delete ]
</a>
</p>
</div>
<div>
<p class="no-margin">
<strong>Created:</strong> @file.CreatedAt.ToString("d");
</p>
</div>
<div>
<p class="no-margin">
<strong>Type:</strong> @file.MimeType;
</p>
</div>
</div>
<hr/>
}
</body>
<footer>
<div>
<button
hx-get="/files?page=@(Model.Offset - 25)"
hx-swap="outerHTML"
hx-target="#file-list"
@HtmlPropertyHelper.If(Math.Clamp(Model.Offset, 0, Model.Amount) == 0, "disabled")>
Previous
</button>
<button
hx-get="/files?page=@(Model.Offset + 25)"
hx-swap="outerHTML"
hx-target="#file-list"
@HtmlPropertyHelper.If(Math.Clamp(Model.Offset, 0, Model.Amount) >= Model.Amount - 25, "disabled")>
Next
</button>
</div>
</footer>
</article>
</div>