Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions assets/styles/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,16 @@ p.description { max-width: 60ch; text-wrap: balance; }
#dashboard .content-top { display: none; }
#regenerate-fixtures .content-top { display: none; }

.ea-locale-switcher {
padding-inline-start: var(--sidebar-menu-items-padding-left);
list-style: none;
}

.ea-locale-switcher .icon {
block-size: 16px;
color: var(--sidebar-menu-icon-color);
flex-shrink: 0;
inline-size: 1.25em;
margin-inline-end: 10px;
text-align: center;
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"symfony/web-link": "7.2.*",
"symfony/yaml": "7.2.*",
"twig/extra-bundle": "^2.12|^3.19",
"twig/intl-extra": "^3.22",
"twig/string-extra": "^3.22",
"twig/twig": "^2.12|^3.19"
},
"config": {
Expand Down
137 changes: 134 additions & 3 deletions composer.lock

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

1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
app.supported_locales: 'en|fr'

services:
# default configuration for services in *this* file
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;

#[AdminDashboard(routePath: '/admin', routeName: 'admin')]
#[AdminDashboard(routePath: '/{_locale<%app.supported_locales%>}/admin', routeName: 'admin')]
class DashboardController extends AbstractDashboardController
{
public function index(): Response
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/FixturesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class FixturesController extends AbstractController
{
#[Route('/admin/regenerate-fixtures', name: 'admin_regenerate_fixtures', methods: ['GET', 'POST'])]
#[Route('/{_locale<%app.supported_locales%>}/admin/regenerate-fixtures', name: 'admin_regenerate_fixtures', methods: ['GET', 'POST'])]
public function regenerateFixtures(Request $request, KernelInterface $kernel): Response
{
if ('POST' === $request->getMethod()) {
Expand Down
8 changes: 7 additions & 1 deletion src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@

final class DefaultController extends AbstractController
{
#[Route('/', name: 'homepage')]
#[Route('/{_locale<%app.supported_locales%>}/', name: 'homepage')]
public function index(): Response
{
return $this->redirectToRoute('admin');
}

#[Route('/')]
public function indexNoLocale(): Response
{
return $this->redirectToRoute('homepage', ['_locale' => 'en']);
}
}
9 changes: 9 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"doctrine/deprecations": {
"version": "1.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "87424683adc81d7dc305eefec1fced883084aab9"
}
},
"doctrine/doctrine-bundle": {
"version": "2.13",
"recipe": {
Expand Down
7 changes: 2 additions & 5 deletions templates/admin/dashboard.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
{% block body_id 'dashboard' %}

{% block main %}
<h1 class="page-title">Welcome to the EasyAdmin Demo project!</h1>
<h1 class="page-title">{{ 'admin.dashboard.page_title'|trans }}</h1>

<p class="description">
This is a demo project to show you how the EasyAdmin bundle works.
Use the sidebar links to navigate through the demo application.
</p>
<p class="description">{{ 'admin.dashboard.description'|trans }}</p>
{% endblock %}
15 changes: 4 additions & 11 deletions templates/admin/regenerate_fixtures.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@
{% block body_id 'regenerate-fixtures' %}

{% block main %}
<h1 class="page-title">Regenerate the fixtures data used in this project</h1>
<h1 class="page-title">{{ 'admin.regenerate_fixtures.page_title'|trans }}</h1>

<p class="description">
This demo project includes some pre-generated fixtures so you can start
using it immediately.
</p>
<p class="description">{{ 'admin.regenerate_fixtures.description'|trans }}</p>

<p class="description">
We use <a target="_blank" href="https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html">Foundry</a>,
which makes creating fixtures in Symfony applications fun again.
If you want, you can regenerate the fixtures data by clicking the button below.
</p>
<p class="description">{{ 'admin.regenerate_fixtures.description_bis'|trans|raw }}</p>

<form method="post" action="{{ path('admin_regenerate_fixtures') }}">
<button type="submit" class="btn btn-primary">Regenerate Fixtures</button>
<button type="submit" class="btn btn-primary">{{ 'admin.regenerate_fixtures.submit_button'|trans|raw }}</button>
</form>
{% endblock %}
Loading