Enhance Template Preview Functionality: Added a preview action to both HeaderTemplatesTable and FooterTemplatesTable, allowing users to preview templates in a modal. Updated localization files to include preview action labels in both English and Turkish. Introduced new Blade views for rendering template previews, improving the overall user experience in template management.
This commit is contained in:
@@ -290,14 +290,12 @@ class ImportHtmlTemplates extends Command
|
||||
// DOMDocument attribute değerlerini encode ettiği için bunları geri çeviriyoruz
|
||||
$html = str_replace(['%7B', '%7D'], ['{', '}'], $html);
|
||||
|
||||
// SPECIAL TOKENS FIX
|
||||
if ($templateType === 'header') {
|
||||
$html = str_replace('___SPECIAL_MENU___', '{custom.menu}', $html); // Geriye dönük uyumluluk
|
||||
$html = str_replace('___CUSTOM_MENU___', '{custom.menu}', $html);
|
||||
$html = str_replace('___CUSTOM_NAVBAR___', '{custom.navbar}', $html);
|
||||
$html = str_replace('___CUSTOM_LANGUAGE___', '{custom.language-selector}', $html);
|
||||
$html = str_replace('___SETTING_LANGUAGES___', '{custom.language-selector}', $html);
|
||||
}
|
||||
// SPECIAL TOKENS FIX - Replace placeholder tokens with actual template syntax
|
||||
$html = str_replace('___SPECIAL_MENU___', '{custom.menu}', $html);
|
||||
$html = str_replace('___CUSTOM_MENU___', '{custom.menu}', $html);
|
||||
$html = str_replace('___CUSTOM_NAVBAR___', '{custom.navbar}', $html);
|
||||
$html = str_replace('___CUSTOM_LANGUAGE___', '{custom.language-selector}', $html);
|
||||
$html = str_replace('___SETTING_LANGUAGES___', '{custom.language-selector}', $html);
|
||||
|
||||
return ['html' => $html, 'data' => $data];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Actions\Action;
|
||||
|
||||
class FooterTemplatesTable
|
||||
{
|
||||
@@ -56,6 +57,13 @@ class FooterTemplatesTable
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('preview')
|
||||
->label(__('footer-templates.action_preview'))
|
||||
->icon('heroicon-o-eye')
|
||||
->modalContent(fn ($record) => view('filament.admin.resources.footer-templates.preview', ['record' => $record]))
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelAction(false)
|
||||
->modalWidth('7xl'),
|
||||
ViewAction::make(),
|
||||
EditAction::make(),
|
||||
])
|
||||
|
||||
@@ -12,6 +12,7 @@ use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Actions\Action;
|
||||
|
||||
class HeaderTemplatesTable
|
||||
{
|
||||
@@ -56,6 +57,13 @@ class HeaderTemplatesTable
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('preview')
|
||||
->label(__('header-templates.action_preview'))
|
||||
->icon('heroicon-o-eye')
|
||||
->modalContent(fn ($record) => view('filament.admin.resources.header-templates.preview', ['record' => $record]))
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelAction(false)
|
||||
->modalWidth('7xl'),
|
||||
ViewAction::make(),
|
||||
EditAction::make(),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user