fix: use schema() instead of modalContent() for Filament 5 compatibility
Replace deprecated modalContent() with schema([CommentsEntry::make('comments')])
in both CommentsAction and CommentsTableAction to fix comment creation in
Filament 5 modals.
This commit is contained in:
Binary file not shown.
@@ -3,8 +3,8 @@
|
|||||||
namespace Relaticle\Comments\Filament\Actions;
|
namespace Relaticle\Comments\Filament\Actions;
|
||||||
|
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Relaticle\Comments\Concerns\HasComments;
|
use Relaticle\Comments\Concerns\HasComments;
|
||||||
|
use Relaticle\Comments\Filament\Infolists\Components\CommentsEntry;
|
||||||
|
|
||||||
class CommentsAction extends Action
|
class CommentsAction extends Action
|
||||||
{
|
{
|
||||||
@@ -19,11 +19,9 @@ class CommentsAction extends Action
|
|||||||
->modalHeading(__('Comments'))
|
->modalHeading(__('Comments'))
|
||||||
->modalSubmitAction(false)
|
->modalSubmitAction(false)
|
||||||
->modalCancelAction(false)
|
->modalCancelAction(false)
|
||||||
->modalContent(function (): View {
|
->schema([
|
||||||
return view('comments::filament.comments-action', [
|
CommentsEntry::make('comments'),
|
||||||
'record' => $this->getRecord(),
|
])
|
||||||
]);
|
|
||||||
})
|
|
||||||
->badge(function (): ?int {
|
->badge(function (): ?int {
|
||||||
$record = $this->getRecord();
|
$record = $this->getRecord();
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
namespace Relaticle\Comments\Filament\Actions;
|
namespace Relaticle\Comments\Filament\Actions;
|
||||||
|
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Relaticle\Comments\Concerns\HasComments;
|
use Relaticle\Comments\Concerns\HasComments;
|
||||||
|
use Relaticle\Comments\Filament\Infolists\Components\CommentsEntry;
|
||||||
|
|
||||||
class CommentsTableAction extends Action
|
class CommentsTableAction extends Action
|
||||||
{
|
{
|
||||||
@@ -19,11 +19,9 @@ class CommentsTableAction extends Action
|
|||||||
->modalHeading(__('Comments'))
|
->modalHeading(__('Comments'))
|
||||||
->modalSubmitAction(false)
|
->modalSubmitAction(false)
|
||||||
->modalCancelAction(false)
|
->modalCancelAction(false)
|
||||||
->modalContent(function (): View {
|
->schema([
|
||||||
return view('comments::filament.comments-action', [
|
CommentsEntry::make('comments'),
|
||||||
'record' => $this->getRecord(),
|
])
|
||||||
]);
|
|
||||||
})
|
|
||||||
->badge(function (): ?int {
|
->badge(function (): ?int {
|
||||||
$record = $this->getRecord();
|
$record = $this->getRecord();
|
||||||
|
|
||||||
|
|||||||
@@ -29,10 +29,11 @@ it('has a chat bubble icon', function () {
|
|||||||
expect($action->getIcon())->toBe('heroicon-o-chat-bubble-left-right');
|
expect($action->getIcon())->toBe('heroicon-o-chat-bubble-left-right');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has modal content configured', function () {
|
it('disables modal submit and cancel actions', function () {
|
||||||
$action = CommentsAction::make('comments');
|
$action = CommentsAction::make('comments');
|
||||||
|
|
||||||
expect($action->hasModalContent())->toBeTrue();
|
expect($action->getModalSubmitAction())->toBeFalsy()
|
||||||
|
->and($action->getModalCancelAction())->toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows badge with comment count when comments exist', function () {
|
it('shows badge with comment count when comments exist', function () {
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ it('configures as a slide-over', function () {
|
|||||||
expect($action->isModalSlideOver())->toBeTrue();
|
expect($action->isModalSlideOver())->toBeTrue();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has modal content configured', function () {
|
it('disables modal submit and cancel actions', function () {
|
||||||
$action = CommentsTableAction::make('comments');
|
$action = CommentsTableAction::make('comments');
|
||||||
|
|
||||||
expect($action->hasModalContent())->toBeTrue();
|
expect($action->getModalSubmitAction())->toBeFalsy()
|
||||||
|
->and($action->getModalCancelAction())->toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows badge with comment count for the record', function () {
|
it('shows badge with comment count for the record', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user