Note not found
This commit is contained in:
@@ -44,6 +44,7 @@ class GuiController extends AbstractController {
|
|||||||
'title' => 'Joe Carstairs\' notes',
|
'title' => 'Joe Carstairs\' notes',
|
||||||
'description' => 'Joe Carstairs\' notes',
|
'description' => 'Joe Carstairs\' notes',
|
||||||
'note' => $note,
|
'note' => $note,
|
||||||
|
'slug' => $slug,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ class GuiController extends AbstractController {
|
|||||||
$entityManager->persist($note);
|
$entityManager->persist($note);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
return $this->redirectToRoute('note', ['slug' => $note->getSlug()]);
|
return $this->redirectToRoute('note', ['slug' => $slug]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('/write_note.html.twig', [
|
return $this->render('/write_note.html.twig', [
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section>
|
{% if note %}
|
||||||
<h1>Note</h1>
|
<section>
|
||||||
<time>{{ note.getPublishedDate().format('c') }}
|
<h1>Note {{ note.slug }}</h1>
|
||||||
<p>{{ note.content }}</p>
|
<time>{{ note.publishedDate.format('c') }}
|
||||||
</section>
|
<p>{{ note.content }}</p>
|
||||||
|
</section>
|
||||||
|
{% else %}
|
||||||
|
<section>
|
||||||
|
<h1>Note not found</h1>
|
||||||
|
<p>I don't have a note '{{ slug }}'.</p>
|
||||||
|
<p>Go back to <a href="/notes">Notes</a>.</p>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user