-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #446 from DissNik/2.0
docs(fields): HiddenIds
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<x-page | ||
title="HiddenIds" | ||
:sectionMenu="[ | ||
'Разделы' => [ | ||
['url' => '#make', 'label' => 'Make'], | ||
['url' => '#use', 'label' => 'Use'], | ||
] | ||
]" | ||
> | ||
|
||
<x-p> | ||
The <em>HiddenIds</em> field is used to pass the primary key of the selected elements. | ||
</x-p> | ||
|
||
<x-sub-title id="make">Make</x-sub-title> | ||
|
||
<x-p> | ||
The <code>make()</code> method takes the name of the component as a parameter. | ||
</x-p> | ||
|
||
<x-code language="php"> | ||
HiddenIds::make('index-table') | ||
</x-code> | ||
|
||
<x-sub-title id="use">Use</x-sub-title> | ||
|
||
<x-code language="php"> | ||
use MoonShine\Components\FlexibleRender; | ||
use MoonShine\ActionButtons\ActionButton; | ||
use MoonShine\Fields\HiddenIds; // [tl! focus] | ||
|
||
//... | ||
|
||
public function buttons(): array | ||
{ | ||
return [ | ||
ActionButton::make('Active', route('moonshine.posts.mass-active', $this->uriKey())) | ||
->inModal(fn () => 'Active', fn (): string => (string) form( | ||
route('moonshine.posts.mass-active', $this->uriKey()), | ||
fields: [ | ||
HiddenIds::make($this->listComponentName()), // [tl! focus] | ||
FlexibleRender::make(__('moonshine::ui.confirm_message')), | ||
] | ||
) | ||
->async() | ||
->submit('Active', ['class' => 'btn-secondary'])) | ||
->bulk(), | ||
]; | ||
} | ||
|
||
//... | ||
</x-code> | ||
|
||
</x-page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<x-page | ||
title="HiddenIds" | ||
:sectionMenu="[ | ||
'Разделы' => [ | ||
['url' => '#make', 'label' => 'Make'], | ||
['url' => '#use', 'label' => 'Применение'], | ||
] | ||
]" | ||
> | ||
|
||
<x-p> | ||
Поле <em>HiddenIds</em> используется для передачи primary key выбранных элементов. | ||
</x-p> | ||
|
||
<x-sub-title id="make">Make</x-sub-title> | ||
|
||
<x-p> | ||
В качестве параметра метод <code>make()</code> принимает название компонента. | ||
</x-p> | ||
|
||
<x-code language="php"> | ||
HiddenIds::make('index-table') | ||
</x-code> | ||
|
||
<x-sub-title id="use">Применение</x-sub-title> | ||
|
||
<x-code language="php"> | ||
use MoonShine\Components\FlexibleRender; | ||
use MoonShine\ActionButtons\ActionButton; | ||
use MoonShine\Fields\HiddenIds; // [tl! focus] | ||
|
||
//... | ||
|
||
public function buttons(): array | ||
{ | ||
return [ | ||
ActionButton::make('Active', route('moonshine.posts.mass-active', $this->uriKey())) | ||
->inModal(fn () => 'Active', fn (): string => (string) form( | ||
route('moonshine.posts.mass-active', $this->uriKey()), | ||
fields: [ | ||
HiddenIds::make($this->listComponentName()), // [tl! focus] | ||
FlexibleRender::make(__('moonshine::ui.confirm_message')), | ||
] | ||
) | ||
->async() | ||
->submit('Active', ['class' => 'btn-secondary'])) | ||
->bulk(), | ||
]; | ||
} | ||
|
||
//... | ||
</x-code> | ||
|
||
</x-page> |