profilController #16
Merged
corentin.richard
merged 15 commits from profilController
into master
11 months ago
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"sqltools.connections": [
|
||||||
|
{
|
||||||
|
"previewLimit": 50,
|
||||||
|
"driver": "SQLite",
|
||||||
|
"name": "dbapplication",
|
||||||
|
"database": "${workspaceFolder:Fukafukashita}/var/data.db"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
INSERT INTO profil (id, name, description, password)
|
||||||
|
VALUES (
|
||||||
|
7,
|
||||||
|
'name:VARCHAR(255)',
|
||||||
|
'description:VARCHAR(255)',
|
||||||
|
'password:VARCHAR(255)'
|
||||||
|
);
|
@ -0,0 +1,17 @@
|
|||||||
|
// public/js/scripts.js
|
||||||
|
|
||||||
|
function openPopup() {
|
||||||
|
document.getElementById("followPopup").style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePopup() {
|
||||||
|
document.getElementById("followPopup").style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the popup if the user clicks outside of it
|
||||||
|
window.onclick = function(event) {
|
||||||
|
var popup = document.getElementById("followPopup");
|
||||||
|
if (event.target == popup) {
|
||||||
|
popup.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,162 @@
|
|||||||
body {
|
body {
|
||||||
background-color: skyblue;
|
font-family: Arial, sans-serif;
|
||||||
|
/* background-color: #f0f0f0; */
|
||||||
|
color: #1a2c4c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.profile-container {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #5c5d7f;
|
||||||
|
border-radius: 8px;
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1px solid #5c5d7f;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-image {
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
object-fit: cover;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-info {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-info h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
margin: 0;
|
||||||
|
color: #1a2c4c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-info p {
|
||||||
|
margin: 5px 0;
|
||||||
|
color: #38476b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.horizontal-layout {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow-button {
|
||||||
|
background-color: #38476b;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button {
|
||||||
|
background-color: #970c2a;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
|
.count-container {
|
||||||
|
display: flex;
|
||||||
|
margin-left: auto; /* Pushes the container to the right */
|
||||||
|
}
|
||||||
|
|
||||||
|
.count-button {
|
||||||
|
background-color: #38476b;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
margin: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.count-button:hover{
|
||||||
|
background-color: #5c5d7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow-button:hover {
|
||||||
|
background-color: #5c5d7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* public/css/styles.css */
|
||||||
|
|
||||||
|
/* Ajoutez les styles existants ici */
|
||||||
|
|
||||||
|
.popup {
|
||||||
|
display: none; /* Hidden by default */
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
background-color: rgb(0,0,0);
|
||||||
|
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
background-color: #fefefe;
|
||||||
|
margin: 15% auto;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 80%;
|
||||||
|
max-width: 400px;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
color: #aaa;
|
||||||
|
float: right;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close:hover,
|
||||||
|
.close:focus {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20240611131531 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('CREATE TEMPORARY TABLE __temp__post AS SELECT id, profil_id, title, text, is_dream, up_vote, down_vote FROM post');
|
|
||||||
$this->addSql('DROP TABLE post');
|
|
||||||
$this->addSql('CREATE TABLE post (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, profil_id INTEGER NOT NULL, title VARCHAR(255) DEFAULT NULL, text VARCHAR(512) DEFAULT NULL, is_dream BOOLEAN NOT NULL, up_vote INTEGER DEFAULT 0 NOT NULL, down_vote INTEGER DEFAULT 0 NOT NULL, CONSTRAINT FK_5A8A6C8D275ED078 FOREIGN KEY (profil_id) REFERENCES profil (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
||||||
$this->addSql('INSERT INTO post (id, profil_id, title, text, is_dream, up_vote, down_vote) SELECT id, profil_id, title, text, is_dream, up_vote, down_vote FROM __temp__post');
|
|
||||||
$this->addSql('DROP TABLE __temp__post');
|
|
||||||
$this->addSql('CREATE INDEX IDX_5A8A6C8D275ED078 ON post (profil_id)');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('CREATE TEMPORARY TABLE __temp__post AS SELECT id, profil_id, title, text, is_dream, up_vote, down_vote FROM post');
|
|
||||||
$this->addSql('DROP TABLE post');
|
|
||||||
$this->addSql('CREATE TABLE post (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, profil_id INTEGER NOT NULL, title VARCHAR(255) DEFAULT NULL, text VARCHAR(512) DEFAULT NULL, is_dream BOOLEAN NOT NULL, up_vote INTEGER NOT NULL, down_vote INTEGER NOT NULL, CONSTRAINT FK_5A8A6C8D275ED078 FOREIGN KEY (profil_id) REFERENCES profil (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
||||||
$this->addSql('INSERT INTO post (id, profil_id, title, text, is_dream, up_vote, down_vote) SELECT id, profil_id, title, text, is_dream, up_vote, down_vote FROM __temp__post');
|
|
||||||
$this->addSql('DROP TABLE __temp__post');
|
|
||||||
$this->addSql('CREATE INDEX IDX_5A8A6C8D275ED078 ON post (profil_id)');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20240612112105 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('ALTER TABLE profil ADD COLUMN roles CLOB DEFAULT NULL');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('CREATE TEMPORARY TABLE __temp__profil AS SELECT id, name, description, password FROM profil');
|
|
||||||
$this->addSql('DROP TABLE profil');
|
|
||||||
$this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)');
|
|
||||||
$this->addSql('INSERT INTO profil (id, name, description, password) SELECT id, name, description, password FROM __temp__profil');
|
|
||||||
$this->addSql('DROP TABLE __temp__profil');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20240612121601 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('ALTER TABLE profil ADD COLUMN roles CLOB DEFAULT NULL');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('CREATE TEMPORARY TABLE __temp__profil AS SELECT id, name, description, password FROM profil');
|
|
||||||
$this->addSql('DROP TABLE profil');
|
|
||||||
$this->addSql('CREATE TABLE profil (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, password VARCHAR(255) DEFAULT NULL)');
|
|
||||||
$this->addSql('INSERT INTO profil (id, name, description, password) SELECT id, name, description, password FROM __temp__profil');
|
|
||||||
$this->addSql('DROP TABLE __temp__profil');
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 42 KiB |
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Entity\Profil;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class ProfilType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('name')
|
||||||
|
->add('description')
|
||||||
|
// ->add('password')
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => Profil::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Error</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #1a2c4c; /* Big Stone */
|
||||||
|
color: #bda3b6; /* Lily */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.error-container {
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #38476b; /* Rhino */
|
||||||
|
background-color: #5c5d7f; /* Comet */
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.error-container h1 {
|
||||||
|
font-size: 48px;
|
||||||
|
margin: 0;
|
||||||
|
color: #928ba2; /* Manatee */
|
||||||
|
}
|
||||||
|
.error-container p {
|
||||||
|
font-size: 18px;
|
||||||
|
margin: 10px 0 20px;
|
||||||
|
}
|
||||||
|
.error-container a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #1a2c4c; /* Big Stone */
|
||||||
|
font-weight: bold;
|
||||||
|
border: 1px solid #1a2c4c; /* Big Stone */
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #bda3b6; /* Lily */
|
||||||
|
}
|
||||||
|
.error-container a:hover {
|
||||||
|
background-color: #928ba2; /* Manatee */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="error-container">
|
||||||
|
<h1>Something went wrong</h1>
|
||||||
|
<p>We're sorry, but something went wrong. Please try again later.</p>
|
||||||
|
{# <a href="{{ path('homepage') }}">Go to Homepage</a> #}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,9 +1,11 @@
|
|||||||
<h1>All website posts</h1>
|
<link rel="stylesheet" href="{{ asset('css/components/post_mini.css') }}">
|
||||||
<a href="{{ path('add_post') }}" class="btn btn-primary">Créer un nouveau post</a>
|
<link rel="stylesheet" href="{{ asset('css/components/post_all.css') }}">
|
||||||
{% for post in posts %}
|
|
||||||
<div>
|
|
||||||
<span>Id: {{ post.id }}</span>
|
<div id="wrapper">
|
||||||
<span>Title: {{ post.title }}</span>
|
<h1>All posts</h1>
|
||||||
<span>Content: {{ post.text }}</span>
|
|
||||||
</div>
|
{% for post in posts %}
|
||||||
{% endfor %}
|
{% 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>
|
@ -0,0 +1,30 @@
|
|||||||
|
{# templates/profil/edit.html.twig #}
|
||||||
|
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Edit Profile{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('public/css/components/profil.css') }}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="profile-container">
|
||||||
|
<h1>Edit Profile</h1>
|
||||||
|
|
||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_widget(form) }}
|
||||||
|
<button type="submit" class="btn btn-primary follow-button">Save</button>
|
||||||
|
{{ form_end(form) }}
|
||||||
|
|
||||||
|
<form method="post" action="{{ path('profil_delete', {id: profil.id}) }}" onsubmit="return confirm('Are you sure you want to delete this profile?');">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ profil.id) }}">
|
||||||
|
<button class="btn btn-danger delete-button">Delete Profile</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="{{ asset('scripts/scripts.js') }}"></script>
|
||||||
|
{% endblock %}
|
@ -0,0 +1,55 @@
|
|||||||
|
{# templates/profil/list.html.twig #}
|
||||||
|
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Liste des Profils{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('public/css/components/profil.css') }}">
|
||||||
|
<style>
|
||||||
|
.profile-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.profile-card {
|
||||||
|
width: calc(100% / 5);
|
||||||
|
padding: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.profile-card img {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
.profile-card a {
|
||||||
|
display: block;
|
||||||
|
margin-top: 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.profile-card a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<h1> {{title }} : </h1>
|
||||||
|
<div class="profile-list">
|
||||||
|
{% for profil in profils %}
|
||||||
|
<div class="profile-card">
|
||||||
|
<img src="https://api.dicebear.com/8.x/big-smile/svg?seed={{ profil.name }}" alt="Profile Image">
|
||||||
|
<a href="{{ path('profil_show', {id: profil.id}) }}">{{ profil.name }}</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="{{ asset('scripts/scripts.js') }}"></script>
|
||||||
|
{% endblock %}
|
@ -1,20 +1,55 @@
|
|||||||
|
{# templates/profil/show.html.twig #}
|
||||||
|
|
||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Hello ProfilController!{% endblock %}
|
{% block title %}Profil - {{ profil.name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ asset('public/css/components/profil.css') }}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<style>
|
<div class="profile-container">
|
||||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
<div class="profile-header">
|
||||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
<img src="https://api.dicebear.com/8.x/big-smile/svg?seed={{ profil.name }}" alt="Profile Image" class="profile-image">
|
||||||
</style>
|
<div class="profile-info">
|
||||||
|
<h1>{{ profil.name }}</h1>
|
||||||
|
<br>
|
||||||
|
<p>{{ profil.description }}</p>
|
||||||
|
|
||||||
<div class="example-wrapper">
|
</div>
|
||||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
</div>
|
||||||
|
<div class="horizontal-layout">
|
||||||
|
|
||||||
This friendly message is coming from:
|
{% if selfFlag %}
|
||||||
|
<a href="{{ path('profil_edit', {id: profil.id}) }}" class="follow-button">Edit</a>
|
||||||
|
{% elseif connected %}
|
||||||
|
{% if followFlag %}
|
||||||
|
<a href="{{ path('profil_unfollow', {id: profil.id}) }}" class="follow-button">Unfollow</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ path('profil_follow', {id: profil.id}) }}" class="follow-button">Follow</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{# <a href="{{ path('profil_follow', {id: profil.id}) }}" class="follow-button"></a> #}
|
||||||
|
<div class="count-container">
|
||||||
|
<a href="{{ path('profil_followers', {id: profil.id}) }}" class="count-button">{{ profil.followers.count() }} followers</a>
|
||||||
|
<a href="{{ path('profil_following', {id: profil.id}) }}" class="count-button">{{ profil.following.count() }} following</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="posts-container">
|
||||||
|
{% if posts|length > 0 %}
|
||||||
<ul>
|
<ul>
|
||||||
<li>Your controller at <code>/home/aurian/3eme_annee/assassymfony/fukafukashita/src/Controller/ProfilController.php</code></li>
|
{% for post in posts %}
|
||||||
<li>Your template at <code>/home/aurian/3eme_annee/assassymfony/fukafukashita/templates/profil/index.html.twig</code></li>
|
{% include 'post/post_mini.html.twig' with {'post': post} %}
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="{{ asset('scripts/scripts.js') }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Binary file not shown.
Loading…
Reference in new issue