Skip to content

Commit

Permalink
[Docs] Init Bootstrap admin ui getting started (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 authored Nov 14, 2024
2 parents 4de96ae + 392b31a commit fb07717
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/admin-ui/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ composer require sylius/admin-ui

## Minimalist templates

All these following templates are kind of "empty".

You can install the optional [BootstrapAdminUi package](../bootstrap-admin-ui/getting-started.md) to configure their contents automatically.

### Crud templates

- crud/create.html.twig
Expand Down
88 changes: 88 additions & 0 deletions docs/bootstrap-admin-ui/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,98 @@ description: >-

# Getting started

This package configures content of the [AdminUi package](../admin-ui/getting-started.md) templates.

## Installation

Install the package using Composer and Symfony Flex:

```bash
composer require sylius/bootstrap-admin-ui
```

## Configuring the CRUD templates

Content of CRUD templates is split into configurable blocks.

You are able to add new blocks, disable existing ones, or reorder them using the [TwigExtra package](../twig-extra/getting-started.md).

### Create

This package configures content of the template to create a new resource.

This adds configurable blocks into the `@SyliusAdminUi/crud/create.html.twig` template.

**Overview of the blocks**

```mermaid
flowchart LR
Template(Create template) --> Hook{Hook 'create'}
Hook --> Sidebar([Sidebar])
Hook --> Navbar([Navbar])
Hook --> Content([Content])
Content --> HookContent{Hook 'content'}
HookContent --> Flashes([Flashes])
HookContent --> Header([Header])
HookContent --> FormErrorAlert([Form Error Alert])
HookContent --> Form([Form])
```

**Overview of the block templates**

```mermaid
flowchart LR
Template(@SyliusAdminUi/crud/create.html.twig) --> Hook{Hook 'create'}
Hook --> Sidebar([@SyliusBootstrapAdminUi/shared/crud/common/sidebar.html.twig])
Hook --> Navbar([@SyliusBootstrapAdminUi/shared/crud/common/navbar.html.twig])
Hook --> Content([@SyliusBootstrapAdminUi/shared/crud/common/content.html.twig])
```

### Index

This package configures content of the template to list resources.

This adds configurable blocks into the `@SyliusAdminUi/crud/index.html.twig` template.

**Overview of the blocks**

```mermaid
flowchart LR
Template(Index template) --> Hook{Hook 'index'}
Hook --> Sidebar([Sidebar])
Hook --> Navbar([Navbar])
Hook --> Content([Content])
Content --> HookContent{Hook 'content'}
HookContent --> Flashes([Flashes])
HookContent --> Header([Header])
HookContent --> Grid([Grid])
```

### Show

This package configures content of the template to show resource details.

This adds configurable blocks into the `@SyliusAdminUi/crud/show.html.twig` template.

**Overview of the blocks**

```mermaid
flowchart LR
Template(Show template) --> Hook{Hook 'show'}
Hook --> Sidebar([Sidebar])
Hook --> Navbar([Navbar])
Hook --> Content([Content])
Content --> HookContent{Hook 'content'}
HookContent --> Flashes([Flashes])
HookContent --> Header([Header])
```
5 changes: 2 additions & 3 deletions docs/cookbook/admin_panel/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,17 @@ return static function (ContainerConfigurator $containerConfigurator): void {
You should decorate the `sylius_admin_ui.knp.menu_builder` service to customize the admin menu.

```php
<?php

declare(strict_types=1);

namespace App\Menu;

use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Sylius\AdminUi\Knp\Menu\MenuBuilderInterface
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;

#[AsDecorator(decorates: 'sylius_admin_ui.knp.menu_builder')]
final readonly class MenuBuilder
final readonly class MenuBuilder implements MenuBuilderInterface
{
public function __construct(
private readonly FactoryInterface $factory,
Expand Down

0 comments on commit fb07717

Please sign in to comment.