commit
787c1e92ab
@ -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,235 @@
|
||||
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;
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: #bda3b6;
|
||||
padding: 4px;
|
||||
border-radius: 10px;
|
||||
border-style: solid;
|
||||
border-color: #1a2c4c;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.nav-logo {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
nav img {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.floating-button {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-color: #bda3b6;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 24px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
border-style: solid;
|
||||
border-color: #1a2c4c;
|
||||
border-width: 4px;
|
||||
padding-bottom: 10px;
|
||||
font-size: 50px;
|
||||
color: #1a2c4c;
|
||||
|
||||
}
|
||||
|
||||
.nav-links a:hover {
|
||||
color: #494949;
|
||||
}
|
||||
|
||||
.floating-button:hover {
|
||||
background-color: #72606d;
|
||||
}
|
||||
|
@ -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,31 +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 Version20240612095513 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
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
|
||||
}
|
||||
}
|
@ -1,31 +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 Version20240612095600 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
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 67 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>
|
@ -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,52 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Hello ProfilController!{% endblock %}
|
||||
{% block title %}Profil - {{ profil.name }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<style>
|
||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
||||
</style>
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('css/components/post_mini.css')}}">
|
||||
{% endblock %}
|
||||
|
||||
<div class="example-wrapper">
|
||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
||||
{% block body %}
|
||||
<div class="profile-container">
|
||||
<div class="profile-header">
|
||||
<img src="https://api.dicebear.com/8.x/big-smile/svg?seed={{ profil.name }}" alt="Profile Image" class="profile-image">
|
||||
<div class="profile-info">
|
||||
<h1>{{ profil.name }}</h1>
|
||||
<br>
|
||||
<p>{{ profil.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="horizontal-layout">
|
||||
|
||||
{% 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>
|
||||
|
||||
This friendly message is coming from:
|
||||
<ul>
|
||||
<li>Your controller at <code>/home/aurian/3eme_annee/assassymfony/fukafukashita/src/Controller/ProfilController.php</code></li>
|
||||
<li>Your template at <code>/home/aurian/3eme_annee/assassymfony/fukafukashita/templates/profil/index.html.twig</code></li>
|
||||
</ul>
|
||||
<div class="posts-container">
|
||||
{% if posts|length > 0 %}
|
||||
<ul>
|
||||
{% for post in posts %}
|
||||
{% include 'post/post_mini.html.twig' with {'post': post} %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
<script src="{{ asset('scripts/scripts.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
Binary file not shown.
Loading…
Reference in new issue