Skip to content

Commit

Permalink
Merge pull request #446 from DissNik/2.0
Browse files Browse the repository at this point in the history
docs(fields): HiddenIds
  • Loading branch information
DissNik authored Apr 21, 2024
2 parents ba8a0d3 + 3fc2099 commit 41ef666
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
['slug' => 'fields-morph_to_many', 'label' => 'MorphToMany'],

'Other:_divider_',
['slug' => 'fields-hidden_ids', 'label' => 'HiddenIds'],
['slug' => 'fields-preview', 'label' => 'Preview'],
['slug' => 'fields-position', 'label' => 'Position'],
['slug' => 'fields-stack_fields', 'label' => 'StackFields'],
Expand Down
54 changes: 54 additions & 0 deletions resources/views/pages/en/fields/hidden_ids.blade.php
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>
54 changes: 54 additions & 0 deletions resources/views/pages/ru/fields/hidden_ids.blade.php
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>

0 comments on commit 41ef666

Please sign in to comment.