diff --git a/app/Filament/Admin/Resources/Pages/Pages/EditPage.php b/app/Filament/Admin/Resources/Pages/Pages/EditPage.php index dde5d95..11b2a2c 100644 --- a/app/Filament/Admin/Resources/Pages/Pages/EditPage.php +++ b/app/Filament/Admin/Resources/Pages/Pages/EditPage.php @@ -9,19 +9,45 @@ use Filament\Actions\DeleteAction; use Filament\Actions\ForceDeleteAction; use Filament\Actions\RestoreAction; use Filament\Resources\Pages\EditRecord; +use Illuminate\Contracts\View\View; class EditPage extends EditRecord { protected static string $resource = PageResource::class; + + // Sticky header aktif + protected static bool $hasTopbar = true; + + public bool $autoSaveEnabled = false; + public ?string $lastAutoSaveTime = null; public function getTitle(): string { return __('pages.edit'); } + + public function autoSave(): void + { + try { + $this->save(); + $this->lastAutoSaveTime = now()->format('H:i:s'); + + // Sessiz başarı bildirimi + \Filament\Notifications\Notification::make() + ->title('Otomatik Kaydedildi') + ->body('Son kayıt: ' . $this->lastAutoSaveTime) + ->success() + ->duration(2000) + ->send(); + } catch (\Exception $e) { + // Hata olursa sessizce geç, kullanıcıyı rahatsız etme + } + } protected function getHeaderActions(): array { return [ + Action::make('save') ->label(__('pages.save')) ->action('save') @@ -125,4 +151,11 @@ class EditPage extends EditRecord // Save translations TranslationTabs::saveTranslations($this->record, $this->form->getState()); } + + public function getFooter(): ?View + { + return view('filament.pages.edit-page-footer', [ + 'autoSaveEnabled' => $this->autoSaveEnabled, + ]); + } } diff --git a/resources/views/components/blocks/custom.blade.php b/resources/views/components/blocks/custom.blade.php index 91b3372..28f74ef 100644 --- a/resources/views/components/blocks/custom.blade.php +++ b/resources/views/components/blocks/custom.blade.php @@ -1,3 +1,9 @@ @foreach($data as $item) - {!! $item['value'] !!} + @if(($item['type'] ?? null) === 'markdown') +
+ {!! \Illuminate\Support\Str::markdown($item['value']) !!} +
+ @else + {!! $item['value'] !!} + @endif @endforeach \ No newline at end of file diff --git a/resources/views/filament/pages/edit-page-footer.blade.php b/resources/views/filament/pages/edit-page-footer.blade.php new file mode 100644 index 0000000..41f4333 --- /dev/null +++ b/resources/views/filament/pages/edit-page-footer.blade.php @@ -0,0 +1,61 @@ +{{-- Sticky Header CSS --}} + + +@if($autoSaveEnabled) +{{-- Otomatik Kaydetme Script --}} + +@endif +