Skip to content

Commit

Permalink
Change actionsView to actionsFromView (#1344)
Browse files Browse the repository at this point in the history
* Fix LazyChild data issue

* change actionsView to actionsFromView
  • Loading branch information
luanfreitasdev authored Jan 22, 2024
1 parent 5d3f2c1 commit fd0b56c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions resources/views/components/row.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
>
<div class="pg-actions">
@if(empty(data_get($row, 'actions')) && $column->isAction)
@if (method_exists($this, 'actionsView') && $actionView = $this->actionsView($row))
@if (method_exists($this, 'actionsFromView') && $actionsFromView = $this->actionsFromView($row))
<div wire:key="actions-view-{{ data_get($row, $primaryKey) }}">
{!! $actionView !!}
{!! $actionsFromView !!}
</div>
@endif
@endif
Expand Down
6 changes: 3 additions & 3 deletions src/Livewire/LazyChild.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public function afterToggleDetail(string $id, string $state): void
$this->dispatch($dispatchAfterToggleDetail, id: $id, state: $state ? 'true' : 'false')->to($parentComponent);
}

public function actionsView(mixed $row): ?View
public function actionsFromView(mixed $row): ?View
{
/** @var string $parentComponent */
$parentComponent = app(ComponentRegistry::class)->getClass($this->parentName);

if (method_exists($parentComponent, 'actionsView')) {
return app($parentComponent)->actionsView($row);
if (method_exists($parentComponent, 'actionsFromView')) {
return app($parentComponent)->actionsFromView($row);
}

return null;
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ActionsViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public function columns(): array
];
}

public function actionsView($row)
public function actionsFromView($row)
{
return view('livewire-powergrid::tests.actions-view', compact('row'));
}
};

it('can render actionsView property', function (string $component, object $params) {
it('can render actionsFromView property', function (string $component, object $params) {
livewire($component)
->call($params->theme)
->assertSeeInOrder([
Expand Down

0 comments on commit fd0b56c

Please sign in to comment.