Add template preview functionality: Introduced TemplatePreviewController and TemplatePreviewService for rendering dynamic previews of header, footer, and section templates. Updated form schemas to include preview components and enhanced real-time content updates. Added configuration for template assets and integrated preview functionality into the admin panel.

This commit is contained in:
Ümit Tunç
2025-10-31 16:48:36 -03:00
parent 67d8b4c781
commit 52c4ba1b19
8 changed files with 578 additions and 9 deletions
@@ -6,6 +6,7 @@ use Filament\Forms\Components\CodeEditor;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\View;
use Filament\Schemas\Schema;
class HeaderTemplateForm
@@ -22,19 +23,31 @@ class HeaderTemplateForm
->maxLength(255)
->columnSpanFull(),
// Preview Component
View::make('components.template-preview')
->extraAttributes([
'data-type' => 'header',
'data-field-name' => 'html_content',
])
->columnSpanFull(),
CodeEditor::make('html_content')
->label(__('header-templates.field_html_content'))
->required()
//->lineNumbers()
->live(onBlur: false) // Real-time updates
->columnSpanFull()
->helperText(__('header-templates.field_html_content_help')),
->helperText(__('header-templates.field_html_content_help'))
->extraAttributes([
'style' => 'min-height: 400px;',
'data-field-name' => 'html_content',
]),
Toggle::make('is_active')
->label(__('header-templates.field_is_active'))
->default(true)
->inline(false),
])
->columns(2),
->columnSpanFull(),
]);
}
}