Ugly profile but fonctionnal

pull/16/head
Corentin RICHARD 10 months ago
parent f9840c159c
commit 84bdfa0418

@ -20,8 +20,10 @@ class ProfilController extends AbstractController
public function profil(int $id): Response public function profil(int $id): Response
{ {
$profil = $this->mgr->find(Profil::class, $id); $profil = $this->mgr->find(Profil::class, $id);
$posts = $profil->getPosts();
return $this->render('profil/index.html.twig', [ 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); $profil = $this->mgr->find(Profil::class, $id);
if ($profil instanceof Profil) { if ($profil instanceof Profil) {
$this->curentUser->addFollowing($profil); $profil->addFollower($this->curentUser);
return $this->render('profil/index.html.twig', [ return $this->render('profil/index.html.twig', [
]); ]);
} else { } else {

@ -0,0 +1,70 @@
{# templates/post/show.html.twig #}
{% extends 'base.html.twig' %}
{% block title %}Post - {{ post.title }}{% endblock %}
{% block stylesheets %}
<style>
.post-container {
padding: 20px;
border-radius: 10px;
color: #fff;
}
.profile-name {
font-size: 1.5em;
}
.post-title {
font-size: 2em;
margin: 10px 0;
}
.post-text {
font-size: 1.2em;
margin-bottom: 20px;
}
.votes {
margin-bottom: 20px;
}
.tags {
margin-bottom: 20px;
}
.commentary {
background-color: #f0f0f0;
padding: 10px;
border-radius: 5px;
margin-bottom: 10px;
}
.commentary-author {
font-weight: bold;
}
</style>
{% endblock %}
{% block body %}
<div class="post-container" style="background-color: {{ post.isDream ? '#bda3b6' : '#1a2c4c' }}">
<h3 class="profile-name">{{ post.profil.name }}</h3>
<h2 class="post-title">{{ post.title }}</h2>
<p class="post-text">{{ post.text }}</p>
<div class="votes">
<span>Up Votes: {{ post.upVote }}</span> / <span>Down Votes: {{ post.downVote }}</span>
</div>
<div class="tags">
<h4>Tags:</h4>
<ul>
{% for tag in post.tags %}
<li>{{ tag.name }}</li>
{% endfor %}
</ul>
</div>
<div class="commentaries">
<h4>Commentaires:</h4>
{% for commentary in post.commentaries %}
<div class="commentary">
<div class="commentary-author">{{ commentary.profil.name }}</div>
<div class="commentary-text">{{ commentary.text }}</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

@ -21,6 +21,17 @@
<button class="follow-button" onclick="openPopup()">Follow</button> <button class="follow-button" onclick="openPopup()">Follow</button>
</div> </div>
<div class="posts-container">
<h1> Posts </h1>
{% if posts|length > 0 %}
<ul>
{% for post in posts %}
{% include 'posts/post.detail.html.twig' with {'post': post} %}
{% endfor %}
</ul>
{% endif %}
</div>
<!-- Pop-up Modal --> <!-- Pop-up Modal -->
<div id="followPopup" class="popup"> <div id="followPopup" class="popup">
<div class="popup-content"> <div class="popup-content">

Binary file not shown.
Loading…
Cancel
Save