btcpayserver/BTCPayServer/Views/UIServer/Files.cshtml
d11n a962e60de9
More Translations (#6318)
* Store selector

* Footer

* Notifications

* Checkout Appearance

* Users list

* Forms

* Emails

* Pay Button

* Edit Dictionary

* Remove newlines, fix typos

* Forms

* Pull payments and payouts

* Various pages

* Use local docs link

* Fix

* Even more translations

* Fixes #6325

* Account pages

* Notifications

* Placeholders

* Various pages and components

* Add more
2024-10-25 22:48:53 +09:00

128 lines
5.9 KiB
Plaintext

@model ViewFilesViewModel
@{
ViewData.SetActivePage(ServerNavPages.Files, StringLocalizer["File Storage"]);
}
<div class="sticky-header">
<h2 class="my-1" text-translate="true">@ViewData["Title"]</h2>
<a asp-action="storage" asp-route-forceChoice="true" asp-route-returnurl="@ViewData["ReturnUrl"]" class="btn btn-secondary d-flex align-items-center">
<vc:icon symbol="settings" />
</a>
</div>
<partial name="_StatusMessage" />
@if (!Model.StorageConfigured)
{
<p>
@ViewLocalizer["Before being able to upload you first need to {0}.", Html.ActionLink(StringLocalizer["choose your file storage service provider"], "Storage", "UIServer", new { forceChoice = "true", returnurl = ViewData["ReturnUrl"] })]
<a href="https://docs.btcpayserver.org/FAQ/ServerSettings/#how-to-upload-files-to-btcpay" target="_blank" rel="noreferrer noopener" title="@StringLocalizer["More information..."]">
<vc:icon symbol="info" />
</a>
</p>
}
else
{
<p>
@ViewLocalizer["Change your {0} provider.", Html.ActionLink(StringLocalizer["file storage service"], "Storage", "UIServer", new { forceChoice = "true", returnurl = ViewData["ReturnUrl"] })]
<a href="https://docs.btcpayserver.org/FAQ/ServerSettings/#how-to-upload-files-to-btcpay" target="_blank" rel="noreferrer noopener" title="@StringLocalizer["More information..."]">
<vc:icon symbol="info" />
</a>
</p>
@if (Model.StorageConfigured)
{
<form asp-action="CreateFiles" method="post" enctype="multipart/form-data">
<div class="d-flex">
<input multiple type="file" class="form-control mb-3" name="files" id="files" required>
<button class="btn btn-primary mb-3 ms-3" role="button" text-translate="true">Upload</button>
</div>
</form>
}
@if (Model.DirectUrlByFiles is { Count: > 0 })
{
foreach (var fileUrlPair in Model.DirectUrlByFiles)
{
var fileId = fileUrlPair.Key;
var file = Model.Files.Single(storedFile => storedFile.Id.Equals(fileId, StringComparison.InvariantCultureIgnoreCase));
var url = Url.Action("GetFile", "UIStorage", new { fileId }, Context.Request.Scheme, Context.Request.Host.ToString());
<div class="border border-light rounded bg-tile mt-3">
<div class="row">
<div class="col-sm-12 col-md-4">
<div class="input-group">
<div class="form-floating">
<input id="@fileId-name" class="form-control-plaintext" readonly="readonly" value="@file.FileName">
<label text-translate="true">File name</label>
</div>
<button type="button" class="btn btn-link" data-clipboard="@file.FileName">
<vc:icon symbol="actions-copy" />
</button>
</div>
</div>
<div class="col-sm-12 col-md-4 ">
<div class="input-group ">
<div class="form-floating">
<input id="@fileId" class="form-control-plaintext" readonly="readonly" value="@fileId">
<label text-translate="true">File Id</label>
</div>
<button type="button" class="btn btn-link" data-clipboard="@fileId">
<vc:icon symbol="actions-copy" />
</button>
</div>
</div>
<div class=" col-sm-12 col-md-4">
<div class="input-group">
<div class="form-floating">
<input id="@fileId-url" class="form-control-plaintext" readonly="readonly" value="@url">
<label text-translate="true">Permanent Url</label>
</div>
<button type="button" class="btn btn-link" data-clipboard="@url">
<vc:icon symbol="actions-copy" />
</button>
</div>
</div>
<button type="button" class="btn btn-link" data-clipboard="@url">
<vc:icon symbol="copy" />
</button>
</div>
</div>
}
}
@if (Model.Files.Any())
{
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th text-translate="true">Name</th>
<th text-translate="true">Timestamp</th>
<th text-translate="true">Uploaded By</th>
<th text-translate="true" class="text-end">Actions</th>
</tr>
</thead>
<tbody>
@foreach (var file in Model.Files)
{
<tr>
<td>
<a asp-action="Files" asp-route-fileIds="@file.Id">@file.FileName</a>
</td>
<td>@file.Timestamp.ToBrowserDate()</td>
<td>@file.ApplicationUser.UserName</td>
<td class="text-end">
<a href="@Url.Action("Files", "UIServer", new {fileIds = new [] { file.Id }})" class="text-nowrap" text-translate="true">Get Link</a>
- <a asp-action="DeleteFile" asp-route-fileId="@file.Id" text-translate="true">Remove</a>
</td>
</tr>
}
</tbody>
</table>
</div>
}
else
{
<p class="text-secondary mt-3" text-translate="true">There are no files yet.</p>
}
}