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:
@@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user