From 219f4097ff881240a363152aa94ddf0ee682070a Mon Sep 17 00:00:00 2001 From: tracer Date: Sat, 5 Nov 2022 17:18:04 +0100 Subject: [PATCH] rescue old vm stuff --- assets/bootstrap.js | 8 +- assets/js/index.js | 1 - assets/styles/app.scss | 38 +- assets/styles/components/_sidebar.scss | 22 + composer.json | 2 +- composer.lock | 106 +- package.json | 1 - src/Controller/PagesController.php | 16 +- src/Controller/UserController.php | 27 +- templates/themes/default/base.html.twig | 23 +- .../themes/default/pages/index.html.twig | 8 +- .../themes/default/projects/index.html.twig | 2 +- .../themes/default/projects/show.html.twig | 8 +- .../default/user/edit_profile.html.twig | 2 +- .../themes/default/user/list_users.html.twig | 238 +- .../default/user/show_profile.html.twig | 23 +- yarn.lock | 2497 +++++++++-------- 17 files changed, 1405 insertions(+), 1617 deletions(-) create mode 100644 assets/styles/components/_sidebar.scss diff --git a/assets/bootstrap.js b/assets/bootstrap.js index 8baa386..24ac870 100644 --- a/assets/bootstrap.js +++ b/assets/bootstrap.js @@ -1,10 +1,10 @@ -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?$/ + '@symfony/stimulus-bridge/lazy-controller-loader!./controllers', + true, + /\.[jt]sx?$/ )) // register any custom, 3rd party controllers here diff --git a/assets/js/index.js b/assets/js/index.js index ac45951..307ae3d 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -1,2 +1 @@ // assets/js/index.js - diff --git a/assets/styles/app.scss b/assets/styles/app.scss index bf78d99..ad39446 100644 --- a/assets/styles/app.scss +++ b/assets/styles/app.scss @@ -18,10 +18,15 @@ $primary: #FF8040; $jet-black: #0e0e10; -//$body-bg: red; -$body-color: #8f8f8f; +$body-color: #3f3f3f; +$list-group-bg: $body-color; +$list-group-hover-bg: #232323; +$list-group-active-bg: #232323; +$list-group-action-active-bg: #232323; -@import 'bootstrap-dark-5/dist/css/bootstrap-night.min.css'; +@import '~bootstrap'; + +@import './components/sidebar'; html, body { @@ -35,35 +40,10 @@ html, body { /// -// sidebar - -#sidebar { - min-width: 180px; - max-width: 180px; - height: 100%; - display: inline; - white-space: nowrap; - overflow: hidden; - float: left; - background-color: $jet-black; - transition: min-width 0.5s, max-width 0.5s; -} - -#sidebar.active { - min-width: 60px; - max-width: 60px; -} - -#content { -} - -#sidebar.active .menuText { - display: none; -} #main_content { overflow-y: auto; - height: calc(100vh - 180px); // 74px header, 64px header + height: calc(100vh - 190px); // 74px header, 64px header } .form-signin { diff --git a/assets/styles/components/_sidebar.scss b/assets/styles/components/_sidebar.scss new file mode 100644 index 0000000..3e5432e --- /dev/null +++ b/assets/styles/components/_sidebar.scss @@ -0,0 +1,22 @@ +// sidebar + +#sidebar { + min-width: 180px; + max-width: 180px; + height: 100%; + display: inline; + white-space: nowrap; + overflow: hidden; + float: left; + background-color: $jet-black; + transition: min-width 0.5s, max-width 0.5s; +} + +#sidebar.active { + min-width: 60px; + max-width: 60px; +} + +#sidebar.active .menuText { + display: none; +} diff --git a/composer.json b/composer.json index b5dce4c..1195f29 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "symfony/validator": "6.1.*", "symfony/web-link": "6.1.*", "symfony/webapp-meta": "^1.0", - "symfony/webpack-encore-bundle": "^1.14", + "symfony/webpack-encore-bundle": "^v1.16.0", "symfony/yaml": "6.1.*", "symfonycasts/reset-password-bundle": "^1.16", "symfonycasts/verify-email-bundle": "^1.12", diff --git a/composer.lock b/composer.lock index 1828b59..1bae413 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "7d3d3e0369d1f8799e53d7d078431c55", + "content-hash": "a389aa46db42a7da38ebb6610fb97a52", "packages": [ { "name": "dflydev/dot-access-data", @@ -564,37 +564,37 @@ }, { "name": "doctrine/doctrine-bundle", - "version": "2.7.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "d2088fc50494e4e7441fecca54732245a613eeb6" + "reference": "a2dcad48741c9d12fd6040398cf075025030096e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/d2088fc50494e4e7441fecca54732245a613eeb6", - "reference": "d2088fc50494e4e7441fecca54732245a613eeb6", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/a2dcad48741c9d12fd6040398cf075025030096e", + "reference": "a2dcad48741c9d12fd6040398cf075025030096e", "shasum": "" }, "require": { "doctrine/annotations": "^1", "doctrine/cache": "^1.11 || ^2.0", - "doctrine/dbal": "^2.13.1|^3.3.2", - "doctrine/persistence": "^2.2|^3", + "doctrine/dbal": "^2.13.1 || ^3.3.2", + "doctrine/persistence": "^2.2 || ^3", "doctrine/sql-formatter": "^1.0.1", "php": "^7.1 || ^8.0", - "symfony/cache": "^4.3.3|^5.0|^6.0", - "symfony/config": "^4.4.3|^5.0|^6.0", - "symfony/console": "^3.4.30|^4.3.3|^5.0|^6.0", - "symfony/dependency-injection": "^4.4.18|^5.0|^6.0", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/doctrine-bridge": "^4.4.22|^5.2.7|^6.0", - "symfony/framework-bundle": "^3.4.30|^4.3.3|^5.0|^6.0", - "symfony/service-contracts": "^1.1.1|^2.0|^3" + "symfony/cache": "^4.4 || ^5.4 || ^6.0", + "symfony/config": "^4.4.3 || ^5.4 || ^6.0", + "symfony/console": "^4.4 || ^5.4 || ^6.0", + "symfony/dependency-injection": "^4.4.18 || ^5.4 || ^6.0", + "symfony/deprecation-contracts": "^2.1 || ^3", + "symfony/doctrine-bridge": "^4.4.22 || ^5.4 || ^6.0", + "symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0", + "symfony/service-contracts": "^1.1.1 || ^2.0 || ^3" }, "conflict": { - "doctrine/orm": "<2.10|>=3.0", - "twig/twig": "<1.34|>=2.0,<2.4" + "doctrine/orm": "<2.11 || >=3.0", + "twig/twig": "<1.34 || >=2.0,<2.4" }, "require-dev": { "doctrine/coding-standard": "^9.0", @@ -603,16 +603,16 @@ "phpunit/phpunit": "^7.5 || ^8.0 || ^9.3 || ^10.0", "psalm/plugin-phpunit": "^0.16.1", "psalm/plugin-symfony": "^3", - "psr/log": "^1.1.4|^2.0|^3.0", - "symfony/phpunit-bridge": "^5.2|^6.0", - "symfony/property-info": "^4.3.3|^5.0|^6.0", - "symfony/proxy-manager-bridge": "^3.4|^4.3.3|^5.0|^6.0", - "symfony/security-bundle": "^4.4|^5.0|^6.0", - "symfony/twig-bridge": "^3.4.30|^4.3.3|^5.0|^6.0", - "symfony/validator": "^3.4.30|^4.3.3|^5.0|^6.0", - "symfony/web-profiler-bundle": "^3.4.30|^4.3.3|^5.0|^6.0", - "symfony/yaml": "^3.4.30|^4.3.3|^5.0|^6.0", - "twig/twig": "^1.34|^2.12|^3.0", + "psr/log": "^1.1.4 || ^2.0 || ^3.0", + "symfony/phpunit-bridge": "^6.1", + "symfony/property-info": "^4.4 || ^5.4 || ^6.0", + "symfony/proxy-manager-bridge": "^4.4 || ^5.4 || ^6.0", + "symfony/security-bundle": "^4.4 || ^5.4 || ^6.0", + "symfony/twig-bridge": "^4.4 || ^5.4 || ^6.0", + "symfony/validator": "^4.4 || ^5.4 || ^6.0", + "symfony/web-profiler-bundle": "^4.4 || ^5.4 || ^6.0", + "symfony/yaml": "^4.4 || ^5.4 || ^6.0", + "twig/twig": "^1.34 || ^2.12 || ^3.0", "vimeo/psalm": "^4.7" }, "suggest": { @@ -658,7 +658,7 @@ ], "support": { "issues": "https://github.com/doctrine/DoctrineBundle/issues", - "source": "https://github.com/doctrine/DoctrineBundle/tree/2.7.0" + "source": "https://github.com/doctrine/DoctrineBundle/tree/2.7.1" }, "funding": [ { @@ -674,7 +674,7 @@ "type": "tidelift" } ], - "time": "2022-06-10T10:55:26+00:00" + "time": "2022-10-23T09:47:06+00:00" }, { "name": "doctrine/doctrine-migrations-bundle", @@ -1453,16 +1453,16 @@ }, { "name": "easycorp/easyadmin-bundle", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/EasyCorp/EasyAdminBundle.git", - "reference": "5f6db8c1cdc63252bbfe80f383d487ae51fc6892" + "reference": "7d0d1eae72024af6b7344ae7c945da9db59c0c5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/EasyCorp/EasyAdminBundle/zipball/5f6db8c1cdc63252bbfe80f383d487ae51fc6892", - "reference": "5f6db8c1cdc63252bbfe80f383d487ae51fc6892", + "url": "https://api.github.com/repos/EasyCorp/EasyAdminBundle/zipball/7d0d1eae72024af6b7344ae7c945da9db59c0c5e", + "reference": "7d0d1eae72024af6b7344ae7c945da9db59c0c5e", "shasum": "" }, "require": { @@ -1529,7 +1529,7 @@ ], "support": { "issues": "https://github.com/EasyCorp/EasyAdminBundle/issues", - "source": "https://github.com/EasyCorp/EasyAdminBundle/tree/v4.4.1" + "source": "https://github.com/EasyCorp/EasyAdminBundle/tree/v4.4.2" }, "funding": [ { @@ -1537,7 +1537,7 @@ "type": "github" } ], - "time": "2022-10-27T18:36:25+00:00" + "time": "2022-10-31T08:05:36+00:00" }, { "name": "egulias/email-validator", @@ -1830,16 +1830,16 @@ }, { "name": "league/commonmark", - "version": "2.3.5", + "version": "2.3.7", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "84d74485fdb7074f4f9dd6f02ab957b1de513257" + "reference": "a36bd2be4f5387c0f3a8792a0d76b7d68865abbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/84d74485fdb7074f4f9dd6f02ab957b1de513257", - "reference": "84d74485fdb7074f4f9dd6f02ab957b1de513257", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/a36bd2be4f5387c0f3a8792a0d76b7d68865abbf", + "reference": "a36bd2be4f5387c0f3a8792a0d76b7d68865abbf", "shasum": "" }, "require": { @@ -1859,7 +1859,7 @@ "erusev/parsedown": "^1.0", "ext-json": "*", "github/gfm": "0.29.0", - "michelf/php-markdown": "^1.4", + "michelf/php-markdown": "^1.4 || ^2.0", "nyholm/psr7": "^1.5", "phpstan/phpstan": "^1.8.2", "phpunit/phpunit": "^9.5.21", @@ -1932,7 +1932,7 @@ "type": "tidelift" } ], - "time": "2022-07-29T10:59:45+00:00" + "time": "2022-11-03T17:29:46+00:00" }, { "name": "league/config", @@ -2537,16 +2537,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.11", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "46e223dd68a620da18855c23046ddb00940b4014" + "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", - "reference": "46e223dd68a620da18855c23046ddb00940b4014", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e08de53a5eec983de78a787a88e72518cf8fe43a", + "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a", "shasum": "" }, "require": { @@ -2576,7 +2576,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.11" + "source": "https://github.com/phpstan/phpstan/tree/1.9.0" }, "funding": [ { @@ -2592,7 +2592,7 @@ "type": "tidelift" } ], - "time": "2022-10-24T15:45:13+00:00" + "time": "2022-11-03T07:26:48+00:00" }, { "name": "psr/cache", @@ -2914,16 +2914,16 @@ }, { "name": "sensio/framework-extra-bundle", - "version": "v6.2.8", + "version": "v6.2.9", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "bb962f8aed09e60b0942545f6e4842ffeee4aafd" + "reference": "dcfac94d6bdcf95c126e8ccac2104917c7c8f135" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/bb962f8aed09e60b0942545f6e4842ffeee4aafd", - "reference": "bb962f8aed09e60b0942545f6e4842ffeee4aafd", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/dcfac94d6bdcf95c126e8ccac2104917c7c8f135", + "reference": "dcfac94d6bdcf95c126e8ccac2104917c7c8f135", "shasum": "" }, "require": { @@ -2986,9 +2986,9 @@ ], "support": { "issues": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues", - "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.8" + "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.9" }, - "time": "2022-09-05T16:44:56+00:00" + "time": "2022-11-01T17:17:13+00:00" }, { "name": "sunrise/slugger", diff --git a/package.json b/package.json index 129362e..0e0ac3e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@typescript-eslint/eslint-plugin-tslint": "^5.26.0", "axios": "^0.27.1", "bootstrap": "^5.2.2", - "bootstrap-dark-5": "^1.1.3", "bootswatch": "^5.2.2", "eslint": "^8.15.0", "eslint-config-airbnb-base": "^15.0.0", diff --git a/src/Controller/PagesController.php b/src/Controller/PagesController.php index bab1948..da29e41 100644 --- a/src/Controller/PagesController.php +++ b/src/Controller/PagesController.php @@ -4,7 +4,6 @@ namespace App\Controller; use App\Entity\Pages; use App\Repository\PagesRepository; -use App\Repository\UserRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -12,9 +11,9 @@ use Symfony\Component\Routing\Annotation\Route; class PagesController extends AbstractController { #[Route(path: '/pages/{slug}', name: 'pages_display')] - public function display(PagesRepository $pagesRepository, UserRepository $userRepository, string $slug): Response + public function display(PagesRepository $pagesRepository, string $slug): Response { - $page = $pagesRepository->findOneBy([ + $page = $pagesRepository->findOneBy(criteria: [ 'slug' => $slug, ]); @@ -24,17 +23,8 @@ class PagesController extends AbstractController $page->setContent(content: '404 - The requested page was not found.'); } - dump($page); - dump($page->getOwner()); - $user = $userRepository->findOneBy(['id' => $page->getOwner()->getId()]); - dd($user); - return $this->render(view: '@default/pages/index.html.twig', parameters: [ - 'page_name' => $page->getName(), - 'page_content' => $page->getContent(), - 'created_at' => $page->getCreatedAt(), - 'modified_at' => $page->getModifiedAt(), - 'owner' => $page->getOwner() + 'page' => $page, ]); } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index ed6ca09..afad2ef 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -21,7 +21,7 @@ class UserController extends BaseController { #[Route(path: '/profile/edit/{username}', name: 'app_profile_edit')] - public function editProfile(Request $request, UserRepository $userRepository, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, string $username = ''): Response + public function editProfile(Request $request, UserRepository $userRepository, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, string $username = ''): Response { if ($username !== '') { if ($this->isGranted(attribute: 'ROLE_ADMIN')) { @@ -29,7 +29,7 @@ class UserController extends BaseController 'username' => $username, ]); } else { - throw new AccessDeniedException(message: 'Only admins are allowed to edit Profiles.'); + throw new AccessDeniedException(message: 'Only admins are allowed to edit foreign profiles.'); } } else { $user = $this->getUser(); @@ -43,12 +43,12 @@ class UserController extends BaseController // if there's a new password, use it if ($form->get(name: 'newPassword')->getData()) - $user->setPassword( - password: $userPasswordHasher->hashPassword( - user: $user, - plainPassword: $form->get(name: 'newPassword')->getData() - ) - ); + $user->setPassword( + password: $userPasswordHasher->hashPassword( + user: $user, + plainPassword: $form->get(name: 'newPassword')->getData() + ) + ); $entityManager->persist(entity: $user); $entityManager->flush(); @@ -64,14 +64,9 @@ class UserController extends BaseController 'user' => $user, 'userForm' => $form ]); - - - if (isset($user)) { - } else { - throw new UserNotFoundException(); - } } + #[Route(path: '/profile/{username}', name: 'app_profile')] public function showProfile(UserRepository $userRepository, string $username = ''): Response { @@ -84,7 +79,7 @@ class UserController extends BaseController ]); } - return $this->render(view: 'user/show_profile.html.twig', parameters: [ + return $this->render(view: '@default/user/show_profile.html.twig', parameters: [ 'user' => $user, ]); } @@ -94,7 +89,7 @@ class UserController extends BaseController { $users = $userRepository->findAll(); - return $this->render(view: 'user/list_users.html.twig', parameters: [ + return $this->render(view: '@default/user/list_users.html.twig', parameters: [ 'users' => $users, ]); } diff --git a/templates/themes/default/base.html.twig b/templates/themes/default/base.html.twig index 745287b..00dcbd6 100644 --- a/templates/themes/default/base.html.twig +++ b/templates/themes/default/base.html.twig @@ -42,27 +42,27 @@