From 39c6b5a22b684c31d7b5a6a54e5645dd1cfbbe86 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:51:48 +0100 Subject: [PATCH 01/23] moved content to app.js --- assets/js/index.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/assets/js/index.js b/assets/js/index.js index 0956617..ac45951 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -1,17 +1,2 @@ // assets/js/index.js -import '../styles/app.scss' -import 'fork-awesome/scss/fork-awesome.scss' - -require('bootstrap') -import 'bootswatch/dist/slate/bootstrap.min.css' - -$(document).ready(function () { - console.log('ready') - $('#toggleSidebar').on('click', function () { - let toggleIcon = $('#toggleIcon') - toggleIcon.toggleClass('fa fa-lg fa-fw fa-caret-square-o-left') - toggleIcon.toggleClass('fa fa-lg fa-fw fa-caret-square-o-right') - $('#sidebar').toggleClass('active') - }) -}) -- 2.39.5 From 990330ee5e9b112e779352704b0e893cc729fb26 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:52:26 +0100 Subject: [PATCH 02/23] switched to bootstrap-night --- assets/styles/app.scss | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/assets/styles/app.scss b/assets/styles/app.scss index da8b002..bf78d99 100644 --- a/assets/styles/app.scss +++ b/assets/styles/app.scss @@ -14,6 +14,15 @@ //border: 1px solid gray; } +// customize some Bootstrap variables +$primary: #FF8040; +$jet-black: #0e0e10; + +//$body-bg: red; +$body-color: #8f8f8f; + +@import 'bootstrap-dark-5/dist/css/bootstrap-night.min.css'; + html, body { margin: 0; @@ -23,10 +32,6 @@ html, body { } -// customize some Bootstrap variables -$primary: #FF8040; -$jet-black: #0e0e10; -//@import "bootstrap/scss/bootstrap"; /// @@ -40,6 +45,7 @@ $jet-black: #0e0e10; white-space: nowrap; overflow: hidden; float: left; + background-color: $jet-black; transition: min-width 0.5s, max-width 0.5s; } @@ -57,7 +63,7 @@ $jet-black: #0e0e10; #main_content { overflow-y: auto; - height: calc(100vh - 160px) + height: calc(100vh - 180px); // 74px header, 64px header } .form-signin { @@ -96,3 +102,13 @@ $jet-black: #0e0e10; margin-bottom: 10px; border-radius: 0 0 0.375rem 0.375rem; } + +.quote-box { + border-left: 1px solid #ff8844; + color: #ff8844; +} + +.project-image { + width: 200px; + margin: 15px; +} \ No newline at end of file -- 2.39.5 From 33ee23dc39a1c4d8a3ca02352d4b9ee66f271fb8 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:52:50 +0100 Subject: [PATCH 03/23] moved content from index.js --- assets/app.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/assets/app.js b/assets/app.js index bb0a6aa..48617e4 100644 --- a/assets/app.js +++ b/assets/app.js @@ -6,7 +6,26 @@ */ // any CSS you import will output into a single css file (app.css in this case) -import './styles/app.css'; +import 'fork-awesome/scss/fork-awesome.scss' +import './styles/app.scss' +import $ from 'jquery' +import 'bootstrap' +//import './js/index' +// needed for legacy code +//global.$ = $ +if (window.matchMedia('(prefers-color-scheme)').media !== 'not all') { + console.log('🎉 Dark mode is supported') +} + +$(document).ready(() => { + console.log('ready') + $('#toggleSidebar').on('click', () => { + const toggleIcon = $('#toggleIcon') + toggleIcon.toggleClass('fa fa-lg fa-fw fa-caret-square-o-left') + toggleIcon.toggleClass('fa fa-lg fa-fw fa-caret-square-o-right') + $('#sidebar').toggleClass('active') + }) +}) // start the Stimulus application -import './bootstrap'; +//import './bootstrap' -- 2.39.5 From 2d58edc5b5a8c09e87a12d36125ade5e7fc2b35a Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:53:41 +0100 Subject: [PATCH 04/23] removed semicolons --- assets/bootstrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/bootstrap.js b/assets/bootstrap.js index 4ab2df6..8baa386 100644 --- a/assets/bootstrap.js +++ b/assets/bootstrap.js @@ -1,11 +1,11 @@ -import { startStimulusApp } from '@symfony/stimulus-bridge'; +import {startStimulusApp} from '@symfony/stimulus-bridge' // Registers Stimulus controllers from controllers.json and in the controllers/ directory export const app = startStimulusApp(require.context( '@symfony/stimulus-bridge/lazy-controller-loader!./controllers', true, /\.[jt]sx?$/ -)); +)) // register any custom, 3rd party controllers here // app.register('some_controller_name', SomeImportedController); -- 2.39.5 From 0cacf7144dfb55c6a785144d6247e2f3f08f3340 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:54:06 +0100 Subject: [PATCH 05/23] fixed avatar path --- src/Controller/Admin/DashboardController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index 2f00865..b50af3f 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -52,7 +52,7 @@ class DashboardController extends AbstractDashboardController } return parent::configureUserMenu(user: $user) - ->setAvatarUrl(url: 'build/images/'.$user->getAvatar()); + ->setAvatarUrl(url: 'uploads/avatars/' . $user->getAvatar()); } public function configureActions(): Actions -- 2.39.5 From db245e6d35ce635a9c5f533ed5d9cb22b446da73 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:54:31 +0100 Subject: [PATCH 06/23] made content TextEditorField --- src/Controller/Admin/PagesCrudController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Controller/Admin/PagesCrudController.php b/src/Controller/Admin/PagesCrudController.php index 36a8d1d..8aad8fb 100644 --- a/src/Controller/Admin/PagesCrudController.php +++ b/src/Controller/Admin/PagesCrudController.php @@ -8,6 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class PagesCrudController extends AbstractCrudController @@ -24,7 +25,7 @@ class PagesCrudController extends AbstractCrudController yield TextField::new(propertyName: 'name'); yield AssociationField::new(propertyName: 'owner'); // yield CodeEditorField::new(propertyName: 'content') - yield TextareaField::new(propertyName: 'content') + yield TextEditorField::new(propertyName: 'content') ->onlyOnForms(); } } -- 2.39.5 From e8327f9de01461faf7fef04dd7f71a0b5828a56c Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 18:55:24 +0100 Subject: [PATCH 07/23] made quotes TextAreaField --- src/Controller/Admin/QuotesCrudController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/Admin/QuotesCrudController.php b/src/Controller/Admin/QuotesCrudController.php index d371584..db59240 100644 --- a/src/Controller/Admin/QuotesCrudController.php +++ b/src/Controller/Admin/QuotesCrudController.php @@ -5,7 +5,7 @@ namespace App\Controller\Admin; use App\Entity\Quotes; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; -use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class QuotesCrudController extends AbstractCrudController @@ -21,7 +21,7 @@ class QuotesCrudController extends AbstractCrudController ->onlyOnIndex(); yield TextField::new(propertyName: 'quote') ->onlyOnIndex(); - yield TextEditorField::new(propertyName: 'quote') + yield TextAreaField::new(propertyName: 'quote') ->onlyOnForms(); } } -- 2.39.5 From ce8867465f1ca9ee4aadeebdae322065d78373f2 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:04:12 +0100 Subject: [PATCH 08/23] added timestamp to avatar --- src/Controller/Admin/UserCrudController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/Admin/UserCrudController.php b/src/Controller/Admin/UserCrudController.php index 75e0c3c..4efae24 100644 --- a/src/Controller/Admin/UserCrudController.php +++ b/src/Controller/Admin/UserCrudController.php @@ -27,7 +27,7 @@ class UserCrudController extends AbstractCrudController yield ImageField::new(propertyName: 'avatar') ->setBasePath(path: 'uploads/avatars') ->setUploadDir(uploadDirPath: 'public/uploads/avatars') - ->setUploadedFileNamePattern(patternOrCallable: '[timestamp]-[slug].[extension]'); + ->setUploadedFileNamePattern(patternOrCallable: '[slug]-[timestamp].[extension]'); $roles = ['ROLE_FOUNDER', 'ROLE_ADMIN', 'ROLE_MODERATOR', 'ROLE_USER']; yield ChoiceField::new(propertyName: 'roles') ->setChoices(choiceGenerator: array_combine(keys: $roles, values: $roles)) -- 2.39.5 From 93b60eacb33bbc1d4ec31937ef1f78074b8fc774 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:04:48 +0100 Subject: [PATCH 09/23] fixed quote parameter --- src/Controller/FrontendController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/FrontendController.php b/src/Controller/FrontendController.php index 50f07f8..9064422 100644 --- a/src/Controller/FrontendController.php +++ b/src/Controller/FrontendController.php @@ -23,7 +23,7 @@ class FrontendController extends AbstractController return $this->render(view: '@default/base.html.twig', parameters: [ 'user' => $user, - 'quote' => json_encode(value: $quote->getQuote()) + 'quote' => $quote->getQuote() ]); } } -- 2.39.5 From 1120f1798f4ef9210fe9289247488e3db28acae2 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:05:36 +0100 Subject: [PATCH 10/23] changed pages_display parameter from route to slug remove imprint and privacy placeholders --- src/Controller/PagesController.php | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Controller/PagesController.php b/src/Controller/PagesController.php index 6638c81..0f51151 100644 --- a/src/Controller/PagesController.php +++ b/src/Controller/PagesController.php @@ -10,33 +10,23 @@ use Symfony\Component\Routing\Annotation\Route; class PagesController extends AbstractController { - #[Route(path: '/pages/{name}', name: 'pages_display')] - public function display(PagesRepository $pagesRepository, string $name): Response + #[Route(path: '/pages/{slug}', name: 'pages_display')] + public function display(PagesRepository $pagesRepository, string $slug): Response { $page = $pagesRepository->findOneBy([ - 'slug' => $name, + 'slug' => $slug, ]); if (!$page) { $page = new Pages(); $page->setName(name: 'Not Found'); - $page->setContent(content: 'The requested page was not found.'); + $page->setContent(content: '404 - The requested page was not found.'); } - return $this->render(view: '@default/pages/display.html.twig', parameters: [ - 'page' => $page, + return $this->render(view: '@default/pages/index.html.twig', parameters: [ + 'page_name' => $page->getName(), + 'page_content' => $page->getContent() + ]); } - - #[Route(path: '/imprint', name: 'app_imprint')] - public function imprint(): Response - { - return $this->render(view: '@default/pages/imprint.html.twig'); - } - - #[Route(path: '/privacy', name: 'app_privacy')] - public function privacy(): Response - { - return $this->render(view: '@default/pages/privacy.html.twig'); - } } -- 2.39.5 From 3e20a9c64404e6d405585f8cd1c846241be707b8 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:15:26 +0100 Subject: [PATCH 11/23] added type annotations --- src/Entity/Pages.php | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/Entity/Pages.php b/src/Entity/Pages.php index dbff5bb..4956c17 100644 --- a/src/Entity/Pages.php +++ b/src/Entity/Pages.php @@ -2,56 +2,38 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiFilter; -use ApiPlatform\Core\Annotation\ApiResource; -use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use App\Repository\PagesRepository; use DateTimeImmutable; use Doctrine\ORM\Mapping as ORM; use Sunrise\Slugger\Slugger; #[ORM\Entity(repositoryClass: PagesRepository::class), ORM\HasLifecycleCallbacks] -#[ApiResource] -#[ApiFilter(filterClass: SearchFilter::class, properties: ['slug' => 'exact'])] class Pages { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] - private $id; + private ?int $id; #[ORM\Column(type: 'string', length: 255)] - private $name; + private string $name; #[ORM\Column(type: 'text')] - private $content; + private string $content; #[ORM\Column(type: 'datetime_immutable')] - private $createdAt; + private ?DateTimeImmutable $createdAt; #[ORM\Column(type: 'datetime_immutable', nullable: true)] - private $modifiedAt; + private ?DateTimeImmutable $modifiedAt; #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'pages')] #[ORM\JoinColumn(nullable: false)] - private $owner; + private User $owner; #[ORM\Column(type: 'string', length: 255)] - private $slug; - - /** - * @param $id - */ - - /* public function __construct(String $name = '', String $content = '') - { - $this->name = $name; - $this->content = $content; - $owner = $userRepository->findOneBy(['username' => 'tracer']); - $this->owner = $owner; - } - */ + private string $slug; public function getId(): ?int { -- 2.39.5 From 2aeeb0d87e0f0fb6f2fcce56f6e93430ff8cd662 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:16:16 +0100 Subject: [PATCH 12/23] added type annotations --- src/Entity/Quotes.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Entity/Quotes.php b/src/Entity/Quotes.php index 7910b25..a1e03be 100644 --- a/src/Entity/Quotes.php +++ b/src/Entity/Quotes.php @@ -2,21 +2,19 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiResource; use App\Repository\QuotesRepository; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: QuotesRepository::class)] -#[ApiResource] class Quotes { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] - private $id; + private int $id; #[ORM\Column(type: 'text')] - private $quote; + private string $quote; public function getId(): ?int { -- 2.39.5 From 8794806e2c6284b0b9ea8f2cbd039b8cbc6cd079 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:16:46 +0100 Subject: [PATCH 13/23] added type annotations --- src/Entity/User.php | 47 +++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/Entity/User.php b/src/Entity/User.php index e8b05fc..8540453 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -3,11 +3,11 @@ namespace App\Entity; use App\Repository\UserRepository; +use DateTime; use DateTimeImmutable; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Stringable; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -15,7 +15,6 @@ use Symfony\Component\Validator\Constraints as Assert; #[ORM\Entity(repositoryClass: UserRepository::class), ORM\HasLifecycleCallbacks] #[UniqueEntity(fields: ['username', 'email'], message: 'There is already an account with this username or email.')] - class User implements UserInterface, PasswordAuthenticatedUserInterface { #[ORM\Id] @@ -45,22 +44,22 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface private ?string $lastName = ''; #[ORM\ManyToMany(targetEntity: Projects::class, mappedBy: 'developer')] - private $projects; + private Collection $projects; #[ORM\Column(type: 'string', length: 255, nullable: true)] - private string $avatar; + private ?string $avatar; #[ORM\OneToMany(mappedBy: 'owner', targetEntity: Pages::class)] - private $pages; + private Collection $pages; #[ORM\Column(type: 'datetime_immutable')] - private $createdAt; + private DateTimeImmutable $createdAt; #[ORM\Column(type: 'datetime_immutable', nullable: true)] - private $modifiedAt; + private DateTimeImmutable $modifiedAt; #[ORM\Column(type: 'boolean')] - private $isVerified = false; + private bool $isVerified = false; #[ORM\Column] private ?DateTimeImmutable $agreedTermsAt = null; @@ -137,13 +136,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - /** - * @see UserInterface - */ - public function eraseCredentials() - { - $this->plainPassword = ''; - } public function getEmail(): ?string { @@ -157,10 +149,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - public function setPlainPassword(string $plainPassword): void - { - $this->plainPassword = $plainPassword; - } public function getFirstName(): ?string { @@ -278,14 +266,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - - /** - * @return string - */ - public function getAvatarUri() - { - return 'avatar'; - } + + /** + * @return string + */ + public function getAvatarUri(): string + { + return 'avatar'; + } #[ORM\PrePersist] public function onPrePersist(): void @@ -322,4 +310,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } + + public function eraseCredentials() + { + // TODO: Implement eraseCredentials() method. + } } -- 2.39.5 From 7b00897bc13110d2f45364bfc2f952de24bb2d44 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:17:07 +0100 Subject: [PATCH 14/23] initial commit --- templates/themes/default/pages/index.html.twig | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 templates/themes/default/pages/index.html.twig diff --git a/templates/themes/default/pages/index.html.twig b/templates/themes/default/pages/index.html.twig new file mode 100644 index 0000000..bf38f40 --- /dev/null +++ b/templates/themes/default/pages/index.html.twig @@ -0,0 +1,7 @@ +{% extends '@default/base.html.twig' %} + +{% block title %}page_name{% endblock %} + +{% block body %} + {{ page_content | raw }} +{% endblock %} \ No newline at end of file -- 2.39.5 From a0627c89abf8bf63dda0b5ff51508207c70384c5 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:17:44 +0100 Subject: [PATCH 15/23] renamed class blog-image to project-image --- templates/themes/default/projects/index.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/themes/default/projects/index.html.twig b/templates/themes/default/projects/index.html.twig index bf72b99..d4e1945 100644 --- a/templates/themes/default/projects/index.html.twig +++ b/templates/themes/default/projects/index.html.twig @@ -17,12 +17,12 @@ {% if project.teaserImage %} Teaser {% else %} Teaser {% endif %} -- 2.39.5 From ee2a14a53292895111069f640257696abe91a3a5 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:18:12 +0100 Subject: [PATCH 16/23] removed link to static pages, added dynamic ones --- templates/themes/default/_footer.html.twig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/themes/default/_footer.html.twig b/templates/themes/default/_footer.html.twig index b1cc8e1..a7208df 100644 --- a/templates/themes/default/_footer.html.twig +++ b/templates/themes/default/_footer.html.twig @@ -1,12 +1,14 @@