Skip to content

Commit

Permalink
Merge pull request #307 from DissNik/2.0-fields
Browse files Browse the repository at this point in the history
2.0 fields
  • Loading branch information
DissNik authored Nov 13, 2023
2 parents 60d8ed8 + eac4b3a commit cc97c3f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
Binary file added public/video/moon_shine_logo_2.mp4
Binary file not shown.
40 changes: 39 additions & 1 deletion resources/views/pages/ru/fields/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
['url' => '#searchable', 'label' => 'Поиск'],
['url' => '#async', 'label' => 'Асинхронный поиск'],
['url' => '#update-on-preview', 'label' => 'Редактирование в preview'],
['url' => '#with-image', 'label' => 'Значения с изображением'],
]
]"
>
Expand Down Expand Up @@ -218,7 +219,7 @@ public function fields(): array
<x-p>
У поля <em>Select</em> так же можно организовать асинхронный поиск.
Для это необходимо методу <code>async()</code> передать <em>url</em>,
на который будет отправляться запрос с <em>query</em> параметром для поиск.
на который будет отправляться запрос с <em>query</em> параметром для поиска.
</x-p>

<x-code language="php">
Expand Down Expand Up @@ -265,4 +266,41 @@ public function fields(): array

@include('pages.ru.fields.shared.update_on_preview', ['field' => 'Select'])

<x-sub-title id="with-image">Значения с изображением</x-sub-title>

<x-p>
Метод <code>optionProperties()</code> позволяет добавить изображение к значению.
</x-p>

<x-code language="php">
optionProperties(Closure|array $data)
</x-code>

<x-code language="php">
use MoonShine\Fields\Select;

//...

public function fields(): array
{
return [
Select::make('Country', 'country_id')
->options([
1 => 'Andorra',
2 => 'United Arab Emirates',
//...
])->optionProperties(fn() => [
1 => ['image' => '{{ config('app.url') }}/images/ad.png'],
2 => ['image' => '{{ config('app.url') }}/images/ae.png'],
//...
]) // [tl! focus:-4]
];
}

//...
</x-code>

<x-image theme="light" src="{{ asset('screenshots/belongs_to_image.png') }}"></x-image>
<x-image theme="dark" src="{{ asset('screenshots/belongs_to_image_dark.png') }}"></x-image>

</x-page>
8 changes: 6 additions & 2 deletions resources/views/pages/ru/home.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<x-page title="MoonShine">
<x-image theme="light" src="{{ asset('images/home.png') }}"></x-image>
<x-image theme="dark" src="{{ asset('images/home.png') }}"></x-image>

<div style="max-width: 1440px">
<video load="lazy" class="how-it-works-preview-video" autoplay muted preload="auto" playsinline>
<source src="/video/moon_shine_logo_2.mp4" type="video/mp4" />
</video>
</div>

<x-sub-title>Привет пользователь Laravel!</x-sub-title>

Expand Down

0 comments on commit cc97c3f

Please sign in to comment.