Merge branch 'controllers' of https://codefirst.iut.uca.fr/git/Assasymfony/Fukafukashita into profilController

pull/16/head
Corentin RICHARD 10 months ago
commit b10d389d95

@ -43,6 +43,8 @@
"symfony/web-link": "7.0.7",
"symfony/yaml": "7.0.7",
"twig/extra-bundle": "^2.12|^3.0",
"twig/intl-extra": "^3.10",
"twig/string-extra": "^3.10",
"twig/twig": "^2.12|^3.0"
},
"config": {

133
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "23d2c64b5bd955feec6a3a3d7dd6a841",
"content-hash": "0428f7bdfb99fd81d09175f70a82db43",
"packages": [
{
"name": "composer/semver",
@ -7314,6 +7314,137 @@
],
"time": "2024-05-11T07:35:57+00:00"
},
{
"name": "twig/intl-extra",
"version": "v3.10.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/intl-extra.git",
"reference": "693f6beb8ca91fc6323e01b3addf983812f65c93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/intl-extra/zipball/693f6beb8ca91fc6323e01b3addf983812f65c93",
"reference": "693f6beb8ca91fc6323e01b3addf983812f65c93",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/intl": "^5.4|^6.4|^7.0",
"twig/twig": "^3.10"
},
"require-dev": {
"symfony/phpunit-bridge": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Twig\\Extra\\Intl\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
}
],
"description": "A Twig extension for Intl",
"homepage": "https://twig.symfony.com",
"keywords": [
"intl",
"twig"
],
"support": {
"source": "https://github.com/twigphp/intl-extra/tree/v3.10.0"
},
"funding": [
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"time": "2024-05-11T07:35:57+00:00"
},
{
"name": "twig/string-extra",
"version": "v3.10.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/string-extra.git",
"reference": "cd76ed8ae081bcd4fddf549e92e20c5df76c358a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/string-extra/zipball/cd76ed8ae081bcd4fddf549e92e20c5df76c358a",
"reference": "cd76ed8ae081bcd4fddf549e92e20c5df76c358a",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/string": "^5.4|^6.4|^7.0",
"symfony/translation-contracts": "^1.1|^2|^3",
"twig/twig": "^3.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Twig\\Extra\\String\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
}
],
"description": "A Twig extension for Symfony String",
"homepage": "https://twig.symfony.com",
"keywords": [
"html",
"string",
"twig",
"unicode"
],
"support": {
"source": "https://github.com/twigphp/string-extra/tree/v3.10.0"
},
"funding": [
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"time": "2024-05-11T07:35:57+00:00"
},
{
"name": "twig/twig",
"version": "v3.10.3",

@ -0,0 +1,34 @@
:root {
font-family: "Helvetica", 'Courier New', Courier, monospace;
}
#wrapper {
display: flex;
flex-direction: column;
gap: 1rem;
margin: 2em auto;
width: 70%;
>h1 {
color: white;
font-size: 3em;
margin-top: 0;
}
}
html {
--s: 257px;
/* control the size */
--c1: #38476b;
--c2: #bda3b6;
--_c: var(--c1) calc(100% - var(--s)/2) 99%, #0000;
--_g: var(--s), #0000 calc(99% - var(--s)/2), var(--_c);
background:
radial-gradient(var(--s) at 100% var(--_g)),
radial-gradient(calc(var(--s)/4) at 50% calc(100%/3), var(--_c)) var(--s) 0,
radial-gradient(var(--s) at 0% var(--_g)) 0 calc(3*var(--s)) var(--c2);
background-size:
calc(2*var(--s)) calc(9*var(--s)/4),
calc(2*var(--s)) calc(3*var(--s)/4);
}

@ -0,0 +1,24 @@
#post-wrapper {
background-color: #f2f2f7;
border: 3px solid black;
border-radius: 1rem;
padding: 20px;
}
#post-info {
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
}
#post {
h1 {
font-size: 1.5em;
}
p {
white-space: pre-wrap;
font-size: 1em;
}
}

@ -53,12 +53,12 @@ class PostController extends AbstractController
public function addPost(Request $request): Response
{
$post = new Post();
$form = $this->createForm(PostType::class, $post);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
//$dateNow = new DateTime();
$form = $form->getData();
$user = $this->getUser();
$post->setProfil($user);

@ -3,6 +3,7 @@
namespace App\Entity;
use App\Repository\PostRepository;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@ -24,6 +25,9 @@ class Post
#[ORM\Column]
private ?bool $isDream = null;
// #[ORM\Column()]
// private ?DateTime $dateCreated = null;
#[ORM\Column(options: ["default" => 0])]
private int $upVote = 0;
@ -93,6 +97,18 @@ class Post
return $this;
}
public function getDateCreated(): ?DateTime
{
return $this->dateCreated;
}
public function setDateCreated(?DateTime $dateCreated): static
{
$this->dateCreated = $dateCreated;
return $this;
}
public function getUpVote(): ?int
{
return $this->upVote;

@ -1,9 +1,11 @@
<h1>All website posts</h1>
<link rel="stylesheet" href="{{ asset('css/components/post_mini.css') }}">
<link rel="stylesheet" href="{{ asset('css/components/post_all.css') }}">
{% for post in posts %}
<div>
<span>Id: {{ post.id }}</span>
<span>Title: {{ post.title }}</span>
<span>Content: {{ post.text }}</span>
</div>
{% endfor %}
<div id="wrapper">
<h1>All posts</h1>
{% for post in posts %}
{% include 'post/post_mini.html.twig' with {'post' : post} %}
{% endfor %}
</div>

@ -0,0 +1,13 @@
<div id="post-wrapper">
<div id="post">
<div id="post-info">
<img src="https://api.dicebear.com/8.x/big-smile/svg?seed={{ post.profil.name }}" width="40px">
<span>{{ post.profil.name }}</span>
{# <span>- {{ post.dateCreated }}</span> #}
<span>- Il y a 3 jours</span>
</div>
<h1 id="post-title">{{ post.title }}</h1>
<p>{{ post.text|u.truncate(150, true, '...') }}</p>
</div>
</div>

Binary file not shown.
Loading…
Cancel
Save