Skip to content

Commit

Permalink
Merge pull request #529 from DissNik/release-2.20
Browse files Browse the repository at this point in the history
Release 2.20
  • Loading branch information
DissNik authored Aug 13, 2024
2 parents 20c4391 + 264fa61 commit 9ebb115
Show file tree
Hide file tree
Showing 21 changed files with 743 additions and 22 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
'Textarea:_divider_',
['slug' => 'fields-textarea', 'label' => 'Textarea'],
['slug' => 'fields-code', 'label' => 'Code'],
['slug' => 'fields-markdown', 'label' => 'Markdown', 'badge' => 'new'],
['slug' => 'fields-markdown', 'label' => 'Markdown'],
['slug' => 'fields-tinymce', 'label' => 'TinyMce'],

// Select
Expand Down
Binary file added public/screenshots/belongs_to_creatable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screenshots/belongs_to_creatable_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screenshots/horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screenshots/horizontal_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions public/vendor/moonshine/assets/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/vendor/moonshine/assets/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/vendor/moonshine/assets/minimalistic.css

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions resources/views/pages/en/advanced/table_builder.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
['url' => '#creatable', 'label' => 'Adding entries'],
['url' => '#editable', 'label' => 'Editable'],
['url' => '#sortable', 'label' => 'Sortable'],
['url' => '#column-display', 'label' => 'Column display'],
]
]"
>
Expand Down Expand Up @@ -566,4 +567,67 @@ function(
])
!!}

<x-sub-title id="column-display">Column display</x-sub-title>

<x-p>
You can let users decide which columns to display in the table,
saving the choice. To do this, you need to set the resource parameter <code>$columnSelection</code>.
</x-p>

<x-code language="php">
columnSelection(string $uniqueId = '')
</x-code>

<x-ul>
<li><code>$uniqueId</code> - unique table Id to save the selection of displayed columns.</li>
</x-ul>

<x-code language="php">
TableBuilder::make()
->fields([
Text::make('Title'),
Text::make('Text')
])
->columnSelection('unique-id')
</x-code>

{!!
table(items: [['title' => 'Value 1', 'text' => 'Value 2'], ['title' => 'Value 3', 'text' => 'Value 4']])
->sortable()
->fields([
Text::make('Title'),
Text::make('Text')
])
->columnSelection('unique-id')
!!}

<x-p>
If you need to exclude fields from selection, use the <code>columnSelection()</code> method.
</x-p>

<x-code language="php">
public function columnSelection(bool $active = true)
</x-code>

<x-code>
TableBuilder::make()
->fields([
Text::make('Title')
->columnSelection(false),
Text::make('Text')
])
->columnSelection('unique-id')
</x-code>

{!!
table(items: [['title' => 'Value 1', 'text' => 'Value 2'], ['title' => 'Value 3', 'text' => 'Value 4']])
->sortable()
->fields([
Text::make('Title')
->columnSelection(false),
Text::make('Text')
])
->columnSelection('unique-id')
!!}

</x-page>
5 changes: 5 additions & 0 deletions resources/views/pages/en/fields/belongs_to.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
['url' => '#default', 'label' => 'Default value'],
['url' => '#nullable', 'label' => 'Nullable'],
['url' => '#placeholder', 'label' => 'Placeholder'],
['url' => '#creatable', 'label' => 'Creating a Relationship Object'],
['url' => '#searchable', 'label' => 'Finding values'],
['url' => '#values-query', 'label' => 'Query for values'],
['url' => '#async-search', 'label' => 'Asynchronous search'],
Expand Down Expand Up @@ -125,6 +126,10 @@ public function fields(): array
//...
</x-code>

<x-sub-title id="creatable">Creating a Relationship Object</x-sub-title>

@include('pages.en.fields.shared.relation_creatable', ['field' => 'BelongsTo', 'label' => 'Author'])

@include('pages.en.fields.shared.values_query', ['field' => 'BelongsTo'])

@include('pages.en.fields.shared.async_search', ['field' => 'BelongsTo'])
Expand Down
28 changes: 28 additions & 0 deletions resources/views/pages/en/fields/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
['url' => '#nullable', 'label' => 'Nullable'],
['url' => '#sortable', 'label' => 'Sorting'],
['url' => '#badge', 'label' => 'Badge'],
['url' => '#horizontal', 'label' => 'Horizontal'],
['url' => '#hide-show', 'label' => 'Display'],
['url' => '#show-when', 'label' => 'Dynamic display'],
['url' => '#custom-view', 'label' => 'Changing the display'],
Expand Down Expand Up @@ -390,6 +391,33 @@ public function fields(): array
//...
</x-code>

<x-sub-title id="horizontal">Horizontal display</x-sub-title>

<x-p>
The <code>horizontal()</code> method allows you to display the title and field horizontally.
</x-p>

<x-code language="php">
horizontal()
</x-code>

<x-code language="php">
//...

public function fields(): array
{
return [
Text::make('Title')
->horizontal(), // [tl! focus]
];
}

//...
</x-code>

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

<x-sub-title id="hide-show">Display</x-sub-title>

<x-p>
Expand Down
76 changes: 76 additions & 0 deletions resources/views/pages/en/fields/markdown.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<x-page
title="Markdown"
:sectionMenu="[
'Sections' => [
['url' => '#basics', 'label' => 'Basics'],
['url' => '#toolbar', 'label' => 'Toolbar'],
['url' => '#options', 'label' => 'Options'],
['url' => '#global-configuration', 'label' => 'Global configuration'],
]
]"
>

<x-extendby :href="to_page('fields-textarea')">
Textarea
</x-extendby>

<x-sub-title id="basics">Basics</x-sub-title>

<x-p>
<b><em>Markdown</em></b> a lightweight markup language designed to indicate formatting in plain text, while maximizing its human readability.
</x-p>
Expand Down Expand Up @@ -36,4 +46,70 @@ public function fields(): array
</x-moonshine::column>
</x-moonshine::grid>

<x-sub-title id="toolbar">Toolbar</x-sub-title>

<x-p>
The <code>toolbar()</code> method allows you to change the toolbar.
</x-p>

<x-code language="php">
toolbar(string|bool|array $value)
</x-code>

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

//...

Markdown::make('Description')
->toolbar(['bold', 'italic', 'strikethrough', 'code', 'quote', 'horizontal-rule']) // [tl! focus]
</x-code>

<x-sub-title id="options">Options</x-sub-title>

<x-p>
The <code>addOption()</code> method allows you to add or change options for the markdown editor.
</x-p>

<x-code language="php">
addOption(string $name, string|int|float|bool|array $value)
</x-code>

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

//...

Markdown::make('Description')
->addOption('toolbar', ['bold', 'italic', 'strikethrough', 'code', 'quote', 'horizontal-rule']) // [tl! focus]
</x-code>

<x-sub-title id="global-configuration">Global configuration</x-sub-title>

<x-p>
If you need to change settings for the editor globally,
you can use the static method <code>setDefaultOption()</code>.
</x-p>

<x-code language="php">
setDefaultOption(string $name, string|int|float|bool|array $value)
</x-code>

<x-code language="php">
namespace App\Providers;

use MoonShine\Fields\Markdown;
use MoonShine\Providers\MoonShineApplicationServiceProvider;

class MoonShineServiceProvider extends MoonShineApplicationServiceProvider
{
public function boot(): void
{
parent::boot();

Markdown::setDefaultOption('toolbar', ['bold', 'italic', 'strikethrough', 'code', 'quote']); // [tl! focus]
}
}
</x-code>

</x-page>
Loading

0 comments on commit 9ebb115

Please sign in to comment.