Skip to content

Commit

Permalink
fix actions
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Dec 3, 2023
1 parent c234183 commit 33db2e0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 49 deletions.
10 changes: 4 additions & 6 deletions src/Filament/Resources/FaqResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ public static function table(Table $table): Table
public static function getActions(): array
{
$action = [
ActionGroup::make([
EditAction::make('edit')->label(__('Edit')),
DeleteAction::make('delete')
->label(__('Delete')),
]),
EditAction::make('edit')->label(__('Edit')),
DeleteAction::make('delete')
->label(__('Delete')),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
Expand All @@ -105,7 +103,7 @@ public static function getActions(): array
->distUrl(fn (): string => route('faq'));
}

return $action;
return [ActionGroup::make($action)];
}

public static function getPages(): array
Expand Down
28 changes: 12 additions & 16 deletions src/Filament/Resources/LibraryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ public static function table(Table $table): Table
->toggleable()
->type('library'),
])
->actions([
ActionGroup::make(static::getActions()),
])
->actions(static::getActions())
->filters([
SelectFilter::make('type')
->visible()
Expand Down Expand Up @@ -189,18 +187,16 @@ public static function getNavigationLabel(): string
public static function getActions(): array
{
$action = [
ActionGroup::make([
EditAction::make('edit')
->label(__('Edit')),
Action::make('Open')
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->url(fn (Library $record): string => route('library.item', ['slug' => $record->slug]))
->openUrlInNewTab(),
DeleteAction::make('delete')
->label(__('Delete')),
]),
EditAction::make('edit')
->label(__('Edit')),
Action::make('Open')
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->url(fn (Library $record): string => route('library.item', ['slug' => $record->slug]))
->openUrlInNewTab(),
DeleteAction::make('delete')
->label(__('Delete')),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
Expand All @@ -209,6 +205,6 @@ public static function getActions(): array
->distUrl(fn (Library $record): string => route('library.item', ['slug' => $record->slug]));
}

return $action;
return [ActionGroup::make($action)];
}
}
25 changes: 11 additions & 14 deletions src/Filament/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,16 @@ public static function getNavigationLabel(): string
public static function getActions(): array
{
$action = [
ActionGroup::make([
EditAction::make('edit')->label(__('Edit')),

Action::make('Open')
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->url(fn (Post $record): string => route('page', ['slug' => $record]))
->openUrlInNewTab(),
DeleteAction::make('delete'),
ForceDeleteAction::make(),
RestoreAction::make(),
]),
EditAction::make('edit')->label(__('Edit')),
Action::make('Open')
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->url(fn (Post $record): string => route('page', ['slug' => $record]))
->openUrlInNewTab(),
DeleteAction::make('delete'),
ForceDeleteAction::make(),
RestoreAction::make(),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
Expand All @@ -238,6 +235,6 @@ public static function getActions(): array
->distUrl(fn (Post $record): string => route('page', ['slug' => $record]));
}

return $action;
return [ActionGroup::make($action)];
}
}
24 changes: 11 additions & 13 deletions src/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,16 @@ public static function getNavigationLabel(): string
public static function getActions(): array
{
$action = [
ActionGroup::make([
EditAction::make('edit')->label(__('Edit')),
Action::make('Open')
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->url(fn (Post $record): string => route('post', ['slug' => $record]))
->openUrlInNewTab(),
DeleteAction::make('delete'),
ForceDeleteAction::make(),
RestoreAction::make(),
]),
EditAction::make('edit')->label(__('Edit')),
Action::make('Open')
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->url(fn (Post $record): string => route('post', ['slug' => $record]))
->openUrlInNewTab(),
DeleteAction::make('delete'),
ForceDeleteAction::make(),
RestoreAction::make(),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
Expand All @@ -278,6 +276,6 @@ public static function getActions(): array
->distUrl(fn (Post $record): string => route('post', ['slug' => $record]));
}

return $action;
return [ActionGroup::make($action)];
}
}

0 comments on commit 33db2e0

Please sign in to comment.