Files
soroushasadi/Pages/Admin/Posts/Edit.cshtml
T

36 lines
1.6 KiB
Plaintext
Raw Normal View History

@page "/Admin/Posts/{slug}"
@model SoroushAsadi.Pages.Admin.Posts.PostEditModel
@{
Layout = "_AdminLayout";
ViewData["Title"] = "Edit post: " + Model.Slug;
}
<div class="mb-6 flex items-center gap-4">
<a href="/Admin/Posts" class="text-slate-400 hover:text-white transition-colors text-sm">← Posts</a>
<h1 class="font-display text-xl font-bold text-white">@Model.Slug</h1>
<a href="/blog/@Model.Slug" target="_blank" class="text-xs text-slate-400 hover:text-white transition-colors">View ↗</a>
</div>
@if (!string.IsNullOrEmpty(Model.Message))
{
<div class="mb-4 rounded-lg border border-emerald/30 bg-emerald/10 px-4 py-3 text-sm text-emerald">@Model.Message</div>
}
<form method="post" class="space-y-4">
<div>
<label class="label-mono mb-2 block">Body (Markdown)</label>
<p class="text-xs text-slate-500 mb-2">Supports: ## headings, **bold**, `code`, - list items, paragraphs</p>
<textarea name="body" rows="30"
class="w-full rounded-xl border border-white/10 bg-white/[.03] px-4 py-3 font-mono text-xs text-slate-200 outline-none focus:border-electric/60 transition-colors resize-y"
spellcheck="false">@Model.CurrentBody</textarea>
</div>
<div class="flex gap-3">
<button type="submit" class="btn-primary">Save</button>
@if (Model.HasOverride)
{
<button type="submit" name="reset" value="1" class="rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400 hover:bg-red-500/20 transition-colors">Reset to default</button>
}
<a href="/Admin/Posts" class="btn-ghost">Cancel</a>
</div>
</form>