Files
mach_examples/12_rails_15_min_blog_external/post_show.mustache.html
2026-03-29 22:59:33 -05:00

32 lines
1.1 KiB
HTML

{{< layout}}
{{$body}}
{{#post}}
<article class="max-w-none">
<h1 class="text-4xl font-bold text-gray-900 mb-2">{{title}}</h1>
<p class="text-sm text-gray-400 mb-8">Published {{created_at}}</p>
<div class="prose prose-lg text-gray-700 whitespace-pre-line leading-relaxed">
{{body}}
</div>
</article>
<div class="flex gap-4 mt-10 pt-6 border-t border-gray-200">
<a href="{{url:edit_post:id}}"
class="bg-gray-100 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-200 transition">
Edit
</a>
<form method="post" action="{{url:post:id}}" class="inline">
<input type="hidden" name="http_method" value="delete">
<button type="submit"
class="bg-red-50 text-red-600 px-4 py-2 rounded-lg hover:bg-red-100 transition"
onclick="return confirm('Delete this post?')">
Delete
</button>
</form>
<a href="{{url:posts}}" class="text-gray-500 hover:text-gray-700 px-4 py-2">
&larr; Back
</a>
</div>
{{/post}}
{{/body}}
{{/layout}}