feat: restore sablog browse modes and clean imported HTML
Keep the public site readable after import (nbsp, highlighter, wrapping code, compact pager) and finish the admin extras already in this tree: sticky levels, preview, page cache, and live llms.txt. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace App\Filament\Resources\Posts\Tables;
|
||||
|
||||
use App\Models\Post;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PostsTable
|
||||
@@ -46,9 +46,17 @@ class PostsTable
|
||||
'draft' => 'warning',
|
||||
default => 'gray',
|
||||
}),
|
||||
IconColumn::make('is_sticky')
|
||||
TextColumn::make('sticky_level')
|
||||
->label('置顶')
|
||||
->boolean(),
|
||||
->badge()
|
||||
->sortable()
|
||||
->formatStateUsing(fn ($state) => Post::stickyLevelOptions()[(int) $state] ?? '不置顶')
|
||||
->color(fn ($state) => match ((int) $state) {
|
||||
Post::STICKY_HEADLINE => 'danger',
|
||||
Post::STICKY_STRONG => 'warning',
|
||||
Post::STICKY_LIGHT => 'success',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextColumn::make('views')
|
||||
->label('阅读')
|
||||
->numeric()
|
||||
@@ -79,12 +87,17 @@ class PostsTable
|
||||
'markdown' => 'Markdown',
|
||||
'html' => 'HTML',
|
||||
]),
|
||||
TernaryFilter::make('is_sticky')
|
||||
->label('置顶'),
|
||||
], \Filament\Tables\Enums\FiltersLayout::AboveContent)
|
||||
SelectFilter::make('sticky_level')
|
||||
->label('置顶')
|
||||
->options(Post::stickyLevelOptions()),
|
||||
], FiltersLayout::AboveContent)
|
||||
->filtersFormColumns(3)
|
||||
->filtersFormWidth(\Filament\Support\Enums\Width::ThreeExtraLarge)
|
||||
->filtersFormWidth(Width::ThreeExtraLarge)
|
||||
->recordActions([
|
||||
Action::make('preview')
|
||||
->label('预览')
|
||||
->url(fn (Post $record): string => $record->url)
|
||||
->openUrlInNewTab(),
|
||||
ViewAction::make(),
|
||||
EditAction::make(),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user