diff --git a/src/Controller/ProfilController.php b/src/Controller/ProfilController.php index 2322baa..fbff2b5 100644 --- a/src/Controller/ProfilController.php +++ b/src/Controller/ProfilController.php @@ -20,8 +20,10 @@ class ProfilController extends AbstractController public function profil(int $id): Response { $profil = $this->mgr->find(Profil::class, $id); + $posts = $profil->getPosts(); return $this->render('profil/index.html.twig', [ - 'profil' => $profil + 'profil' => $profil, + 'posts' => $posts ]); } @@ -30,7 +32,7 @@ class ProfilController extends AbstractController { $profil = $this->mgr->find(Profil::class, $id); if ($profil instanceof Profil) { - $this->curentUser->addFollowing($profil); + $profil->addFollower($this->curentUser); return $this->render('profil/index.html.twig', [ ]); } else { diff --git a/templates/posts/post.detail.html.twig b/templates/posts/post.detail.html.twig new file mode 100644 index 0000000..0e86f85 --- /dev/null +++ b/templates/posts/post.detail.html.twig @@ -0,0 +1,70 @@ +{# templates/post/show.html.twig #} + +{% extends 'base.html.twig' %} + +{% block title %}Post - {{ post.title }}{% endblock %} + +{% block stylesheets %} + +{% endblock %} + +{% block body %} +
+

{{ post.profil.name }}

+

{{ post.title }}

+

{{ post.text }}

+
+ Up Votes: {{ post.upVote }} / Down Votes: {{ post.downVote }} +
+
+

Tags:

+ +
+
+

Commentaires:

+ {% for commentary in post.commentaries %} +
+
{{ commentary.profil.name }}
+
{{ commentary.text }}
+
+ {% endfor %} +
+
+{% endblock %} diff --git a/templates/profil/index.html.twig b/templates/profil/index.html.twig index 834c16f..376aabb 100644 --- a/templates/profil/index.html.twig +++ b/templates/profil/index.html.twig @@ -21,6 +21,17 @@ +
+

Posts

+ {% if posts|length > 0 %} + + {% endif %} +
+