Add Post Templates feature
- Create templates table with name, body, type, title, target, placeholders - Add Template model with applyToPost method for placeholder replacement - Add Livewire Templates/Index component for CRUD operations - Add templates index view with form and table - Add /templates route - Update Posts/Index to support template selection when creating posts - Templates can be applied to pre-fill post form fields Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -63,6 +63,21 @@
|
||||
<div class="bg-white p-6 rounded w-full max-w-md space-y-4 max-h-[90vh] overflow-y-auto">
|
||||
<h2 class="text-lg font-semibold">{{ $editingId ? 'Edit Post' : 'Add Post' }}</h2>
|
||||
|
||||
@if (count($templates) > 0 && !$editingId)
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Template (optional)</label>
|
||||
<select wire:model.live="templateId" class="w-full border rounded p-2">
|
||||
<option value="">No template</option>
|
||||
@foreach ($templates as $template)
|
||||
<option value="{{ $template->id }}">{{ $template->name }} ({{ $template->type ? ucfirst($template->type) : 'any' }})</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@if ($templateId)
|
||||
<button wire:click="applyTemplate" class="mt-2 text-sm text-blue-600">Apply Template</button>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Site</label>
|
||||
<select wire:model="siteId" class="w-full border rounded p-2">
|
||||
|
||||
Reference in New Issue
Block a user