mirror of
https://github.com/miawinter98/just-short-it.git
synced 2024-09-20 01:39:00 +00:00
97 lines
4.9 KiB
Plaintext
97 lines
4.9 KiB
Plaintext
@page
|
|
@model JustShortIt.Pages.UrlsModel
|
|
@{
|
|
ViewData["Title"] = "Urls";
|
|
}
|
|
|
|
<div class="grid place-items-center h-full text-primary-content">
|
|
<div class="w-full md:max-w-lg">
|
|
@if (!string.IsNullOrEmpty(Model.Message)) {
|
|
<!--
|
|
btn-success
|
|
/\
|
|
this just tells tailwind to generate it, since new uses this class for the link copy button
|
|
I know there is a safe-class thingie in the config, but this was just easier bc it's only needed here
|
|
-->
|
|
<div class="alert alert-info rounded-sm">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" />
|
|
</svg>
|
|
<span>
|
|
@Html.Raw(Model.Message)
|
|
</span>
|
|
<button class="btn btn-square btn-sm btn-ghost" onclick="this.parentElement.remove()">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
|
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
}
|
|
|
|
<h1 class="text-2xl lg:text-4xl my-6 text-center">Urls Administration</h1>
|
|
|
|
<form class="mb-6" method="post" asp-page="Urls" asp-page-handler="Inspect">
|
|
<h2 class="text-xl lg:text-2xl mb-3">Inspect URL</h2>
|
|
|
|
<div class="join w-full">
|
|
<label class="join-item btn btn-outline no-animation text-primary-content border-white">ID</label>
|
|
<div class="join-item flex-1">
|
|
<input required type="text" class="input input-bordered w-full border-white" name="Inspect_Id" autocomplete="off" />
|
|
</div>
|
|
<div class="join-item">
|
|
<button class="btn btn-primary border-1" type="submit">Inspect</button>
|
|
</div>
|
|
</div>
|
|
|
|
<span class="text-error">@ModelState["Inspect_Id"]?.Errors.FirstOrDefault()?.ErrorMessage</span>
|
|
</form>
|
|
|
|
<form method="post" asp-page-handler="New">
|
|
<h2 class="text-xl lg:text-2xl mb-3">New URL</h2>
|
|
|
|
<div class="form-control w-full">
|
|
<span class="label">
|
|
<label class="label-text text-primary-content" asp-for="Model!.Id">ID</label>
|
|
</span>
|
|
<input required class="input input-bordered w-full" type="text" asp-for="Model!.Id" autocomplete="off" />
|
|
<span class="label">
|
|
<span class="label-text-alt text-error" asp-validation-for="Model!.Id"></span>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="form-control w-full">
|
|
<div class="label">
|
|
<label class="label-text text-primary-content" asp-for="Model!.Target">Target</label>
|
|
</div>
|
|
<input required class="input input-bordered w-full" type="url" asp-for="Model!.Target" autocomplete="off" />
|
|
<div class="label">
|
|
<span class="label-text-alt text-error" asp-validation-for="Model!.Target"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-control w-full">
|
|
<span class="label">
|
|
<label class="label-text text-primary-content" asp-for="Model!.ExpirationDate">Expiration</label>
|
|
</span>
|
|
@Html.DropDownListFor(m => m.Model!.ExpirationDate, new List<SelectListItem> {
|
|
new("1 Day", DateTime.UtcNow.AddDays(1).ToBinary().ToString()),
|
|
new("1 Week", DateTime.UtcNow.AddDays(7).ToBinary().ToString()),
|
|
new("4 Weeks", DateTime.UtcNow.AddDays(4 * 7).ToBinary().ToString()),
|
|
new("1 Year", DateTime.UtcNow.AddYears(1).ToBinary().ToString()),
|
|
new("Never", DateTime.UtcNow.AddYears(1000).ToBinary().ToString())
|
|
}, "Select Expiration", new {
|
|
@class = "select select-bordered w-full"
|
|
})
|
|
<div class="label">
|
|
<span class="label-text-alt text-error" asp-validation-for="Model!.ExpirationDate"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-error pb-3" asp-validation-summary="ModelOnly"></div>
|
|
|
|
<button class="btn btn-primary w-full" type="submit">Create</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|