Update interface (#17)
continuous-integration/drone/push Build is passing Details

Co-authored-by: bastien ollier <bastien.ollier@etu.uca.fr>
Reviewed-on: #17
Reviewed-by: Clément FRÉVILLE <clement.freville2@etu.uca.fr>
Co-authored-by: Bastien OLLIER <bastien.ollier@noreply.codefirst.iut.uca.fr>
Co-committed-by: Bastien OLLIER <bastien.ollier@noreply.codefirst.iut.uca.fr>
pull/18/head
Bastien OLLIER 5 months ago committed by Clément FRÉVILLE
parent bc6951d0a5
commit 0beb0cd95f

@ -34,16 +34,13 @@ class PostController extends AbstractController
]);
}
#[Route('/post', name: 'app_post_index', methods: ['GET'])]
#[Route('/posts', name: 'app_post_index', methods: ['GET'])]
public function table(PostRepository $repository): Response
{
$posts = $repository->findAll();
return $this->render('post/table.html.twig', [
'posts' => $posts,
]);
return $this->redirectToRoute('app_posts', [], Response::HTTP_SEE_OTHER);
}
#[Route('/post/new', name: 'app_post_new', methods: ['GET', 'POST'])]
#[Route('/posts/new', name: 'app_post_new', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_USER')]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
@ -64,7 +61,7 @@ class PostController extends AbstractController
]);
}
#[Route('/post/{id}', name: 'app_post_show', methods: ['GET'])]
#[Route('/posts/{id}', name: 'app_post_show', methods: ['GET'])]
public function show(Post $post): Response
{
$form = $this->createForm(CommentType::class, new Comment(), [
@ -76,7 +73,7 @@ class PostController extends AbstractController
]);
}
#[Route('/post/{id}/edit', name: 'app_post_edit', methods: ['GET', 'POST'])]
#[Route('/posts/{id}/edit', name: 'app_post_edit', methods: ['GET', 'POST'])]
#[IsGranted('ROLE_USER')]
public function edit(Request $request, Post $post, EntityManagerInterface $entityManager): Response
{
@ -95,7 +92,7 @@ class PostController extends AbstractController
]);
}
#[Route('/post/{id}', name: 'app_post_delete', methods: ['POST'])]
#[Route('/posts/{id}', name: 'app_post_delete', methods: ['POST'])]
#[IsGranted('ROLE_USER')]
public function delete(Request $request, Post $post, EntityManagerInterface $entityManager): Response
{
@ -107,7 +104,7 @@ class PostController extends AbstractController
return $this->redirectToRoute('app_posts', [], Response::HTTP_SEE_OTHER);
}
#[Route('/post/{id}/comment', name: 'app_post_comment', methods: ['POST'])]
#[Route('/posts/{id}/comment', name: 'app_post_comment', methods: ['POST'])]
public function publishComment(Request $request, Post $post, EntityManagerInterface $entityManager, #[CurrentUser] User $user): Response
{
$comment = new Comment();

@ -18,7 +18,7 @@ class SpeciesController extends AbstractController
#[Route('/', name: 'app_species_index', methods: ['GET'])]
public function table(SpeciesRepository $speciesRepository): Response
{
return $this->render('species/table.html.twig', [
return $this->render('species/index.html.twig', [
'species' => $speciesRepository->findAll(),
]);
}

@ -15,7 +15,28 @@
<body data-turbo="false">
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="{{ path('app_species_index') }}">Herbarium</a>
<a class="navbar-brand" href="{{ path('app_posts') }}">Herbarium</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{{ path('app_posts') }}">{{ 'posts'|trans }}</a>
</li>
{% if app.user %}
<li class="nav-item">
<a class="nav-link" href="{{ path('app_post_new') }}">{{ 'create_new_post'|trans }}</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="{{ path('app_species_index') }}">{{ 'species'|trans }}</a>
</li>
{% if app.user %}
<li class="nav-item">
<a class="nav-link" href="{{ path('app_species_new') }}">{{ 'create_new_species'|trans }}</a>
</li>
{% endif %}
</ul>
</div>
<div class="navbar-nav ms-auto">
<a class="nav-link" href="{{ path('app_setting_locale', { 'locale': 'en' }) }}">English</a>
<a class="nav-link" href="{{ path('app_setting_locale', { 'locale': 'fr' }) }}">Français</a>

@ -6,7 +6,7 @@
<h1>{{ 'edit_post'|trans }}</h1>
{{ include('post/_form.html.twig', {'button_label': 'update'|trans}) }}
<a href="{{ path('app_post_index') }}">{{ 'back_to_list'|trans }}</a>
<a class="btn btn-warning mb-4 mt-4" href="{{ path('app_post_index') }}">{{ 'back_to_list'|trans }}</a>
{{ include('post/_delete_form.html.twig') }}
{% endblock %}

@ -7,5 +7,5 @@
{{ include('post/_form.html.twig') }}
<a href="{{ path('app_post_index') }}">{{ 'back_to_list'|trans }}</a>
<a class="btn btn-warning mb-4 mt-4" href="{{ path('app_post_index') }}">{{ 'back_to_list'|trans }}</a>
{% endblock %}

@ -44,9 +44,9 @@
</tbody>
</table>
<a href="{{ path('app_post_index') }}">{{ 'back_to_list'|trans }}</a>
<a class="btn btn-warning mb-4 mt-4" href="{{ path('app_post_index') }}">{{ 'back_to_list'|trans }}</a>
<a href="{{ path('app_post_edit', {'id': post.id}) }}">{{ 'edit'|trans }}</a>
<a class="btn btn-success mb-4 mt-4" href="{{ path('app_post_edit', {'id': post.id}) }}">{{ 'edit'|trans }}</a>
{{ include('post/_delete_form.html.twig') }}

@ -30,7 +30,7 @@
<td>{{ post.commentary }}</td>
<td>
<a href="{{ path('app_post_show', {'id': post.id}) }}">{{ 'show'|trans }}</a>
<a href="{{ path('app_post_edit', {'id': post.id}) }}">{{ 'edit'|trans }}</a>
<a class="btn btn-success mb-4 mt-4" href="{{ path('app_post_edit', {'id': post.id}) }}">{{ 'edit'|trans }}</a>
</td>
</tr>
{% else %}

@ -1,4 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('save'|trans) }}</button>
<button class="btn btn-primary">{{ button_label|default('save'|trans) }}</button>
{{ form_end(form) }}

@ -6,7 +6,7 @@
<h1>{{ 'edit_species'|trans }}</h1>
{{ include('species/_form.html.twig', {'button_label': 'update'|trans}) }}
<a href="{{ path('app_species_index') }}">{{ 'back_to_list'|trans }}</a>
<a class="btn btn-warning mb-4 mt-4" href="{{ path('app_species_index') }}">{{ 'back_to_list'|trans }}</a>
{{ include('species/_delete_form.html.twig') }}
{% endblock %}

@ -7,5 +7,5 @@
{{ include('species/_form.html.twig') }}
<a href="{{ path('app_species_index') }}">{{ 'back_to_list'|trans }}</a>
<a class="btn btn-warning mb-4 mt-4" href="{{ path('app_species_index') }}">{{ 'back_to_list'|trans }}</a>
{% endblock %}

@ -27,9 +27,9 @@
</div>
{% endfor %}
<a href="{{ path('app_species_index') }}">{{ 'back_to_list'|trans }}</a>
<a class="btn btn-warning mb-4 mt-4" href="{{ path('app_species_index') }}">{{ 'back_to_list'|trans }}</a>
<a href="{{ path('app_species_edit', {'id': species.id}) }}">{{ 'edit'|trans }}</a>
<a class="btn btn-success mb-4 mt-4" href="{{ path('app_species_edit', {'id': species.id}) }}">{{ 'edit'|trans }}</a>
{{ include('species/_delete_form.html.twig') }}
</div>

@ -15,7 +15,7 @@ class PostControllerTest extends WebTestCase
private KernelBrowser $client;
private EntityManagerInterface $manager;
private PostRepository $repository;
private string $path = '/post/';
private string $path = '/posts/';
protected function setUp(): void
{
@ -40,10 +40,10 @@ class PostControllerTest extends WebTestCase
public function testIndex(): void
{
$crawler = $this->client->request('GET', '/post');
$crawler = $this->client->request('GET', '/');
self::assertResponseStatusCodeSame(200);
self::assertPageTitleContains('Post index');
self::assertPageTitleContains('Posts');
// Use the $crawler to perform additional assertions e.g.
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());

@ -42,7 +42,7 @@ class SpeciesControllerTest extends WebTestCase
$crawler = $this->client->request('GET', $this->path);
self::assertResponseStatusCodeSame(200);
self::assertPageTitleContains('Species index');
self::assertPageTitleContains('Species');
// Use the $crawler to perform additional assertions e.g.
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());

@ -31,7 +31,7 @@
</trans-unit>
<trans-unit id="qO7xvGM" resname="create_new_post">
<source>create_new_post</source>
<target>Création d'une nouvelle publication</target>
<target>Créer une nouvelle publication</target>
</trans-unit>
<trans-unit id="6tlp1bV" resname="back_to_list">
<source>back_to_list</source>

Loading…
Cancel
Save