Skip to content

Commit

Permalink
fix: Modal assets
Browse files Browse the repository at this point in the history
Issue #1468
  • Loading branch information
lee-to committed Jan 14, 2025
1 parent 85e6e55 commit af9cd7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Laravel/src/Buttons/CreateButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public static function for(
$action = $resource->getFormPageUrl();

if ($resource->isCreateInModal()) {
// required to create field entities and load assets
$resource->getFormFields();

$action = $resource->getFormPageUrl(
params: [
'_component_name' => $componentName ?? $resource->getListComponentName(),
Expand Down
5 changes: 5 additions & 0 deletions src/Laravel/src/Buttons/EditButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public static function for(

$action = static fn (mixed $item, ?DataWrapperContract $data): string => $resource->getFormPageUrl($data?->getKey());

// required to create field entities and load assets
if(!$resource->isCreateInModal() && $resource->isEditInModal()) {
$resource->getFormFields();
}

if ($resource->isEditInModal()) {
$action = static fn (mixed $item, ?DataWrapperContract $data): string => $resource->getFormPageUrl(
$data?->getKey(),
Expand Down
2 changes: 2 additions & 0 deletions src/UI/resources/views/components/layout/assets.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
@stack('styles')

{!! $colors !!}
@fragment('moonshine-assets')
{!! $assets !!}
@endfragment

{{ $slot ?? '' }}

Expand Down

0 comments on commit af9cd7e

Please sign in to comment.