From a500089f8ae9d552254d301b440a314b78ab9ee3 Mon Sep 17 00:00:00 2001 From: Le TOULLEC Martial <308012+koromerzhin@users.noreply.github.com> Date: Thu, 30 Sep 2021 17:41:22 +0200 Subject: [PATCH] New features (#400) Co-authored-by: Restyled.io Co-authored-by: Renovate Bot Co-authored-by: Le TOULLEC Martial <308012+koromerzhin@users.noreply.github.com> Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Makefile | 9 +- apps/composer.json | 2 - apps/composer.lock | 150 +-------- apps/config/packages/workflows/bookmark.yaml | 34 ++ apps/json/menuadmin.json | 27 +- .../2021/09/Version20210928191806.php | 45 +++ apps/src/Command/LabstagUserCommand.php | 12 +- .../Controller/Admin/BookmarkController.php | 223 ++++++++++++++ .../Admin/{Post => }/CategoryController.php | 10 +- .../Admin/{Post => }/LibelleController.php | 90 +++--- .../Admin/{Post => }/PostController.php | 4 +- .../Controller/Api/AttachmentController.php | 11 + apps/src/Controller/BookmarkController.php | 112 +++++++ apps/src/Controller/PostController.php | 4 +- apps/src/DataFixtures/AdresseUserFixtures.php | 24 ++ apps/src/DataFixtures/BookmarkFixtures.php | 96 ++++++ apps/src/DataFixtures/EmailUserFixtures.php | 15 + apps/src/DataFixtures/GroupFixtures.php | 14 + apps/src/DataFixtures/LienUserFixtures.php | 16 + apps/src/DataFixtures/NoteInterneFixtures.php | 34 ++ apps/src/DataFixtures/PhoneUserFixtures.php | 20 ++ apps/src/DataFixtures/PostFixtures.php | 2 +- apps/src/DataFixtures/UserFixtures.php | 22 ++ apps/src/Entity/Attachment.php | 66 ++-- apps/src/Entity/Bookmark.php | 290 ++++++++++++++++++ apps/src/Entity/Category.php | 40 ++- apps/src/Entity/Edito.php | 31 +- apps/src/Entity/Email.php | 32 +- apps/src/Entity/EmailUser.php | 3 +- apps/src/Entity/Libelle.php | 35 ++- apps/src/Entity/LienUser.php | 3 +- apps/src/Entity/NoteInterne.php | 31 +- apps/src/Entity/Phone.php | 32 +- apps/src/Entity/Post.php | 34 +- apps/src/Entity/Traits/StateableEntity.php | 46 +++ apps/src/Entity/User.php | 66 ++-- .../BookmarkWorkflowSubscriber.php | 67 ++++ .../EventSubscriber/UserEntitySubscriber.php | 29 ++ apps/src/Form/Admin/BookmarkType.php | 148 +++++++++ .../Form/Admin/{Post => }/CategoryType.php | 2 +- .../src/Form/Admin/{Post => }/LibelleType.php | 2 +- apps/src/Form/Admin/{Post => }/PostType.php | 2 +- apps/src/FormType/SearchableType.php | 3 - apps/src/Lib/FixtureLib.php | 180 ++--------- apps/src/Repository/BookmarkRepository.php | 68 ++++ apps/src/Repository/CategoryRepository.php | 20 +- apps/src/Repository/EditoRepository.php | 9 +- apps/src/Repository/LibelleRepository.php | 21 ++ apps/src/Repository/NoteInterneRepository.php | 11 +- apps/src/Repository/PostRepository.php | 51 +-- .../RequestHandler/BookmarkRequestHandler.php | 9 + apps/src/Security/Voter/BookmarkVoter.php | 24 ++ apps/src/Twig/LabstagExtension.php | 16 +- apps/symfony.lock | 6 - apps/templates/admin/bookmark/form.html.twig | 25 ++ apps/templates/admin/bookmark/index.html.twig | 44 +++ .../category => bookmark}/layout.html.twig | 0 apps/templates/admin/bookmark/show.html.twig | 78 +++++ .../admin/{post => }/category/index.html.twig | 4 +- .../libelle => category}/layout.html.twig | 0 .../admin/{post => }/category/macro.html.twig | 0 .../admin/{post => }/category/show.html.twig | 2 +- .../admin/{post => }/libelle/index.html.twig | 2 +- apps/templates/admin/libelle/layout.html.twig | 1 + .../admin/{post => }/libelle/show.html.twig | 2 +- .../templates/front/bookmarks/aside.html.twig | 24 ++ .../templates/front/bookmarks/index.html.twig | 52 ++++ apps/templates/front/bookmarks/list.html.twig | 52 ++++ apps/templates/front/bookmarks/show.html.twig | 45 +++ apps/templates/front/index.html.twig | 48 +-- apps/templates/front/posts/aside.html.twig | 4 +- apps/templates/skeleton/home/header.html.twig | 2 - apps/templates/skeleton/home/menu.html.twig | 4 + apps/translations/admin.breadcrumb.fr.yaml | 18 +- apps/translations/admin.form.fr.yaml | 24 +- apps/translations/admin.header.fr.yaml | 3 +- apps/translations/admin.messages.fr.yaml | 12 +- apps/translations/messages.fr.yaml | 4 + assets/scss/front.scss | 6 +- 79 files changed, 2128 insertions(+), 681 deletions(-) create mode 100644 apps/config/packages/workflows/bookmark.yaml create mode 100644 apps/migrations/2021/09/Version20210928191806.php create mode 100644 apps/src/Controller/Admin/BookmarkController.php rename apps/src/Controller/Admin/{Post => }/CategoryController.php (96%) rename apps/src/Controller/Admin/{Post => }/LibelleController.php (57%) rename apps/src/Controller/Admin/{Post => }/PostController.php (98%) create mode 100644 apps/src/Controller/BookmarkController.php create mode 100644 apps/src/DataFixtures/BookmarkFixtures.php create mode 100644 apps/src/Entity/Bookmark.php create mode 100644 apps/src/Entity/Traits/StateableEntity.php create mode 100644 apps/src/EventSubscriber/BookmarkWorkflowSubscriber.php create mode 100644 apps/src/Form/Admin/BookmarkType.php rename apps/src/Form/Admin/{Post => }/CategoryType.php (98%) rename apps/src/Form/Admin/{Post => }/LibelleType.php (97%) rename apps/src/Form/Admin/{Post => }/PostType.php (99%) create mode 100644 apps/src/Repository/BookmarkRepository.php create mode 100644 apps/src/RequestHandler/BookmarkRequestHandler.php create mode 100644 apps/src/Security/Voter/BookmarkVoter.php create mode 100644 apps/templates/admin/bookmark/form.html.twig create mode 100644 apps/templates/admin/bookmark/index.html.twig rename apps/templates/admin/{post/category => bookmark}/layout.html.twig (100%) create mode 100644 apps/templates/admin/bookmark/show.html.twig rename apps/templates/admin/{post => }/category/index.html.twig (78%) rename apps/templates/admin/{post/libelle => category}/layout.html.twig (100%) rename apps/templates/admin/{post => }/category/macro.html.twig (100%) rename apps/templates/admin/{post => }/category/show.html.twig (88%) rename apps/templates/admin/{post => }/libelle/index.html.twig (95%) create mode 100644 apps/templates/admin/libelle/layout.html.twig rename apps/templates/admin/{post => }/libelle/show.html.twig (88%) create mode 100644 apps/templates/front/bookmarks/aside.html.twig create mode 100644 apps/templates/front/bookmarks/index.html.twig create mode 100644 apps/templates/front/bookmarks/list.html.twig create mode 100644 apps/templates/front/bookmarks/show.html.twig create mode 100644 apps/templates/skeleton/home/menu.html.twig diff --git a/Makefile b/Makefile index ac0b50c2e..e4a5257f7 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,10 @@ apps/phpstan.phar: apps/phpDocumentor.phar: $(DOCKER_EXECPHP) wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.1.2/phpDocumentor.phar -phar: apps/phploc.phar apps/phpmd.phar apps/php-cs-fixer.phar apps/phpcbf.phar apps/phpcs.phar apps/phpstan.phar apps/phpDocumentor.phar +apps/behat.phar: + $(DOCKER_EXECPHP) wget https://github.com/Behat/Behat/releases/download/v3.8.1/behat.phar + +phar: apps/phploc.phar apps/phpmd.phar apps/php-cs-fixer.phar apps/phpcbf.phar apps/phpcs.phar apps/phpstan.phar apps/phpDocumentor.phar apps/behat.phar apps/composer.lock: isdocker apps/composer.json ${COMPOSER_EXEC} update @@ -288,11 +291,11 @@ else endif .PHONY: tests -tests: isdocker ### Scripts tests +tests: isdocker phar ### Scripts tests ifeq ($(COMMANDS_ARGS),launch) @$(DOCKER_EXECPHP) make tests all else ifeq ($(COMMANDS_ARGS),behat) - ${COMPOSER_EXEC} run behat + ${PHP_EXEC} behat.phar --config behat.yaml else ifeq ($(COMMANDS_ARGS),simple-phpunit-unit-integration) ${COMPOSER_EXEC} run simple-phpunit-unit-integration else ifeq ($(COMMANDS_ARGS),simple-phpunit) diff --git a/apps/composer.json b/apps/composer.json index 04bccf762..a5ac47ea9 100644 --- a/apps/composer.json +++ b/apps/composer.json @@ -95,7 +95,6 @@ "wohali/oauth2-discord-new": "1.1.0" }, "require-dev": { - "behat/behat": "3.8.1", "doctrine/doctrine-fixtures-bundle": "3.4.0", "povils/phpmnd": "2.4.0", "symfony/browser-kit": "5.3.4", @@ -139,7 +138,6 @@ }, "scripts": { "phpmnd": "phpmnd src features/bootstrap tests", - "behat": "behat --config behat.yaml", "simple-phpunit": "simple-phpunit --verbose", "simple-phpunit-unit-integration": "simple-phpunit --testsuite unit,integration --verbose", "auto-scripts": { diff --git a/apps/composer.lock b/apps/composer.lock index 8156ef25a..41bb8037d 100644 --- a/apps/composer.lock +++ b/apps/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": "acfd90dc7db8e09986d7dbda8743c404", + "content-hash": "1c65b5af288cbd97c0e017cda0651f16", "packages": [ { "name": "adam-paterson/oauth2-slack", @@ -12065,154 +12065,6 @@ } ], "packages-dev": [ - { - "name": "behat/behat", - "version": "v3.8.1", - "source": { - "type": "git", - "url": "https://github.com/Behat/Behat.git", - "reference": "fbb065457d523d9856d4b50775b4151a7598b510" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/fbb065457d523d9856d4b50775b4151a7598b510", - "reference": "fbb065457d523d9856d4b50775b4151a7598b510", - "shasum": "" - }, - "require": { - "behat/gherkin": "^4.6.0", - "behat/transliterator": "^1.2", - "ext-mbstring": "*", - "php": "^7.2 || ^8.0", - "psr/container": "^1.0", - "symfony/config": "^4.4 || ^5.0", - "symfony/console": "^4.4 || ^5.0", - "symfony/dependency-injection": "^4.4 || ^5.0", - "symfony/event-dispatcher": "^4.4 || ^5.0", - "symfony/translation": "^4.4 || ^5.0", - "symfony/yaml": "^4.4 || ^5.0" - }, - "require-dev": { - "container-interop/container-interop": "^1.2", - "herrera-io/box": "~1.6.1", - "phpunit/phpunit": "^8.5 || ^9.0", - "symfony/process": "^4.4 || ^5.0" - }, - "suggest": { - "ext-dom": "Needed to output test results in JUnit format." - }, - "bin": [ - "bin/behat" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Behat\\Behat\\": "src/Behat/Behat/", - "Behat\\Testwork\\": "src/Behat/Testwork/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Scenario-oriented BDD framework for PHP", - "homepage": "http://behat.org/", - "keywords": [ - "Agile", - "BDD", - "ScenarioBDD", - "Scrum", - "StoryBDD", - "User story", - "business", - "development", - "documentation", - "examples", - "symfony", - "testing" - ], - "support": { - "issues": "https://github.com/Behat/Behat/issues", - "source": "https://github.com/Behat/Behat/tree/v3.8.1" - }, - "time": "2020-11-07T15:55:18+00:00" - }, - { - "name": "behat/gherkin", - "version": "v4.8.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "2391482cd003dfdc36b679b27e9f5326bd656acd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/2391482cd003dfdc36b679b27e9f5326bd656acd", - "reference": "2391482cd003dfdc36b679b27e9f5326bd656acd", - "shasum": "" - }, - "require": { - "php": "~7.2|~8.0" - }, - "require-dev": { - "cucumber/cucumber": "dev-gherkin-16.0.0", - "phpunit/phpunit": "~8|~9", - "symfony/phpunit-bridge": "~3|~4|~5", - "symfony/yaml": "~3|~4|~5" - }, - "suggest": { - "symfony/yaml": "If you want to parse features, represented in YAML files" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Gherkin DSL parser for PHP", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "Cucumber", - "DSL", - "gherkin", - "parser" - ], - "support": { - "issues": "https://github.com/Behat/Gherkin/issues", - "source": "https://github.com/Behat/Gherkin/tree/v4.8.0" - }, - "time": "2021-02-04T12:44:21+00:00" - }, { "name": "doctrine/data-fixtures", "version": "1.5.0", diff --git a/apps/config/packages/workflows/bookmark.yaml b/apps/config/packages/workflows/bookmark.yaml new file mode 100644 index 000000000..0b294336d --- /dev/null +++ b/apps/config/packages/workflows/bookmark.yaml @@ -0,0 +1,34 @@ +framework: + workflows: + bookmark: + type: "state_machine" # or 'state_machine' + audit_trail: + enabled: true + marking_store: + type: "method" + property: "state" + supports: + - Labstag\Entity\Bookmark + initial_marking: start + places: + - start + - brouillon + - relecture + - publie + - rejete + transitions: + submit: + from: start + to: brouillon + relire: + from: brouillon + to: relecture + corriger: + from: relecture + to: brouillon + publier: + from: relecture + to: publie + rejeter: + from: relecture + to: rejete diff --git a/apps/json/menuadmin.json b/apps/json/menuadmin.json index 510cd86a7..192a8f4e1 100755 --- a/apps/json/menuadmin.json +++ b/apps/json/menuadmin.json @@ -118,25 +118,17 @@ "libelle": "Etablissements", "childs": [] }, - { - "libelle": "Histoires", - "childs": [] - }, - { - "libelle": "Bookmarks", - "childs": [] - }, { "libelle": "Partenaires", "childs": [] }, { - "libelle": "Posts", + "libelle": "Data", "childs": [ { "libelle": "Libelle", "data": { - "route": "admin_postlibelle_index" + "route": "admin_libelle_index" } }, { @@ -144,12 +136,23 @@ "data": { "route": "admin_category_index" } - }, + } + ] + }, + { + "libelle": "Contenu", + "childs": [ { - "libelle": "Liste", + "libelle": "Posts", "data": { "route": "admin_post_index" } + }, + { + "libelle": "Bookmarks", + "data": { + "route": "admin_bookmark_index" + } } ] } diff --git a/apps/migrations/2021/09/Version20210928191806.php b/apps/migrations/2021/09/Version20210928191806.php new file mode 100644 index 000000000..a8c14c982 --- /dev/null +++ b/apps/migrations/2021/09/Version20210928191806.php @@ -0,0 +1,45 @@ +addSql('CREATE TABLE bookmark (id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', img_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', refcategory_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', refuser_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', content LONGTEXT NOT NULL, meta_description VARCHAR(255) NOT NULL, meta_keywords VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, state LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', published DATETIME NOT NULL, state_changed DATETIME DEFAULT NULL, url VARCHAR(255) NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_DA62921DC06A9F55 (img_id), INDEX IDX_DA62921D77C88284 (refcategory_id), INDEX IDX_DA62921D2B445CEF (refuser_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE bookmark_libelle (bookmark_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', libelle_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', INDEX IDX_C90E6C6292741D25 (bookmark_id), INDEX IDX_C90E6C6225DD318D (libelle_id), PRIMARY KEY(bookmark_id, libelle_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921DC06A9F55 FOREIGN KEY (img_id) REFERENCES attachment (id)'); + $this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D77C88284 FOREIGN KEY (refcategory_id) REFERENCES category (id)'); + $this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D2B445CEF FOREIGN KEY (refuser_id) REFERENCES user (id)'); + $this->addSql('ALTER TABLE bookmark_libelle ADD CONSTRAINT FK_C90E6C6292741D25 FOREIGN KEY (bookmark_id) REFERENCES bookmark (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bookmark_libelle ADD CONSTRAINT FK_C90E6C6225DD318D FOREIGN KEY (libelle_id) REFERENCES libelle (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE email CHANGE refuser_id refuser_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\''); + $this->addSql('ALTER TABLE lien CHANGE refuser_id refuser_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\''); + $this->addSql('ALTER TABLE post CHANGE refuser_id refuser_id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\''); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE bookmark_libelle DROP FOREIGN KEY FK_C90E6C6292741D25'); + $this->addSql('DROP TABLE bookmark'); + $this->addSql('DROP TABLE bookmark_libelle'); + $this->addSql('ALTER TABLE email CHANGE refuser_id refuser_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:guid)\''); + $this->addSql('ALTER TABLE lien CHANGE refuser_id refuser_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:guid)\''); + $this->addSql('ALTER TABLE post CHANGE refuser_id refuser_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:guid)\''); + } +} diff --git a/apps/src/Command/LabstagUserCommand.php b/apps/src/Command/LabstagUserCommand.php index 231298170..2eef2b6b9 100644 --- a/apps/src/Command/LabstagUserCommand.php +++ b/apps/src/Command/LabstagUserCommand.php @@ -29,20 +29,16 @@ class LabstagUserCommand extends Command protected UserRequestHandler $userRequestHandler; - protected UserRequestHandler $userRH; - protected Registry $workflows; public function __construct( UserRepository $userRepository, GroupeRepository $groupeRepository, Registry $workflows, - UserRequestHandler $userRH, EntityManagerInterface $entityManager, UserRequestHandler $userRequestHandler ) { - $this->userRH = $userRH; $this->groupeRepository = $groupeRepository; $this->entityManager = $entityManager; $this->workflows = $workflows; @@ -179,8 +175,10 @@ protected function delete($helper, string $username, $inputOutput, InputInterfac return; } + $old = clone $entity; $this->entityManager->remove($entity); $this->entityManager->flush(); + $this->userRequestHandler->handle($old, $entity); $inputOutput->success('Utilisateur supprimé'); } @@ -221,8 +219,10 @@ protected function disable($helper, $username, $inputOutput, InputInterface $inp return; } + $old = clone $entity; $workflow->apply($entity, 'desactiver'); $this->entityManager->flush(); + $this->userRequestHandler->handle($old, $entity); $inputOutput->success('Utilisateur désactivé'); } @@ -263,8 +263,10 @@ protected function enable($helper, $username, $inputOutput, InputInterface $inpu return; } + $old = clone $entity; $workflow->apply($entity, 'activer'); $this->entityManager->flush(); + $this->userRequestHandler->handle($old, $entity); $inputOutput->success('Utilisateur activé'); } @@ -421,7 +423,7 @@ protected function updatePassword($helper, $username, $inputOutput, InputInterfa $old = clone $entity; $entity->setPlainPassword($password1); - $this->userRH->handle($old, $entity); + $this->userRequestHandler->handle($old, $entity); $inputOutput->success('Mot de passe changé'); } } diff --git a/apps/src/Controller/Admin/BookmarkController.php b/apps/src/Controller/Admin/BookmarkController.php new file mode 100644 index 000000000..161b366b3 --- /dev/null +++ b/apps/src/Controller/Admin/BookmarkController.php @@ -0,0 +1,223 @@ +modalAttachmentDelete(); + + return $this->update( + $uploadAnnotReader, + $attachmentRepository, + $attachmentRH, + $requestHandler, + BookmarkType::class, + $bookmark, + [ + 'delete' => 'api_action_delete', + 'list' => 'admin_bookmark_index', + 'show' => 'admin_bookmark_show', + ], + 'admin/bookmark/form.html.twig' + ); + } + + /** + * @Route("/trash", name="admin_bookmark_trash", methods={"GET"}) + * @Route("/", name="admin_bookmark_index", methods={"GET"}) + * @IgnoreSoftDelete + */ + public function indexOrTrash(BookmarkRepository $repository): Response + { + return $this->listOrTrash( + $repository, + [ + 'trash' => 'findTrashForAdmin', + 'all' => 'findAllForAdmin', + ], + 'admin/bookmark/index.html.twig', + [ + 'new' => 'admin_bookmark_new', + 'empty' => 'api_action_empty', + 'trash' => 'admin_bookmark_trash', + 'list' => 'admin_bookmark_index', + ], + [ + 'list' => 'admin_bookmark_index', + 'show' => 'admin_bookmark_show', + 'preview' => 'admin_bookmark_preview', + 'edit' => 'admin_bookmark_edit', + 'delete' => 'api_action_delete', + 'destroy' => 'api_action_destroy', + 'restore' => 'api_action_restore', + 'workflow' => 'api_action_workflow', + ] + ); + } + + /** + * @Route("/new", name="admin_bookmark_new", methods={"GET","POST"}) + */ + public function new( + UploadAnnotationReader $uploadAnnotReader, + AttachmentRepository $attachmentRepository, + AttachmentRequestHandler $attachmentRH, + BookmarkRequestHandler $requestHandler + ): Response + { + return $this->create( + $uploadAnnotReader, + $attachmentRepository, + $attachmentRH, + $requestHandler, + new Bookmark(), + BookmarkType::class, + ['list' => 'admin_bookmark_index'], + 'admin/bookmark/form.html.twig' + ); + } + + /** + * @Route("/{id}", name="admin_bookmark_show", methods={"GET"}) + * @Route("/preview/{id}", name="admin_bookmark_preview", methods={"GET"}) + * @IgnoreSoftDelete + */ + public function showOrPreview( + Bookmark $bookmark + ): Response + { + return $this->renderShowOrPreview( + $bookmark, + 'admin/bookmark/show.html.twig', + [ + 'delete' => 'api_action_delete', + 'restore' => 'api_action_restore', + 'destroy' => 'api_action_destroy', + 'edit' => 'admin_bookmark_edit', + 'list' => 'admin_bookmark_index', + 'trash' => 'admin_bookmark_trash', + ] + ); + } + + protected function setBreadcrumbsPageAdminBookmark(): array + { + return [ + [ + 'title' => $this->translator->trans('bookmark.title', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_index', + 'route_params' => [], + ], + ]; + } + + protected function setBreadcrumbsPageAdminBookmarkEdit(): array + { + $request = $this->get('request_stack')->getCurrentRequest(); + $all = $request->attributes->all(); + $routeParams = $all['_route_params']; + + return [ + [ + 'title' => $this->translator->trans('bookmark.edit', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_edit', + 'route_params' => $routeParams, + ], + ]; + } + + protected function setBreadcrumbsPageAdminBookmarkNew(): array + { + return [ + [ + 'title' => $this->translator->trans('bookmark.new', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_new', + 'route_params' => [], + ], + ]; + } + + protected function setBreadcrumbsPageAdminBookmarkPreview(): array + { + $request = $this->get('request_stack')->getCurrentRequest(); + $all = $request->attributes->all(); + $routeParams = $all['_route_params']; + + return [ + [ + 'title' => $this->translator->trans('bookmark.trash', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_trash', + 'route_params' => [], + ], + [ + 'title' => $this->translator->trans('bookmark.preview', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_preview', + 'route_params' => $routeParams, + ], + ]; + } + + protected function setBreadcrumbsPageAdminBookmarkShow(): array + { + $request = $this->get('request_stack')->getCurrentRequest(); + $all = $request->attributes->all(); + $routeParams = $all['_route_params']; + + return [ + [ + 'title' => $this->translator->trans('bookmark.show', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_show', + 'route_params' => $routeParams, + ], + ]; + } + + protected function setBreadcrumbsPageAdminBookmarkTrash(): array + { + return [ + [ + 'title' => $this->translator->trans('bookmark.trash', [], 'admin.breadcrumb'), + 'route' => 'admin_bookmark_trash', + 'route_params' => [], + ], + ]; + } + + protected function setHeaderTitle(): array + { + $headers = parent::setHeaderTitle(); + + return array_merge( + $headers, + [ + 'admin_bookmark' => $this->translator->trans('bookmark.title', [], 'admin.header'), + ] + ); + } +} diff --git a/apps/src/Controller/Admin/Post/CategoryController.php b/apps/src/Controller/Admin/CategoryController.php similarity index 96% rename from apps/src/Controller/Admin/Post/CategoryController.php rename to apps/src/Controller/Admin/CategoryController.php index 249d57b7f..ce6fa3ab9 100644 --- a/apps/src/Controller/Admin/Post/CategoryController.php +++ b/apps/src/Controller/Admin/CategoryController.php @@ -1,10 +1,10 @@ 'findTrashParentForAdmin', 'all' => 'findAllParentForAdmin', ], - 'admin/post/category/index.html.twig', + 'admin/category/index.html.twig', [ 'new' => 'admin_category_new', 'empty' => 'api_action_empty', @@ -112,7 +112,7 @@ public function showOrPreview( { return $this->renderShowOrPreview( $category, - 'admin/post/category/show.html.twig', + 'admin/category/show.html.twig', [ 'delete' => 'api_action_delete', 'restore' => 'api_action_restore', diff --git a/apps/src/Controller/Admin/Post/LibelleController.php b/apps/src/Controller/Admin/LibelleController.php similarity index 57% rename from apps/src/Controller/Admin/Post/LibelleController.php rename to apps/src/Controller/Admin/LibelleController.php index 88e508f30..180361701 100644 --- a/apps/src/Controller/Admin/Post/LibelleController.php +++ b/apps/src/Controller/Admin/LibelleController.php @@ -1,10 +1,10 @@ 'api_action_delete', - 'list' => 'admin_postlibelle_index', - 'show' => 'admin_postlibelle_show', + 'list' => 'admin_libelle_index', + 'show' => 'admin_libelle_show', ] ); } /** - * @Route("/trash", name="admin_postlibelle_trash", methods={"GET"}) - * @Route("/", name="admin_postlibelle_index", methods={"GET"}) + * @Route("/trash", name="admin_libelle_trash", methods={"GET"}) + * @Route("/", name="admin_libelle_index", methods={"GET"}) * @IgnoreSoftDelete */ public function indexOrTrash(LibelleRepository $repository): Response @@ -60,18 +60,18 @@ public function indexOrTrash(LibelleRepository $repository): Response 'trash' => 'findTrashForAdmin', 'all' => 'findAllForAdmin', ], - 'admin/post/libelle/index.html.twig', + 'admin/libelle/index.html.twig', [ - 'new' => 'admin_postlibelle_new', + 'new' => 'admin_libelle_new', 'empty' => 'api_action_empty', - 'trash' => 'admin_postlibelle_trash', - 'list' => 'admin_postlibelle_index', + 'trash' => 'admin_libelle_trash', + 'list' => 'admin_libelle_index', ], [ - 'list' => 'admin_postlibelle_index', - 'show' => 'admin_postlibelle_show', - 'preview' => 'admin_postlibelle_preview', - 'edit' => 'admin_postlibelle_edit', + 'list' => 'admin_libelle_index', + 'show' => 'admin_libelle_show', + 'preview' => 'admin_libelle_preview', + 'edit' => 'admin_libelle_edit', 'delete' => 'api_action_delete', 'destroy' => 'api_action_destroy', 'restore' => 'api_action_restore', @@ -81,7 +81,7 @@ public function indexOrTrash(LibelleRepository $repository): Response } /** - * @Route("/new", name="admin_postlibelle_new", methods={"GET","POST"}) + * @Route("/new", name="admin_libelle_new", methods={"GET","POST"}) */ public function new( UploadAnnotationReader $uploadAnnotReader, @@ -97,13 +97,13 @@ public function new( $requestHandler, new Libelle(), LibelleType::class, - ['list' => 'admin_postlibelle_index'] + ['list' => 'admin_libelle_index'] ); } /** - * @Route("/{id}", name="admin_postlibelle_show", methods={"GET"}) - * @Route("/preview/{id}", name="admin_postlibelle_preview", methods={"GET"}) + * @Route("/{id}", name="admin_libelle_show", methods={"GET"}) + * @Route("/preview/{id}", name="admin_libelle_preview", methods={"GET"}) * @IgnoreSoftDelete */ public function showOrPreview( @@ -112,30 +112,30 @@ public function showOrPreview( { return $this->renderShowOrPreview( $libelle, - 'admin/post/libelle/show.html.twig', + 'admin/libelle/show.html.twig', [ 'delete' => 'api_action_delete', 'restore' => 'api_action_restore', 'destroy' => 'api_action_destroy', - 'edit' => 'admin_postlibelle_edit', - 'list' => 'admin_postlibelle_index', - 'trash' => 'admin_postlibelle_trash', + 'edit' => 'admin_libelle_edit', + 'list' => 'admin_libelle_index', + 'trash' => 'admin_libelle_trash', ] ); } - protected function setBreadcrumbsPageAdminPostlibelle(): array + protected function setBreadcrumbsPageAdminlibelle(): array { return [ [ - 'title' => $this->translator->trans('postlibelle.title', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_index', + 'title' => $this->translator->trans('libelle.title', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_index', 'route_params' => [], ], ]; } - protected function setBreadcrumbsPageAdminPostlibelleEdit(): array + protected function setBreadcrumbsPageAdminlibelleEdit(): array { $request = $this->get('request_stack')->getCurrentRequest(); $all = $request->attributes->all(); @@ -143,25 +143,25 @@ protected function setBreadcrumbsPageAdminPostlibelleEdit(): array return [ [ - 'title' => $this->translator->trans('postlibelle.edit', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_edit', + 'title' => $this->translator->trans('libelle.edit', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_edit', 'route_params' => $routeParams, ], ]; } - protected function setBreadcrumbsPageAdminPostlibelleNew(): array + protected function setBreadcrumbsPageAdminlibelleNew(): array { return [ [ - 'title' => $this->translator->trans('postlibelle.new', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_new', + 'title' => $this->translator->trans('libelle.new', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_new', 'route_params' => [], ], ]; } - protected function setBreadcrumbsPageAdminPostlibellePreview(): array + protected function setBreadcrumbsPageAdminlibellePreview(): array { $request = $this->get('request_stack')->getCurrentRequest(); $all = $request->attributes->all(); @@ -169,19 +169,19 @@ protected function setBreadcrumbsPageAdminPostlibellePreview(): array return [ [ - 'title' => $this->translator->trans('postlibelle.trash', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_trash', + 'title' => $this->translator->trans('libelle.trash', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_trash', 'route_params' => [], ], [ - 'title' => $this->translator->trans('postlibelle.preview', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_preview', + 'title' => $this->translator->trans('libelle.preview', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_preview', 'route_params' => $routeParams, ], ]; } - protected function setBreadcrumbsPageAdminPostlibelleShow(): array + protected function setBreadcrumbsPageAdminlibelleShow(): array { $request = $this->get('request_stack')->getCurrentRequest(); $all = $request->attributes->all(); @@ -189,19 +189,19 @@ protected function setBreadcrumbsPageAdminPostlibelleShow(): array return [ [ - 'title' => $this->translator->trans('postlibelle.show', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_show', + 'title' => $this->translator->trans('libelle.show', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_show', 'route_params' => $routeParams, ], ]; } - protected function setBreadcrumbsPageAdminPostlibelleTrash(): array + protected function setBreadcrumbsPageAdminlibelleTrash(): array { return [ [ - 'title' => $this->translator->trans('postlibelle.trash', [], 'admin.breadcrumb'), - 'route' => 'admin_postlibelle_trash', + 'title' => $this->translator->trans('libelle.trash', [], 'admin.breadcrumb'), + 'route' => 'admin_libelle_trash', 'route_params' => [], ], ]; @@ -214,7 +214,7 @@ protected function setHeaderTitle(): array return array_merge( $headers, [ - 'admin_postlibelle' => $this->translator->trans('postlibelle.title', [], 'admin.header'), + 'admin_libelle' => $this->translator->trans('libelle.title', [], 'admin.header'), ] ); } diff --git a/apps/src/Controller/Admin/Post/PostController.php b/apps/src/Controller/Admin/PostController.php similarity index 98% rename from apps/src/Controller/Admin/Post/PostController.php rename to apps/src/Controller/Admin/PostController.php index ea7f616fd..892adafbe 100644 --- a/apps/src/Controller/Admin/Post/PostController.php +++ b/apps/src/Controller/Admin/PostController.php @@ -1,10 +1,10 @@ deleteFile($entity, $postRequestHandler, 'getImg', 'setImg'); + } + /** * @Route("/edito/fond/{entity}", name="api_attachment_editofond") * diff --git a/apps/src/Controller/BookmarkController.php b/apps/src/Controller/BookmarkController.php new file mode 100644 index 000000000..c7038610d --- /dev/null +++ b/apps/src/Controller/BookmarkController.php @@ -0,0 +1,112 @@ +paginator->paginate( + $bookmarkRepository->findPublierCategory($code), + $request->query->getInt('page', 1), + 10 + ); + + return $this->render( + 'front/bookmarks/list.html.twig', + [ + 'pagination' => $pagination, + 'libelles' => $libelleRepository->findByBookmark(), + 'categories' => $categoryRepository->findByBookmark(), + ] + ); + } + + /** + * @Route("/", name="bookmark_index") + */ + public function index( + Request $request, + BookmarkRepository $bookmarkRepository, + LibelleRepository $libelleRepository, + CategoryRepository $categoryRepository + ): Response + { + $pagination = $this->paginator->paginate( + $bookmarkRepository->findPublier(), + $request->query->getInt('page', 1), + 10 + ); + + return $this->render( + 'front/bookmarks/index.html.twig', + [ + 'pagination' => $pagination, + 'libelles' => $libelleRepository->findByBookmark(), + 'categories' => $categoryRepository->findByBookmark(), + ] + ); + } + + /** + * @Route("/libelle/{code}", name="bookmark_libelle") + * + * @return void + */ + public function libelle( + BookmarkRepository $bookmarkRepository, + Request $request, + string $code, + LibelleRepository $libelleRepository, + CategoryRepository $categoryRepository + ) + { + $pagination = $this->paginator->paginate( + $bookmarkRepository->findPublierLibelle($code), + $request->query->getInt('page', 1), + 10 + ); + + return $this->render( + 'front/bookmarks/list.html.twig', + [ + 'pagination' => $pagination, + 'libelles' => $libelleRepository->findByBookmark(), + 'categories' => $categoryRepository->findByBookmark(), + ] + ); + } + + /** + * @Route("/{slug}", name="bookmark_show") + */ + public function show( + Bookmark $bookmark + ) + { + return $this->redirect($bookmark->getUrl()); + } +} diff --git a/apps/src/Controller/PostController.php b/apps/src/Controller/PostController.php index 96e43159b..628684ebd 100644 --- a/apps/src/Controller/PostController.php +++ b/apps/src/Controller/PostController.php @@ -86,10 +86,8 @@ public function libelle( CategoryRepository $categoryRepository ) { - $posts = $postRepository->findPublierLibelle($code); - dump($posts->getSql()); $pagination = $this->paginator->paginate( - $posts, + $postRepository->findPublierLibelle($code), $request->query->getInt('page', 1), 10 ); diff --git a/apps/src/DataFixtures/AdresseUserFixtures.php b/apps/src/DataFixtures/AdresseUserFixtures.php index 2015eec52..1c3f52262 100644 --- a/apps/src/DataFixtures/AdresseUserFixtures.php +++ b/apps/src/DataFixtures/AdresseUserFixtures.php @@ -6,6 +6,9 @@ DependentFixtureInterface as DependentInterface }; use Doctrine\Persistence\ObjectManager; +use Faker\Generator; +use Labstag\Entity\AdresseUser; +use Labstag\Entity\User; use Labstag\Lib\FixtureLib; class AdresseUserFixtures extends FixtureLib implements DependentInterface @@ -29,4 +32,25 @@ public function load(ObjectManager $manager): void $this->addAdresse($faker, $user); } } + + protected function addAdresse( + Generator $faker, + User $user + ): void + { + $adresse = new AdresseUser(); + $old = clone $adresse; + $adresse->setRefuser($user); + $adresse->setRue($faker->streetAddress); + $adresse->setVille($faker->city); + $adresse->setCountry($faker->countryCode); + $adresse->setZipcode($faker->postcode); + $adresse->setType($faker->unique()->colorName); + $latitude = $faker->latitude; + $longitude = $faker->longitude; + $gps = $latitude.','.$longitude; + $adresse->setGps($gps); + $adresse->setPmr((bool) rand(0, 1)); + $this->adresseUserRH->handle($old, $adresse); + } } diff --git a/apps/src/DataFixtures/BookmarkFixtures.php b/apps/src/DataFixtures/BookmarkFixtures.php new file mode 100644 index 000000000..3aa8efd93 --- /dev/null +++ b/apps/src/DataFixtures/BookmarkFixtures.php @@ -0,0 +1,96 @@ +setFaker(); + $statesTab = $this->getStates(); + for ($index = 0; $index < self::NUMBER_BOOKMARK; ++$index) { + $stateId = array_rand($statesTab); + $states = $statesTab[$stateId]; + $this->addLink($faker, $states); + } + } + + protected function addLink( + Generator $faker, + array $states + ): void + { + $bookmark = new Bookmark(); + $old = clone $bookmark; + if (1 == rand(0, 1)) { + $nbr = $faker->numberBetween(0, self::NUMBER_LIBELLE - 1); + for ($i = 0; $i < $nbr; ++$i) { + $indexLibelle = $faker->numberBetween(0, self::NUMBER_LIBELLE - 1); + $libelle = $this->getReference('libelle_'.$indexLibelle); + $bookmark->addLibelle($libelle); + } + } + + $users = $this->installService->getData('user'); + $indexUser = $faker->numberBetween(0, count($users) - 1); + $user = $this->getReference('user_'.$indexUser); + $bookmark->setRefuser($user); + // @var string $content + $content = $faker->paragraphs(rand(4, 10), true); + $bookmark->setContent(str_replace("\n\n", "
\n", $content)); + $bookmark->setMetaKeywords(implode(', ', $faker->unique()->words(rand(4, 10)))); + $bookmark->setMetaDescription($faker->unique()->sentence); + $indexLibelle = $faker->numberBetween(0, self::NUMBER_CATEGORY - 1); + $category = $this->getReference('category_'.$indexLibelle); + $bookmark->setRefcategory($category); + $bookmark->setName($faker->word()); + $bookmark->setUrl($faker->url); + $bookmark->setPublished($faker->unique()->dateTime('now')); + $this->upload($bookmark, $faker); + $this->bookmarkRH->handle($old, $bookmark); + $this->bookmarkRH->changeWorkflowState($bookmark, $states); + } + + protected function getStates() + { + return [ + ['submit'], + [ + 'submit', + 'relire', + ], + [ + 'submit', + 'relire', + 'corriger', + ], + [ + 'submit', + 'relire', + 'publier', + ], + [ + 'submit', + 'relire', + 'rejete', + ], + ]; + } +} diff --git a/apps/src/DataFixtures/EmailUserFixtures.php b/apps/src/DataFixtures/EmailUserFixtures.php index 11248e7f8..67d17b9d8 100644 --- a/apps/src/DataFixtures/EmailUserFixtures.php +++ b/apps/src/DataFixtures/EmailUserFixtures.php @@ -4,6 +4,9 @@ use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; +use Faker\Generator; +use Labstag\Entity\EmailUser; +use Labstag\Entity\User; use Labstag\Lib\FixtureLib; class EmailUserFixtures extends FixtureLib implements DependentFixtureInterface @@ -27,4 +30,16 @@ public function load(ObjectManager $manager): void $this->addEmail($faker, $user); } } + + protected function addEmail( + Generator $faker, + User $user + ): void + { + $email = new EmailUser(); + $old = clone $email; + $email->setRefuser($user); + $email->setAdresse($faker->safeEmail); + $this->emailUserRH->handle($old, $email); + } } diff --git a/apps/src/DataFixtures/GroupFixtures.php b/apps/src/DataFixtures/GroupFixtures.php index 62c6c8b45..7b07686bb 100644 --- a/apps/src/DataFixtures/GroupFixtures.php +++ b/apps/src/DataFixtures/GroupFixtures.php @@ -4,6 +4,7 @@ use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; +use Labstag\Entity\Groupe; use Labstag\Lib\FixtureLib; class GroupFixtures extends FixtureLib implements DependentFixtureInterface @@ -21,4 +22,17 @@ public function load(ObjectManager $manager): void $this->addGroupe($key, $row); } } + + protected function addGroupe( + int $key, + string $row + ): void + { + $groupe = new Groupe(); + $old = clone $groupe; + $groupe->setCode($row); + $groupe->setName($row); + $this->addReference('groupe_'.$key, $groupe); + $this->groupeRH->handle($old, $groupe); + } } diff --git a/apps/src/DataFixtures/LienUserFixtures.php b/apps/src/DataFixtures/LienUserFixtures.php index 86b5132e9..5871bcb68 100644 --- a/apps/src/DataFixtures/LienUserFixtures.php +++ b/apps/src/DataFixtures/LienUserFixtures.php @@ -4,6 +4,9 @@ use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; +use Faker\Generator; +use Labstag\Entity\LienUser; +use Labstag\Entity\User; use Labstag\Lib\FixtureLib; class LienUserFixtures extends FixtureLib implements DependentFixtureInterface @@ -27,4 +30,17 @@ public function load(ObjectManager $manager): void $this->addLink($faker, $user); } } + + protected function addLink( + Generator $faker, + User $user + ): void + { + $lien = new LienUser(); + $old = clone $lien; + $lien->setRefUser($user); + $lien->setName($faker->word()); + $lien->setAdresse($faker->url); + $this->lienUserRH->handle($old, $lien); + } } diff --git a/apps/src/DataFixtures/NoteInterneFixtures.php b/apps/src/DataFixtures/NoteInterneFixtures.php index 6fee76861..834c40913 100644 --- a/apps/src/DataFixtures/NoteInterneFixtures.php +++ b/apps/src/DataFixtures/NoteInterneFixtures.php @@ -2,8 +2,11 @@ namespace Labstag\DataFixtures; +use DateTime; use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; +use Faker\Generator; +use Labstag\Entity\NoteInterne; use Labstag\Lib\FixtureLib; class NoteInterneFixtures extends FixtureLib implements DependentFixtureInterface @@ -30,6 +33,37 @@ public function load(ObjectManager $manager): void } } + protected function addNoteInterne( + array $users, + Generator $faker, + int $index, + DateTime $maxDate, + array $states + ): void + { + $noteinterne = new NoteInterne(); + $old = clone $noteinterne; + $random = $faker->numberBetween(5, 50); + $noteinterne->setTitle($faker->unique()->text($random)); + $dateDebut = $faker->dateTime($maxDate); + $noteinterne->setDateDebut($dateDebut); + $dateFin = clone $dateDebut; + $dateFin->modify('+'.$faker->numberBetween(10, 50).' days'); + $dateFin->modify('+'.$faker->numberBetween(2, 24).' hours'); + $noteinterne->setDateFin($dateFin); + // @var string $content + $content = $faker->paragraphs(4, true); + $noteinterne->setContent(str_replace("\n\n", "
\n", $content)); + $this->addReference('noteinterne_'.$index, $noteinterne); + $tabIndex = array_rand($users); + // @var User $user + $user = $users[$tabIndex]; + $noteinterne->setRefuser($user); + $this->upload($noteinterne, $faker); + $this->noteInterneRH->handle($old, $noteinterne); + $this->noteInterneRH->changeWorkflowState($noteinterne, $states); + } + protected function getStates() { return [ diff --git a/apps/src/DataFixtures/PhoneUserFixtures.php b/apps/src/DataFixtures/PhoneUserFixtures.php index 089f89026..840b10da3 100644 --- a/apps/src/DataFixtures/PhoneUserFixtures.php +++ b/apps/src/DataFixtures/PhoneUserFixtures.php @@ -4,6 +4,9 @@ use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; +use Faker\Generator; +use Labstag\Entity\PhoneUser; +use Labstag\Entity\User; use Labstag\Lib\FixtureLib; class PhoneUserFixtures extends FixtureLib implements DependentFixtureInterface @@ -31,6 +34,23 @@ public function load(ObjectManager $manager): void } } + protected function addPhone( + Generator $faker, + User $user, + array $states + ): void + { + $number = $faker->e164PhoneNumber; + $phone = new PhoneUser(); + $old = clone $phone; + $phone->setRefuser($user); + $phone->setNumero($number); + $phone->setType($faker->word()); + $phone->setCountry($faker->countryCode); + $this->phoneUserRH->handle($old, $phone); + $this->phoneUserRH->changeWorkflowState($phone, $states); + } + protected function getStates() { return [ diff --git a/apps/src/DataFixtures/PostFixtures.php b/apps/src/DataFixtures/PostFixtures.php index 194b2b3f5..ddcde36cd 100644 --- a/apps/src/DataFixtures/PostFixtures.php +++ b/apps/src/DataFixtures/PostFixtures.php @@ -72,7 +72,7 @@ protected function addPost( $this->upload($post, $faker); $this->addReference('post_'.$index, $post); $this->templateRH->handle($oldPost, $post); - $this->editoRH->changeWorkflowState($post, $states); + $this->postRH->changeWorkflowState($post, $states); } protected function getStates() diff --git a/apps/src/DataFixtures/UserFixtures.php b/apps/src/DataFixtures/UserFixtures.php index 59229809e..ccfc22a38 100644 --- a/apps/src/DataFixtures/UserFixtures.php +++ b/apps/src/DataFixtures/UserFixtures.php @@ -4,6 +4,8 @@ use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\Persistence\ObjectManager; +use Faker\Generator; +use Labstag\Entity\User; use Labstag\Lib\FixtureLib; class UserFixtures extends FixtureLib implements DependentFixtureInterface @@ -26,4 +28,24 @@ public function load(ObjectManager $manager): void $this->addUser($groupes, $index, $user, $faker); } } + + protected function addUser( + array $groupes, + int $index, + array $dataUser, + Generator $faker + ): void + { + $user = new User(); + $old = clone $user; + + $user->setRefgroupe($this->getRefgroupe($groupes, $dataUser['groupe'])); + $user->setUsername($dataUser['username']); + $user->setPlainPassword($dataUser['password']); + $user->setEmail($dataUser['email']); + $this->upload($user, $faker); + $this->addReference('user_'.$index, $user); + $this->userRH->handle($old, $user); + $this->userRH->changeWorkflowState($user, $dataUser['state']); + } } diff --git a/apps/src/Entity/Attachment.php b/apps/src/Entity/Attachment.php index f7e56cf00..e92896a90 100644 --- a/apps/src/Entity/Attachment.php +++ b/apps/src/Entity/Attachment.php @@ -2,12 +2,12 @@ namespace Labstag\Entity; -use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; +use Labstag\Entity\Traits\StateableEntity; use Labstag\Repository\AttachmentRepository; /** @@ -18,6 +18,8 @@ class Attachment { use SoftDeleteableEntity; + use StateableEntity; + /** * @ORM\Column(type="simple_array", nullable=true) */ @@ -60,28 +62,20 @@ class Attachment */ protected $size; - /** - * @ORM\Column(type="array") - */ - protected $state; - /** * @ORM\OneToMany(targetEntity=User::class, mappedBy="avatar") */ protected $users; /** - * @ORM\Column(type="string", length=255, nullable=true) + * @ORM\OneToMany(targetEntity=Bookmark::class, mappedBy="img") */ - private $code; + private $bookmarks; /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) + * @ORM\Column(type="string", length=255, nullable=true) */ - private $stateChanged; + private $code; public function __construct() { @@ -89,6 +83,17 @@ public function __construct() $this->posts = new ArrayCollection(); $this->editos = new ArrayCollection(); $this->noteInternes = new ArrayCollection(); + $this->bookmarks = new ArrayCollection(); + } + + public function addBookmark(Bookmark $bookmark): self + { + if (!$this->bookmarks->contains($bookmark)) { + $this->bookmarks[] = $bookmark; + $bookmark->setImg($this); + } + + return $this; } public function addEdito(Edito $edito): self @@ -131,6 +136,14 @@ public function addUser(User $user): self return $this; } + /** + * @return Bookmark[]|Collection + */ + public function getBookmarks(): Collection + { + return $this->bookmarks; + } + public function getCode(): ?string { return $this->code; @@ -185,16 +198,6 @@ public function getSize(): ?int return $this->size; } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - /** * @return Collection|User[] */ @@ -203,6 +206,18 @@ public function getUsers(): Collection return $this->users; } + public function removeBookmark(Bookmark $bookmark): self + { + if ($this->bookmarks->removeElement($bookmark)) { + // set the owning side to null (unless already changed) + if ($bookmark->getImg() === $this) { + $bookmark->setImg(null); + } + } + + return $this; + } + public function removeEdito(Edito $edito): self { if ($this->editos->removeElement($edito)) { @@ -285,9 +300,4 @@ public function setSize(?int $size): self return $this; } - - public function setState($state) - { - $this->state = $state; - } } diff --git a/apps/src/Entity/Bookmark.php b/apps/src/Entity/Bookmark.php new file mode 100644 index 000000000..de62ed88c --- /dev/null +++ b/apps/src/Entity/Bookmark.php @@ -0,0 +1,290 @@ +libelles = new ArrayCollection(); + } + + public function addLibelle(Libelle $libelle): self + { + if (!$this->libelles->contains($libelle)) { + $this->libelles[] = $libelle; + } + + return $this; + } + + public function getContent(): ?string + { + return $this->content; + } + + public function getFile() + { + return $this->file; + } + + public function getId(): ?string + { + return $this->id; + } + + public function getImg(): ?Attachment + { + return $this->img; + } + + /** + * @return Collection|Libelle[] + */ + public function getLibelles(): Collection + { + return $this->libelles; + } + + public function getMetaDescription(): ?string + { + return $this->metaDescription; + } + + public function getMetaKeywords(): ?string + { + return $this->metaKeywords; + } + + public function getName(): ?string + { + return $this->name; + } + + public function getPublished(): ?DateTimeInterface + { + return $this->published; + } + + public function getRefcategory(): ?Category + { + return $this->refcategory; + } + + public function getRefuser(): ?User + { + return $this->refuser; + } + + public function getSlug(): ?string + { + return $this->slug; + } + + public function getState() + { + return $this->state; + } + + public function getStateChanged() + { + return $this->stateChanged; + } + + public function getUrl(): ?string + { + return $this->url; + } + + public function removeLibelle(Libelle $libelle): self + { + $this->libelles->removeElement($libelle); + + return $this; + } + + public function setContent(string $content): self + { + $this->content = $content; + + return $this; + } + + public function setFile($file): self + { + $this->file = $file; + + return $this; + } + + public function setImg(?Attachment $img): self + { + $this->img = $img; + + return $this; + } + + public function setMetaDescription(string $metaDescription): self + { + $this->metaDescription = $metaDescription; + + return $this; + } + + public function setMetaKeywords(string $metaKeywords): self + { + $this->metaKeywords = $metaKeywords; + + return $this; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function setPublished(DateTimeInterface $published): self + { + $this->published = $published; + + return $this; + } + + public function setRefcategory(?Category $refcategory): self + { + $this->refcategory = $refcategory; + + return $this; + } + + public function setRefuser(?User $refuser): self + { + $this->refuser = $refuser; + + return $this; + } + + public function setSlug(string $slug): self + { + $this->slug = $slug; + + return $this; + } + + public function setState($state): self + { + $this->state = $state; + + return $this; + } + + public function setUrl(string $url): self + { + $this->url = $url; + + return $this; + } +} diff --git a/apps/src/Entity/Category.php b/apps/src/Entity/Category.php index 9f8b32969..1dd2b6bd9 100644 --- a/apps/src/Entity/Category.php +++ b/apps/src/Entity/Category.php @@ -17,6 +17,11 @@ class Category { use SoftDeleteableEntity; + /** + * @ORM\OneToMany(targetEntity=Bookmark::class, mappedBy="refcategory") + */ + private $bookmarks; + /** * @ORM\OneToMany(targetEntity=Category::class, mappedBy="parent", cascade={"persist"}) */ @@ -57,8 +62,9 @@ class Category public function __construct() { - $this->children = new ArrayCollection(); - $this->posts = new ArrayCollection(); + $this->children = new ArrayCollection(); + $this->posts = new ArrayCollection(); + $this->bookmarks = new ArrayCollection(); } public function __toString() @@ -69,6 +75,16 @@ public function __toString() return $text.$this->getName(); } + public function addBookmark(Bookmark $bookmark): self + { + if (!$this->bookmarks->contains($bookmark)) { + $this->bookmarks[] = $bookmark; + $bookmark->setRefcategory($this); + } + + return $this; + } + public function addChild(self $child): self { if (!$this->children->contains($child)) { @@ -89,6 +105,14 @@ public function addPost(Post $post): self return $this; } + /** + * @return Bookmark[]|Collection + */ + public function getBookmarks(): Collection + { + return $this->bookmarks; + } + /** * @return Collection|self[] */ @@ -125,6 +149,18 @@ public function getSlug(): ?string return $this->slug; } + public function removeBookmark(Bookmark $bookmark): self + { + if ($this->bookmarks->removeElement($bookmark)) { + // set the owning side to null (unless already changed) + if ($bookmark->getRefcategory() === $this) { + $bookmark->setRefcategory(null); + } + } + + return $this; + } + public function removeChild(self $child): self { if ($this->children->removeElement($child)) { diff --git a/apps/src/Entity/Edito.php b/apps/src/Entity/Edito.php index dcf68ccad..6404a21bf 100644 --- a/apps/src/Entity/Edito.php +++ b/apps/src/Entity/Edito.php @@ -9,6 +9,7 @@ use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; use Labstag\Annotation\Uploadable; use Labstag\Annotation\UploadableField; +use Labstag\Entity\Traits\StateableEntity; use Labstag\Repository\EditoRepository; use Symfony\Component\Validator\Constraints as Assert; @@ -21,6 +22,8 @@ class Edito { use SoftDeleteableEntity; + use StateableEntity; + /** * @ORM\Column(type="text") * @Assert\NotBlank @@ -50,11 +53,6 @@ class Edito */ protected $refuser; - /** - * @ORM\Column(type="array") - */ - protected $state; - /** * @ORM\Column(type="string", length=255, unique=true, nullable=false) * @Assert\NotBlank @@ -76,14 +74,6 @@ class Edito */ private $published; - /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) - */ - private $stateChanged; - public function __toString() { return $this->getTitle(); @@ -129,16 +119,6 @@ public function getRefuser(): ?User return $this->refuser; } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - public function getTitle(): ?string { return $this->title; @@ -193,11 +173,6 @@ public function setRefuser(?User $refuser): self return $this; } - public function setState($state) - { - $this->state = $state; - } - public function setTitle(string $title): self { $this->title = $title; diff --git a/apps/src/Entity/Email.php b/apps/src/Entity/Email.php index 0c582ff41..4fa0fb6b2 100644 --- a/apps/src/Entity/Email.php +++ b/apps/src/Entity/Email.php @@ -2,10 +2,10 @@ namespace Labstag\Entity; -use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; +use Labstag\Entity\Traits\StateableEntity; use Symfony\Component\Validator\Constraints as Assert; /** @@ -19,6 +19,8 @@ abstract class Email { use SoftDeleteableEntity; + use StateableEntity; + /** * @ORM\Column(type="string", length=255) * @@ -41,19 +43,6 @@ abstract class Email */ protected $principal; - /** - * @ORM\Column(type="array") - */ - protected $state; - - /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) - */ - private $stateChanged; - public function __construct() { $this->principal = false; @@ -74,16 +63,6 @@ public function getId(): ?string return $this->id; } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - public function isPrincipal(): ?bool { return $this->principal; @@ -102,9 +81,4 @@ public function setPrincipal(bool $principal): self return $this; } - - public function setState($state) - { - $this->state = $state; - } } diff --git a/apps/src/Entity/EmailUser.php b/apps/src/Entity/EmailUser.php index 40a15b4e9..6c74566bb 100644 --- a/apps/src/Entity/EmailUser.php +++ b/apps/src/Entity/EmailUser.php @@ -4,7 +4,6 @@ use Doctrine\ORM\Mapping as ORM; use Labstag\Repository\EmailUserRepository; -use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass=EmailUserRepository::class) @@ -14,7 +13,7 @@ class EmailUser extends Email /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="emailUsers") - * @Assert\NotBlank + * @ORM\JoinColumn(nullable=false) */ protected $refuser; diff --git a/apps/src/Entity/Libelle.php b/apps/src/Entity/Libelle.php index d8077db4d..7a2b2a10b 100644 --- a/apps/src/Entity/Libelle.php +++ b/apps/src/Entity/Libelle.php @@ -17,6 +17,11 @@ class Libelle { use SoftDeleteableEntity; + /** + * @ORM\ManyToMany(targetEntity=Bookmark::class, mappedBy="libelles") + */ + private $bookmarks; + /** * @ORM\Id * @ORM\GeneratedValue(strategy="UUID") @@ -42,7 +47,8 @@ class Libelle public function __construct() { - $this->posts = new ArrayCollection(); + $this->posts = new ArrayCollection(); + $this->bookmarks = new ArrayCollection(); } public function __toString() @@ -50,6 +56,16 @@ public function __toString() return $this->getNom(); } + public function addBookmark(Bookmark $bookmark): self + { + if (!$this->bookmarks->contains($bookmark)) { + $this->bookmarks[] = $bookmark; + $bookmark->addLibelle($this); + } + + return $this; + } + public function addPost(Post $post): self { if (!$this->posts->contains($post)) { @@ -59,6 +75,14 @@ public function addPost(Post $post): self return $this; } + /** + * @return Bookmark[]|Collection + */ + public function getBookmarks(): Collection + { + return $this->bookmarks; + } + public function getId(): ?string { return $this->id; @@ -82,6 +106,15 @@ public function getSlug(): ?string return $this->slug; } + public function removeBookmark(Bookmark $bookmark): self + { + if ($this->bookmarks->removeElement($bookmark)) { + $bookmark->removeLibelle($this); + } + + return $this; + } + public function removePost(Post $post): self { $this->posts->removeElement($post); diff --git a/apps/src/Entity/LienUser.php b/apps/src/Entity/LienUser.php index 7525c68f3..54fef56fa 100644 --- a/apps/src/Entity/LienUser.php +++ b/apps/src/Entity/LienUser.php @@ -4,7 +4,6 @@ use Doctrine\ORM\Mapping as ORM; use Labstag\Repository\LienUserRepository; -use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass=LienUserRepository::class) @@ -14,7 +13,7 @@ class LienUser extends Lien /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="lienUsers") - * @Assert\NotBlank + * @ORM\JoinColumn(nullable=false) */ protected $refuser; diff --git a/apps/src/Entity/NoteInterne.php b/apps/src/Entity/NoteInterne.php index 7a823a108..bf6c20d49 100644 --- a/apps/src/Entity/NoteInterne.php +++ b/apps/src/Entity/NoteInterne.php @@ -8,6 +8,7 @@ use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; use Labstag\Annotation\Uploadable; use Labstag\Annotation\UploadableField; +use Labstag\Entity\Traits\StateableEntity; use Labstag\Repository\NoteInterneRepository; use Symfony\Component\Validator\Constraints as Assert; @@ -20,6 +21,8 @@ class NoteInterne { use SoftDeleteableEntity; + use StateableEntity; + /** * @ORM\Column(type="text") * @Assert\NotBlank @@ -61,25 +64,12 @@ class NoteInterne */ protected $refuser; - /** - * @ORM\Column(type="array") - */ - protected $state; - /** * @ORM\Column(type="string", length=255, unique=true, nullable=false) * @Assert\NotBlank */ protected $title; - /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) - */ - private $stateChanged; - public function __construct() { $this->dateDebut = new DateTime(); @@ -126,16 +116,6 @@ public function getRefuser(): ?User return $this->refuser; } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - public function getTitle(): ?string { return $this->title; @@ -183,11 +163,6 @@ public function setRefuser(?User $refuser): self return $this; } - public function setState($state) - { - $this->state = $state; - } - public function setTitle(string $title): self { $this->title = $title; diff --git a/apps/src/Entity/Phone.php b/apps/src/Entity/Phone.php index 00d559dc8..79c102df4 100644 --- a/apps/src/Entity/Phone.php +++ b/apps/src/Entity/Phone.php @@ -2,10 +2,10 @@ namespace Labstag\Entity; -use DateTime; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; +use Labstag\Entity\Traits\StateableEntity; use Symfony\Component\Validator\Constraints as Assert; /** @@ -19,6 +19,8 @@ abstract class Phone { use SoftDeleteableEntity; + use StateableEntity; + /** * @ORM\Column(type="string", length=255, nullable=true) * @Assert\NotBlank @@ -44,25 +46,12 @@ abstract class Phone */ protected $principal; - /** - * @ORM\Column(type="array") - */ - protected $state; - /** * @ORM\Column(type="string", length=255) * @Assert\NotBlank */ protected $type; - /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) - */ - private $stateChanged; - public function __construct() { $this->principal = false; @@ -94,16 +83,6 @@ public function getNumero(): ?string return $this->numero; } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - public function getType(): ?string { return $this->type; @@ -135,11 +114,6 @@ public function setPrincipal(bool $principal): self return $this; } - public function setState($state) - { - $this->state = $state; - } - public function setType(string $type): self { $this->type = $type; diff --git a/apps/src/Entity/Post.php b/apps/src/Entity/Post.php index 318a2b3f4..08fd791e7 100644 --- a/apps/src/Entity/Post.php +++ b/apps/src/Entity/Post.php @@ -11,7 +11,9 @@ use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; use Labstag\Annotation\Uploadable; use Labstag\Annotation\UploadableField; +use Labstag\Entity\Traits\StateableEntity; use Labstag\Repository\PostRepository; +use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass=PostRepository::class) @@ -22,16 +24,13 @@ class Post { use SoftDeleteableEntity; + use StateableEntity; + /** * @UploadableField(filename="img", path="post/img", slug="title") */ protected $file; - /** - * @ORM\Column(type="array") - */ - protected $state; - /** * @ORM\Column(type="boolean") */ @@ -89,6 +88,8 @@ class Post /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="posts") + * @Assert\NotBlank + * @ORM\JoinColumn(nullable=false) */ private $refuser; @@ -98,14 +99,6 @@ class Post */ private $slug; - /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) - */ - private $stateChanged; - /** * @ORM\Column(type="string", length=255, unique=true, nullable=false) */ @@ -207,16 +200,6 @@ public function getSlug(): ?string return $this->slug; } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - public function getTitle(): ?string { return $this->title; @@ -306,11 +289,6 @@ public function setSlug(string $slug): self return $this; } - public function setState($state) - { - $this->state = $state; - } - public function setTitle(string $title): self { $this->title = $title; diff --git a/apps/src/Entity/Traits/StateableEntity.php b/apps/src/Entity/Traits/StateableEntity.php new file mode 100644 index 000000000..603e1cb88 --- /dev/null +++ b/apps/src/Entity/Traits/StateableEntity.php @@ -0,0 +1,46 @@ + + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) + */ +trait StateableEntity +{ + + /** + * @ORM\Column(type="array") + */ + protected $state; + + /** + * @var DateTime + * + * @ORM\Column(name="state_changed", type="datetime", nullable=true) + * @Gedmo\Timestampable(on="change", field={"state"}) + */ + private $stateChanged; + + public function getState() + { + return $this->state; + } + + public function getStateChanged() + { + return $this->stateChanged; + } + + public function setState($state) + { + $this->state = $state; + } +} diff --git a/apps/src/Entity/User.php b/apps/src/Entity/User.php index d1ec6e54d..975af47fd 100644 --- a/apps/src/Entity/User.php +++ b/apps/src/Entity/User.php @@ -2,7 +2,6 @@ namespace Labstag\Entity; -use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -10,6 +9,7 @@ use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; use Labstag\Annotation\Uploadable; use Labstag\Annotation\UploadableField; +use Labstag\Entity\Traits\StateableEntity; use Labstag\Repository\UserRepository; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -24,6 +24,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface { use SoftDeleteableEntity; + use StateableEntity; + /** * @ORM\OneToMany( * targetEntity=AdresseUser::class, @@ -136,11 +138,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface */ protected $routes; - /** - * @ORM\Column(type="array") - */ - protected $state; - /** * @ORM\Column(type="string", length=180, unique=true, nullable=false) * @Assert\NotNull @@ -148,17 +145,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface protected $username; /** - * @ORM\OneToMany(targetEntity=Post::class, mappedBy="refuser") + * @ORM\OneToMany(targetEntity=Bookmark::class, mappedBy="refuser", cascade={"persist"}) */ - private $posts; + private $bookmarks; /** - * @var DateTime - * - * @ORM\Column(name="state_changed", type="datetime", nullable=true) - * @Gedmo\Timestampable(on="change", field={"state"}) + * @ORM\OneToMany(targetEntity=Post::class, mappedBy="refuser", cascade={"persist"}) */ - private $stateChanged; + private $posts; /** * @ORM\OneToMany(targetEntity=WorkflowUser::class, mappedBy="refuser") @@ -178,6 +172,7 @@ public function __construct() $this->routes = new ArrayCollection(); $this->workflowUsers = new ArrayCollection(); $this->posts = new ArrayCollection(); + $this->bookmarks = new ArrayCollection(); } public function __toString() @@ -195,6 +190,16 @@ public function addAdresseUser(AdresseUser $adresseUser): self return $this; } + public function addBookmark(Bookmark $bookmark): self + { + if (!$this->bookmarks->contains($bookmark)) { + $this->bookmarks[] = $bookmark; + $bookmark->setRefuser($this); + } + + return $this; + } + public function addEdito(Edito $edito): self { if (!$this->editos->contains($edito)) { @@ -306,6 +311,14 @@ public function getAvatar(): ?Attachment return $this->avatar; } + /** + * @return Bookmark[]|Collection + */ + public function getBookmarks(): Collection + { + return $this->bookmarks; + } + public function getEditos() { return $this->editos; @@ -414,16 +427,6 @@ public function getSalt(): ?string // not needed when using the "bcrypt" algorithm in security.yaml } - public function getState() - { - return $this->state; - } - - public function getStateChanged() - { - return $this->stateChanged; - } - public function getUserIdentifier() { return $this->getUsername(); @@ -460,6 +463,18 @@ public function removeAdresseUser(AdresseUser $adresseUser): self return $this; } + public function removeBookmark(Bookmark $bookmark): self + { + if ($this->bookmarks->removeElement($bookmark)) { + // set the owning side to null (unless already changed) + if ($bookmark->getRefuser() === $this) { + $bookmark->setRefuser(null); + } + } + + return $this; + } + public function removeEdito(Edito $edito): self { if ($this->editos->contains($edito)) { @@ -637,11 +652,6 @@ public function setRoles(array $roles): self return $this; } - public function setState($state) - { - $this->state = $state; - } - public function setUsername(?string $username): self { $this->username = $username; diff --git a/apps/src/EventSubscriber/BookmarkWorkflowSubscriber.php b/apps/src/EventSubscriber/BookmarkWorkflowSubscriber.php new file mode 100644 index 000000000..081a6aa48 --- /dev/null +++ b/apps/src/EventSubscriber/BookmarkWorkflowSubscriber.php @@ -0,0 +1,67 @@ + 'onTransition']; + } + + public function onTransition(Event $event) + { + $transition = $event->getTransition(); + $name = $transition->getName(); + switch ($name) { + case 'submit': + $this->transitionSubmit($event); + + break; + case 'relire': + $this->transitionRelire($event); + + break; + case 'corriger': + $this->transitionCorriger($event); + + break; + case 'publier': + $this->transitionPublier($event); + + break; + case 'rejeter': + $this->transitionRejeter($event); + + break; + } + } + + public function transitionCorriger(Event $event) + { + unset($event); + } + + public function transitionPublier(Event $event) + { + unset($event); + } + + public function transitionRejeter(Event $event) + { + unset($event); + } + + public function transitionRelire(Event $event) + { + unset($event); + } + + public function transitionSubmit(Event $event) + { + unset($event); + } +} diff --git a/apps/src/EventSubscriber/UserEntitySubscriber.php b/apps/src/EventSubscriber/UserEntitySubscriber.php index f62cfde26..5328a96ad 100644 --- a/apps/src/EventSubscriber/UserEntitySubscriber.php +++ b/apps/src/EventSubscriber/UserEntitySubscriber.php @@ -60,6 +60,7 @@ public function onUserEntityEvent(UserEntityEvent $event): void $this->setPassword($newEntity); $this->setPrincipalMail($oldEntity, $newEntity); $this->setChangePassword($oldEntity, $newEntity); + $this->setDeletedAt($oldEntity, $newEntity); } protected function setChangePassword(User $oldEntity, User $newEntity): void @@ -79,6 +80,34 @@ protected function setChangePassword(User $oldEntity, User $newEntity): void ); } + protected function setDeletedAt(User $oldEntity, User $newEntity): void + { + if ($oldEntity->getDeletedAt() == $newEntity->getDeletedAt()) { + return; + } + + $states = [ + 'adresseUsers' => $newEntity->getAdresseUsers(), + 'bookmarks' => $newEntity->getBookmarks(), + 'editos' => $newEntity->getEditos(), + 'emailUsers' => $newEntity->getEmailUsers(), + 'lienUsers' => $newEntity->getLienUsers(), + 'noteInternes' => $newEntity->getNoteInternes(), + 'phoneUsers' => $newEntity->getPhoneUsers(), + 'posts' => $newEntity->getPosts(), + ]; + + $datetime = $newEntity->getDeletedAt(); + foreach ($states as $data) { + foreach ($data as $entity) { + $entity->setDeletedAt($datetime); + $this->entityManager->persist($entity); + } + + $this->entityManager->flush(); + } + } + protected function setPassword(User $user): void { $plainPassword = $user->getPlainPassword(); diff --git a/apps/src/Form/Admin/BookmarkType.php b/apps/src/Form/Admin/BookmarkType.php new file mode 100644 index 000000000..06ff558cf --- /dev/null +++ b/apps/src/Form/Admin/BookmarkType.php @@ -0,0 +1,148 @@ +add( + 'name', + TextType::class, + [ + 'label' => $this->translator->trans('bookmark.name.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.name.help', [], 'admin.form'), + ] + ); + $builder->add( + 'slug', + TextType::class, + [ + 'label' => $this->translator->trans('bookmark.slug.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.slug.help', [], 'admin.form'), + 'required' => false, + ] + ); + $builder->add( + 'published', + DateTimeType::class, + [ + 'label' => $this->translator->trans('post.published.label', [], 'admin.form'), + 'help' => $this->translator->trans('post.published.help', [], 'admin.form'), + 'date_widget' => 'single_text', + 'time_widget' => 'single_text', + 'with_seconds' => true, + ] + ); + $builder->add( + 'url', + UrlType::class, + [ + 'label' => $this->translator->trans('bookmark.url.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.url.help', [], 'admin.form'), + 'required' => false, + ] + ); + $builder->add( + 'content', + CKEditorType::class, + [ + 'label' => $this->translator->trans('bookmark.content.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.content.help', [], 'admin.form'), + ] + ); + $this->setMeta($builder); + $builder->add( + 'file', + FileType::class, + [ + 'label' => $this->translator->trans('bookmark.file.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.file.help', [], 'admin.form'), + 'required' => false, + 'attr' => ['accept' => 'image/*'], + ] + ); + $builder->add( + 'refuser', + SearchableType::class, + [ + 'label' => $this->translator->trans('bookmark.refuser.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.refuser.help', [], 'admin.form'), + 'multiple' => false, + 'class' => User::class, + 'route' => 'api_search_user', + ] + ); + $builder->add( + 'refcategory', + SearchableType::class, + [ + 'label' => $this->translator->trans('bookmark.refcategory.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.refcategory.help', [], 'admin.form'), + 'multiple' => false, + 'class' => Category::class, + 'route' => 'api_search_category', + ] + ); + $builder->add( + 'libelles', + SearchableType::class, + [ + 'label' => $this->translator->trans('bookmark.libelles.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.libelles.help', [], 'admin.form'), + 'class' => Libelle::class, + 'new' => new Libelle(), + 'add' => true, + 'route' => 'api_search_postlibelle', + ] + ); + unset($options); + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults( + [ + 'data_class' => Bookmark::class, + ] + ); + } + + protected function setMeta($builder) + { + $meta = [ + 'metaDescription' => [ + 'label' => $this->translator->trans('bookmark.metaDescription.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.metaDescription.help', [], 'admin.form'), + ], + 'metaKeywords' => [ + 'label' => $this->translator->trans('bookmark.metaKeywords.label', [], 'admin.form'), + 'help' => $this->translator->trans('bookmark.metaKeywords.help', [], 'admin.form'), + ], + ]; + + foreach ($meta as $key => $values) { + $builder->add($key, TextType::class, $values); + } + } +} diff --git a/apps/src/Form/Admin/Post/CategoryType.php b/apps/src/Form/Admin/CategoryType.php similarity index 98% rename from apps/src/Form/Admin/Post/CategoryType.php rename to apps/src/Form/Admin/CategoryType.php index a1e66a806..0342e8219 100644 --- a/apps/src/Form/Admin/Post/CategoryType.php +++ b/apps/src/Form/Admin/CategoryType.php @@ -1,6 +1,6 @@ entityManager; $repository = $entityManager->getRepository($options['class']); - dump($ids); foreach ($ids as $id => $key) { $entity = $repository->find($key); if ($entity instanceof $options['class']) { @@ -140,8 +139,6 @@ protected function addToentity(array $ids, $options) $ids[$id] = $entity->getId(); } - dump($ids); - return $ids; } diff --git a/apps/src/Lib/FixtureLib.php b/apps/src/Lib/FixtureLib.php index 21bef5262..0b42633b0 100644 --- a/apps/src/Lib/FixtureLib.php +++ b/apps/src/Lib/FixtureLib.php @@ -3,24 +3,18 @@ namespace Labstag\Lib; use Bluemmb\Faker\PicsumPhotosProvider; -use DateTime; use Doctrine\Bundle\FixturesBundle\Fixture; use Exception; use Faker\Factory; use Faker\Generator; -use Labstag\Entity\AdresseUser; use Labstag\Entity\Attachment; -use Labstag\Entity\EmailUser; use Labstag\Entity\Groupe; -use Labstag\Entity\LienUser; -use Labstag\Entity\NoteInterne; -use Labstag\Entity\PhoneUser; -use Labstag\Entity\User; use Labstag\Reader\UploadAnnotationReader; use Labstag\Repository\GroupeRepository; use Labstag\Repository\UserRepository; use Labstag\RequestHandler\AdresseUserRequestHandler; use Labstag\RequestHandler\AttachmentRequestHandler; +use Labstag\RequestHandler\BookmarkRequestHandler; use Labstag\RequestHandler\CategoryRequestHandler; use Labstag\RequestHandler\EditoRequestHandler; use Labstag\RequestHandler\EmailUserRequestHandler; @@ -29,6 +23,7 @@ use Labstag\RequestHandler\LienUserRequestHandler; use Labstag\RequestHandler\NoteInterneRequestHandler; use Labstag\RequestHandler\PhoneUserRequestHandler; +use Labstag\RequestHandler\PostRequestHandler; use Labstag\RequestHandler\TemplateRequestHandler; use Labstag\RequestHandler\UserRequestHandler; use Labstag\Service\GuardService; @@ -46,6 +41,8 @@ abstract class FixtureLib extends Fixture { protected const NUMBER_ADRESSE = 25; + protected const NUMBER_BOOKMARK = 25; + protected const NUMBER_CATEGORY = 50; protected const NUMBER_EDITO = 25; @@ -68,6 +65,8 @@ abstract class FixtureLib extends Fixture protected AttachmentRequestHandler $attachmentRH; + protected BookmarkRequestHandler $bookmarkRH; + protected CacheInterface $cache; protected CategoryRequestHandler $categoryRH; @@ -98,6 +97,8 @@ abstract class FixtureLib extends Fixture protected PhoneUserRequestHandler $phoneUserRH; + protected PostRequestHandler $postRH; + protected TemplateRequestHandler $templateRH; protected Environment $twig; @@ -130,158 +131,35 @@ public function __construct( TemplateRequestHandler $templateRH, LibelleRequestHandler $libelleRH, CacheInterface $cache, - CategoryRequestHandler $categoryRH, + BookmarkRequestHandler $bookmarkRH, + PostRequestHandler $postRH, + CategoryRequestHandler $categoryRH ) { - $this->categoryRH = $categoryRH; + $this->adresseUserRH = $adresseUserRH; $this->attachmentRH = $attachmentRH; - $this->logger = $logger; - $this->containerBag = $containerBag; - $this->libelleRH = $libelleRH; - $this->uploadAnnotReader = $uploadAnnotReader; - $this->installService = $installService; + $this->bookmarkRH = $bookmarkRH; $this->cache = $cache; + $this->categoryRH = $categoryRH; + $this->containerBag = $containerBag; + $this->editoRH = $editoRH; + $this->emailUserRH = $emailUserRH; + $this->groupeRepository = $groupeRepository; + $this->groupeRH = $groupeRH; $this->guardService = $guardService; - $this->twig = $twig; - $this->userRepository = $userRepository; + $this->installService = $installService; + $this->libelleRH = $libelleRH; + $this->lienUserRH = $lienUserRH; + $this->logger = $logger; + $this->noteInterneRH = $noteInterneRH; $this->oauthService = $oauthService; - $this->groupeRepository = $groupeRepository; - $this->templateRH = $templateRH; - $this->adresseUserRH = $adresseUserRH; $this->phoneUserRH = $phoneUserRH; + $this->postRH = $postRH; + $this->templateRH = $templateRH; + $this->twig = $twig; + $this->uploadAnnotReader = $uploadAnnotReader; + $this->userRepository = $userRepository; $this->userRH = $userRH; - $this->editoRH = $editoRH; - $this->groupeRH = $groupeRH; - $this->noteInterneRH = $noteInterneRH; - $this->lienUserRH = $lienUserRH; - $this->emailUserRH = $emailUserRH; - } - - protected function addAdresse( - Generator $faker, - User $user - ): void - { - $adresse = new AdresseUser(); - $old = clone $adresse; - $adresse->setRefuser($user); - $adresse->setRue($faker->streetAddress); - $adresse->setVille($faker->city); - $adresse->setCountry($faker->countryCode); - $adresse->setZipcode($faker->postcode); - $adresse->setType($faker->unique()->colorName); - $latitude = $faker->latitude; - $longitude = $faker->longitude; - $gps = $latitude.','.$longitude; - $adresse->setGps($gps); - $adresse->setPmr((bool) rand(0, 1)); - $this->adresseUserRH->handle($old, $adresse); - } - - protected function addEmail( - Generator $faker, - User $user - ): void - { - $email = new EmailUser(); - $old = clone $email; - $email->setRefuser($user); - $email->setAdresse($faker->safeEmail); - $this->emailUserRH->handle($old, $email); - } - - protected function addGroupe( - int $key, - string $row - ): void - { - $groupe = new Groupe(); - $old = clone $groupe; - $groupe->setCode($row); - $groupe->setName($row); - $this->addReference('groupe_'.$key, $groupe); - $this->groupeRH->handle($old, $groupe); - } - - protected function addLink( - Generator $faker, - User $user - ): void - { - $lien = new LienUser(); - $old = clone $lien; - $lien->setRefUser($user); - $lien->setName($faker->word()); - $lien->setAdresse($faker->url); - $this->lienUserRH->handle($old, $lien); - } - - protected function addNoteInterne( - array $users, - Generator $faker, - int $index, - DateTime $maxDate, - array $states - ): void - { - $noteinterne = new NoteInterne(); - $old = clone $noteinterne; - $random = $faker->numberBetween(5, 50); - $noteinterne->setTitle($faker->unique()->text($random)); - $dateDebut = $faker->dateTime($maxDate); - $noteinterne->setDateDebut($dateDebut); - $dateFin = clone $dateDebut; - $dateFin->modify('+'.$faker->numberBetween(10, 50).' days'); - $dateFin->modify('+'.$faker->numberBetween(2, 24).' hours'); - $noteinterne->setDateFin($dateFin); - // @var string $content - $content = $faker->paragraphs(4, true); - $noteinterne->setContent(str_replace("\n\n", "
\n", $content)); - $this->addReference('noteinterne_'.$index, $noteinterne); - $tabIndex = array_rand($users); - // @var User $user - $user = $users[$tabIndex]; - $noteinterne->setRefuser($user); - $this->upload($noteinterne, $faker); - $this->noteInterneRH->handle($old, $noteinterne); - $this->noteInterneRH->changeWorkflowState($noteinterne, $states); - } - - protected function addPhone( - Generator $faker, - User $user, - array $states - ): void - { - $number = $faker->e164PhoneNumber; - $phone = new PhoneUser(); - $old = clone $phone; - $phone->setRefuser($user); - $phone->setNumero($number); - $phone->setType($faker->word()); - $phone->setCountry($faker->countryCode); - $this->phoneUserRH->handle($old, $phone); - $this->phoneUserRH->changeWorkflowState($phone, $states); - } - - protected function addUser( - array $groupes, - int $index, - array $dataUser, - Generator $faker - ): void - { - $user = new User(); - $old = clone $user; - - $user->setRefgroupe($this->getRefgroupe($groupes, $dataUser['groupe'])); - $user->setUsername($dataUser['username']); - $user->setPlainPassword($dataUser['password']); - $user->setEmail($dataUser['email']); - $this->upload($user, $faker); - $this->addReference('user_'.$index, $user); - $this->userRH->handle($old, $user); - $this->userRH->changeWorkflowState($user, $dataUser['state']); } protected function getParameter(string $name) diff --git a/apps/src/Repository/BookmarkRepository.php b/apps/src/Repository/BookmarkRepository.php new file mode 100644 index 000000000..cfc3c274b --- /dev/null +++ b/apps/src/Repository/BookmarkRepository.php @@ -0,0 +1,68 @@ +createQueryBuilder('p'); + $query = $queryBuilder->innerjoin('p.refuser', 'u'); + $query->where( + 'p.state LIKE :state' + ); + $query->orderBy('p.published', 'DESC'); + $query->setParameters( + ['state' => '%publie%'] + ); + + return $query->getQuery(); + } + + public function findPublierCategory($code) + { + $queryBuilder = $this->createQueryBuilder('b'); + $query = $queryBuilder->where('b.state LIKE :state'); + $query->orderBy('b.published', 'DESC'); + $query->leftJoin('b.refcategory', 'c'); + $query->andWhere('c.slug=:slug'); + $query->setParameters( + [ + 'slug' => $code, + 'state' => '%publie%', + ] + ); + + return $query->getQuery(); + } + + public function findPublierLibelle($code) + { + $queryBuilder = $this->createQueryBuilder('b'); + $query = $queryBuilder->where('b.state LIKE :state'); + $query->orderBy('b.published', 'DESC'); + $query->leftJoin('b.libelles', 'l'); + $query->andWhere('l.slug=:slug'); + $query->setParameters( + [ + 'slug' => $code, + 'state' => '%publie%', + ] + ); + + return $query->getQuery(); + } +} diff --git a/apps/src/Repository/CategoryRepository.php b/apps/src/Repository/CategoryRepository.php index 4dcffc168..1c64f710d 100644 --- a/apps/src/Repository/CategoryRepository.php +++ b/apps/src/Repository/CategoryRepository.php @@ -5,7 +5,6 @@ use Doctrine\Persistence\ManagerRegistry; use Labstag\Annotation\Trashable; use Labstag\Entity\Category; -use Labstag\Entity\Post; use Labstag\Lib\ServiceEntityRepositoryLib; /** @@ -33,13 +32,30 @@ public function findAllParentForAdmin() return $entityManager->createQuery($dql); } + public function findByBookmark() + { + $entityManager = $this->getEntityManager(); + $dql = $entityManager->createQueryBuilder(); + $dql->select('a'); + $dql->from(Category::class, 'a'); + $dql->leftJoin('a.bookmarks', 'b'); + $dql->innerjoin('b.refuser', 'u'); + $dql->where('b.state LIKE :state'); + $dql->setParameters( + ['state' => '%publie%'] + ); + + return $dql->getQuery()->getResult(); + } + public function findByPost() { $entityManager = $this->getEntityManager(); $dql = $entityManager->createQueryBuilder(); $dql->select('a'); $dql->from(Category::class, 'a'); - $dql->leftJoin(Post::class, 'p', 'a.id=p.refcategory_id'); + $dql->leftJoin('a.posts', 'p'); + $dql->innerjoin('p.refuser', 'u'); $dql->where('p.state LIKE :state'); $dql->setParameters( ['state' => '%publie%'] diff --git a/apps/src/Repository/EditoRepository.php b/apps/src/Repository/EditoRepository.php index 4d1d72f1d..0fa7b8dec 100644 --- a/apps/src/Repository/EditoRepository.php +++ b/apps/src/Repository/EditoRepository.php @@ -34,11 +34,12 @@ public function findAllForAdmin(): Query public function findOnePublier() { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->where( - 'u.state LIKE :state' + $queryBuilder = $this->createQueryBuilder('e'); + $query = $queryBuilder->leftjoin('e.refuser', 'u'); + $query->where( + 'e.state LIKE :state' ); - $query->orderBy('u.published', 'DESC'); + $query->orderBy('e.published', 'DESC'); $query->setParameters( ['state' => '%publie%'] ); diff --git a/apps/src/Repository/LibelleRepository.php b/apps/src/Repository/LibelleRepository.php index 4a6f51b12..af2af76cd 100644 --- a/apps/src/Repository/LibelleRepository.php +++ b/apps/src/Repository/LibelleRepository.php @@ -3,9 +3,13 @@ namespace Labstag\Repository; use Doctrine\Persistence\ManagerRegistry; +use Labstag\Annotation\Trashable; use Labstag\Entity\Libelle; use Labstag\Lib\ServiceEntityRepositoryLib; +/** + * @Trashable(url="admin_libelle_trash") + */ class LibelleRepository extends ServiceEntityRepositoryLib { public function __construct(ManagerRegistry $registry) @@ -13,6 +17,22 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, Libelle::class); } + public function findByBookmark() + { + $entityManager = $this->getEntityManager(); + $dql = $entityManager->createQueryBuilder(); + $dql->select('a'); + $dql->from(Libelle::class, 'a'); + $dql->innerJoin('a.bookmarks', 'b'); + $dql->innerjoin('b.refuser', 'u'); + $dql->where('b.state LIKE :state'); + $dql->setParameters( + ['state' => '%publie%'] + ); + + return $dql->getQuery()->getResult(); + } + public function findByPost() { $entityManager = $this->getEntityManager(); @@ -20,6 +40,7 @@ public function findByPost() $dql->select('a'); $dql->from(Libelle::class, 'a'); $dql->innerJoin('a.posts', 'p'); + $dql->innerjoin('p.refuser', 'u'); $dql->where('p.state LIKE :state'); $dql->setParameters( ['state' => '%publie%'] diff --git a/apps/src/Repository/NoteInterneRepository.php b/apps/src/Repository/NoteInterneRepository.php index 7bc1eadfd..76c2f913c 100644 --- a/apps/src/Repository/NoteInterneRepository.php +++ b/apps/src/Repository/NoteInterneRepository.php @@ -34,12 +34,13 @@ public function findAllForAdmin(): Query public function findPublier() { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->where( - 'u.state LIKE :state' + $queryBuilder = $this->createQueryBuilder('n'); + $query = $queryBuilder->innerJoin('n.refuser', 'u'); + $query->where( + 'n.state LIKE :state' ); - $query->andWhere('u.dateDebut >= now()'); - $query->orderBy('u.dateDebut', 'ASC'); + $query->andWhere('n.dateDebut >= now()'); + $query->orderBy('n.dateDebut', 'ASC'); $query->setParameters( ['state' => '%publie%'] ); diff --git a/apps/src/Repository/PostRepository.php b/apps/src/Repository/PostRepository.php index 24961d1e8..8d1897a4d 100644 --- a/apps/src/Repository/PostRepository.php +++ b/apps/src/Repository/PostRepository.php @@ -3,9 +3,13 @@ namespace Labstag\Repository; use Doctrine\Persistence\ManagerRegistry; +use Labstag\Annotation\Trashable; use Labstag\Entity\Post; use Labstag\Lib\ServiceEntityRepositoryLib; +/** + * @Trashable(url="admin_post_trash") + */ class PostRepository extends ServiceEntityRepositoryLib { public function __construct(ManagerRegistry $registry) @@ -15,14 +19,15 @@ public function __construct(ManagerRegistry $registry) public function findDateArchive() { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->select( - 'date_format(u.published,\'%Y-%m\') as code, u.published, COUNT(u)' + $queryBuilder = $this->createQueryBuilder('p'); + $query = $queryBuilder->innerjoin('p.refuser', 'u'); + $query->select( + 'date_format(p.published,\'%Y-%m\') as code, p.published, COUNT(p)' ); - $query = $queryBuilder->where( - 'u.state LIKE :state' + $query->where( + 'p.state LIKE :state' ); - $query->orderBy('u.published', 'DESC'); + $query->orderBy('p.published', 'DESC'); $query->groupBy('code'); $query->orderBy('code', 'DESC'); $query->setParameters( @@ -34,11 +39,12 @@ public function findDateArchive() public function findPublier() { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->where( - 'u.state LIKE :state' + $queryBuilder = $this->createQueryBuilder('p'); + $query = $queryBuilder->innerjoin('p.refuser', 'u'); + $query->where( + 'p.state LIKE :state' ); - $query->orderBy('u.published', 'DESC'); + $query->orderBy('p.published', 'DESC'); $query->setParameters( ['state' => '%publie%'] ); @@ -48,10 +54,11 @@ public function findPublier() public function findPublierArchive($published) { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->where('u.state LIKE :state'); - $query->andWhere('date_format(u.published,\'%Y-%m\') = :published'); - $query->orderBy('u.published', 'DESC'); + $queryBuilder = $this->createQueryBuilder('p'); + $query = $queryBuilder->innerjoin('p.refuser', 'u'); + $query->where('p.state LIKE :state'); + $query->andWhere('date_format(p.published,\'%Y-%m\') = :published'); + $query->orderBy('p.published', 'DESC'); $query->setParameters( [ 'state' => '%publie%', @@ -64,10 +71,10 @@ public function findPublierArchive($published) public function findPublierCategory($code) { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->where('u.state LIKE :state'); - $query->orderBy('u.published', 'DESC'); - $query->leftJoin('u.refcategory', 'c'); + $queryBuilder = $this->createQueryBuilder('p'); + $query = $queryBuilder->where('p.state LIKE :state'); + $query->orderBy('p.published', 'DESC'); + $query->leftJoin('p.refcategory', 'c'); $query->andWhere('c.slug=:slug'); $query->setParameters( [ @@ -81,10 +88,10 @@ public function findPublierCategory($code) public function findPublierLibelle($code) { - $queryBuilder = $this->createQueryBuilder('u'); - $query = $queryBuilder->where('u.state LIKE :state'); - $query->orderBy('u.published', 'DESC'); - $query->leftJoin('u.libelles', 'l'); + $queryBuilder = $this->createQueryBuilder('p'); + $query = $queryBuilder->where('p.state LIKE :state'); + $query->orderBy('p.published', 'DESC'); + $query->leftJoin('p.libelles', 'l'); $query->andWhere('l.slug=:slug'); $query->setParameters( [ diff --git a/apps/src/RequestHandler/BookmarkRequestHandler.php b/apps/src/RequestHandler/BookmarkRequestHandler.php new file mode 100644 index 000000000..20089de8b --- /dev/null +++ b/apps/src/RequestHandler/BookmarkRequestHandler.php @@ -0,0 +1,9 @@ + 'imagefilter', - 'workflow_has' => 'workflowHas', - 'guard_route' => 'guardRoute', - 'class_entity' => 'classEntity', 'attachment' => 'getAttachment', - 'phone_valid' => 'isPhoneValid', + 'class_entity' => 'classEntity', + 'formClass' => 'formClass', + 'formPrototype' => 'formPrototype', + 'guard_group_access' => 'guardAccessGroupRoutes', 'guard_route_enable_group' => 'guardRouteEnableGroupe', 'guard_route_enable_user' => 'guardRouteEnableUser', + 'guard_route' => 'guardRoute', 'guard_user_access' => 'guardAccessUserRoutes', - 'guard_group_access' => 'guardAccessGroupRoutes', - 'formClass' => 'formClass', + 'imagefilter' => 'imagefilter', + 'phone_valid' => 'isPhoneValid', 'verifPhone' => 'verifPhone', - 'formPrototype' => 'formPrototype', + 'workflow_has' => 'workflowHas', ]; } } diff --git a/apps/symfony.lock b/apps/symfony.lock index 2e7cf2595..36b5f5ac0 100644 --- a/apps/symfony.lock +++ b/apps/symfony.lock @@ -25,12 +25,6 @@ "beberlei/doctrineextensions": { "version": "v1.2.8" }, - "behat/behat": { - "version": "v3.7.0" - }, - "behat/gherkin": { - "version": "v4.6.2" - }, "behat/transliterator": { "version": "v1.3.0" }, diff --git a/apps/templates/admin/bookmark/form.html.twig b/apps/templates/admin/bookmark/form.html.twig new file mode 100644 index 000000000..e98d5a033 --- /dev/null +++ b/apps/templates/admin/bookmark/form.html.twig @@ -0,0 +1,25 @@ +{% import "admin/macro.html.twig" as macro_admin %} +{% extends 'admin/bookmark/layout.html.twig' %} +{% block body %} + {{ form_start(form) }} + {{ form_row(form.name) }} + {{ form_row(form.published) }} + {{ form_row(form.slug) }} + {{ form_row(form.url) }} + {{ form_row(form.content) }} + {{ form_row(form.metaDescription) }} + {{ form_row(form.metaKeywords) }} + {% if entity.id is not null %} + {{ macro_admin.form_img( + entity, + entity.img, + "bookmark.image"|trans({}, 'admin.messages'), + path('api_attachment_bookmarkimg', {'entity': entity.id}) + ) }} + {% endif %} + {{ form_row(form.file) }} + {{ form_row(form.refcategory) }} + {{ form_row(form.libelles) }} + {{ form_row(form.refuser) }} + {{ form_end(form) }} +{% endblock %} diff --git a/apps/templates/admin/bookmark/index.html.twig b/apps/templates/admin/bookmark/index.html.twig new file mode 100644 index 000000000..722e8af93 --- /dev/null +++ b/apps/templates/admin/bookmark/index.html.twig @@ -0,0 +1,44 @@ +{% import "admin/macro.html.twig" as macro_admin %} +{% extends 'admin/bookmark/layout.html.twig' %} +{% block body %} + + + + + + + + + + + + + {% for entity in pagination %} + + + + + + + + + {% endfor %} + +
{{ 'bookmark.name'|trans({}, 'admin.messages') }}{{ 'bookmark.user'|trans({}, 'admin.messages') }}{{ 'bookmark.category'|trans({}, 'admin.messages') }}{{ 'workflow.state'|trans({}, 'admin.messages') }}{{ 'bookmark.workflow'|trans({}, 'admin.messages') }}
{{ entity.name }}{{ entity.refuser }}{{ entity.refcategory }} + {% for state in workflow_marked_places(entity) %} + {{ state }} + {% endfor %} + + {{ macro_admin.workflow(entity, actions) }} + + {{ macro_admin.actions(entity, actions) }} +
+{% endblock %} diff --git a/apps/templates/admin/post/category/layout.html.twig b/apps/templates/admin/bookmark/layout.html.twig similarity index 100% rename from apps/templates/admin/post/category/layout.html.twig rename to apps/templates/admin/bookmark/layout.html.twig diff --git a/apps/templates/admin/bookmark/show.html.twig b/apps/templates/admin/bookmark/show.html.twig new file mode 100644 index 000000000..709610bd7 --- /dev/null +++ b/apps/templates/admin/bookmark/show.html.twig @@ -0,0 +1,78 @@ +{% extends 'admin/bookmark/layout.html.twig' %} +{% block body %} + + + + + + + + + + + + + + + + + + + {% set img = attachment(entity.img) %} + {% if img is not null and img.name is not null %} + + + + + {% endif %} + + + + + + + + + + + + + +
{{ 'bookmark.name'|trans({}, 'admin.messages') }}{{ entity.name }}
{{ 'bookmark.url'|trans({}, 'admin.messages') }} + + {{ entity.url }} + +
{{ 'bookmark.published'|trans({}, 'admin.messages') }}{{ entity.published|format_datetime(pattern=formatdatetime.admin) }}
{{ 'bookmark.content'|trans({}, 'admin.messages') }}{{ entity.content|raw }}
{{ 'bookmark.image'|trans({}, 'admin.messages') }} + + {{ 'bookmark.image'|trans({}, 'admin.messages')|e( + +
{{ 'bookmark.category'|trans({}, 'admin.messages') }} + {% if entity.refuser.deletedAt != '' %} + {% set url = 'admin_category_preview' %} + {% else %} + {% set url = 'admin_category_show' %} + {% endif %} + {% set state = guard_route(url) %} + {% if state == true %} + {{ entity.refcategory }} + {% else %} + {{ entity.refcategory }} + {% endif %} +
{{ 'bookmark.user'|trans({}, 'admin.messages') }} + {% if entity.refuser.deletedAt != '' %} + {% set url = 'admin_user_preview' %} + {% else %} + {% set url = 'admin_user_show' %} + {% endif %} + {% set state = guard_route(url) %} + {% if state == true %} + {{ entity.refuser }} + {% else %} + {{ entity.refuser }} + {% endif %} +
{{ 'workflow.state'|trans({}, 'admin.messages') }} + {% for state in workflow_marked_places(entity) %} + {{ state }} + {% endfor %} +
+{% endblock %} diff --git a/apps/templates/admin/post/category/index.html.twig b/apps/templates/admin/category/index.html.twig similarity index 78% rename from apps/templates/admin/post/category/index.html.twig rename to apps/templates/admin/category/index.html.twig index 650980066..1ac546408 100644 --- a/apps/templates/admin/post/category/index.html.twig +++ b/apps/templates/admin/category/index.html.twig @@ -1,5 +1,5 @@ -{% import "admin/post/category/macro.html.twig" as macro_post %} -{% extends 'admin/post/category/layout.html.twig' %} +{% import "admin/category/macro.html.twig" as macro_post %} +{% extends 'admin/category/layout.html.twig' %} {% block body %} diff --git a/apps/templates/admin/post/libelle/index.html.twig b/apps/templates/admin/libelle/index.html.twig similarity index 95% rename from apps/templates/admin/post/libelle/index.html.twig rename to apps/templates/admin/libelle/index.html.twig index 712a6b1b5..e461707e7 100644 --- a/apps/templates/admin/post/libelle/index.html.twig +++ b/apps/templates/admin/libelle/index.html.twig @@ -1,5 +1,5 @@ {% import "admin/macro.html.twig" as macro_admin %} -{% extends 'admin/post/libelle/layout.html.twig' %} +{% extends 'admin/libelle/layout.html.twig' %} {% block body %}
diff --git a/apps/templates/front/bookmarks/aside.html.twig b/apps/templates/front/bookmarks/aside.html.twig new file mode 100644 index 000000000..0b5251b49 --- /dev/null +++ b/apps/templates/front/bookmarks/aside.html.twig @@ -0,0 +1,24 @@ +{% if categories|length != 0 %} +
+

{{ 'bookmark.categories'|trans }}

+
    + {% for category in categories %} +
  1. + {{ category }} +
  2. + {% endfor %} +
+
+{% endif %} +{% if libelles|length != 0 %} +
+

{{ 'bookmark.libelles'|trans }}

+
    + {% for libelle in libelles %} +
  1. + {{ libelle }} +
  2. + {% endfor %} +
+
+{% endif %} \ No newline at end of file diff --git a/apps/templates/front/bookmarks/index.html.twig b/apps/templates/front/bookmarks/index.html.twig new file mode 100644 index 000000000..f786b4082 --- /dev/null +++ b/apps/templates/front/bookmarks/index.html.twig @@ -0,0 +1,52 @@ +{% set showaside = true %} +{% set mainclass = "main-home" %} +{% import "macro.html.twig" as macro_site %} +{% extends 'skeleton/home.html.twig' %} +{% block aside %} +
+ {% include "front/bookmarks/aside.html.twig" %} + {% include "front/aside.html.twig" %} +
+{% endblock %} +{% block section %} + {% for bookmark in pagination %} +
+

+ + {{ bookmark.name }} + +

+ {% set img = attachment(bookmark.img) %} + {% if img is not null and img.name is not null %} + + {{ bookmark.name|e('html_attr') }} + + {% endif %} +
+ {{ 'bookmark.infodate'|trans( + { + '%date%': bookmark.published|format_datetime(pattern=formatdatetime.public) + } + )|raw }} + {% set state = guard_route('admin_bookmark_edit') %} + {% if state == true %} + {{ 'bookmark.update'|trans }} + {% endif %} +
+
+ {{ bookmark.content|raw }} +
+
+ {% for libelle in bookmark.libelles %} + {{ libelle }} + {% endfor %} + {% if bookmark.refcategory %} + {{ bookmark.refcategory }} + {% endif %} +
+
+ {% endfor %} + {% if pagination is defined %} + {{ knp_pagination_render(pagination) }} + {% endif %} +{% endblock %} diff --git a/apps/templates/front/bookmarks/list.html.twig b/apps/templates/front/bookmarks/list.html.twig new file mode 100644 index 000000000..cec679569 --- /dev/null +++ b/apps/templates/front/bookmarks/list.html.twig @@ -0,0 +1,52 @@ +{% set showaside = true %} +{% set mainclass = "main-home" %} +{% import "macro.html.twig" as macro_site %} +{% extends 'skeleton/home.html.twig' %} +{% block aside %} +
+ {% include "front/bookmarks/aside.html.twig" %} + {% include "front/aside.html.twig" %} +
+{% endblock %} +{% block section %} + {% for bookmark in pagination %} +
+

+ + {{ bookmark.name }} + +

+ {% set img = attachment(bookmark.img) %} + {% if img is not null and img.name is not null %} + + {{ bookmark.name|e('html_attr') }} + + {% endif %} +
+ {{ 'bookmark.infodate'|trans( + { + '%date%': bookmark.published|format_datetime(pattern=formatdatetime.public) + } + )|raw }} + {% set state = guard_route('admin_bookmark_edit') %} + {% if state == true %} + Modifier + {% endif %} +
+
+ {{ bookmark.content|raw }} +
+
+ {% for libelle in bookmark.libelles %} + {{ libelle }} + {% endfor %} + {% if bookmark.refcategory %} + {{ bookmark.refcategory }} + {% endif %} +
+
+ {% endfor %} + {% if pagination is defined %} + {{ knp_pagination_render(pagination) }} + {% endif %} +{% endblock %} diff --git a/apps/templates/front/bookmarks/show.html.twig b/apps/templates/front/bookmarks/show.html.twig new file mode 100644 index 000000000..38b7f774a --- /dev/null +++ b/apps/templates/front/bookmarks/show.html.twig @@ -0,0 +1,45 @@ +{% set showaside = true %} +{% set mainclass = "main-home" %} +{% import "macro.html.twig" as macro_site %} +{% extends 'skeleton/home.html.twig' %} +{% block aside %} +
+ {% include "front/bookmarks/aside.html.twig" %} + {% include "front/aside.html.twig" %} +
+{% endblock %} +{% block header %} + {% set img = attachment(bookmark.img) %} + {% if img is not null and img.name is not null %} + + {{ bookmark.name|e('html_attr') }} + + {% endif %} +{% endblock %} +{% block section %} +
+

{{ bookmark.name }}

+
+ {{ 'bookmark.infodate'|trans( + { + '%date%': bookmark.published|format_datetime(pattern=formatdatetime.public), + } + )|raw }} + {% set state = guard_route('admin_bookmark_edit') %} + {% if state == true %} + {{ 'bookmark.update'|trans }} + {% endif %} +
+
+ {{ bookmark.content|raw }} +
+
+ {% for libelle in bookmark.libelles %} + {{ libelle }} + {% endfor %} + {% if bookmark.refcategory %} + {{ bookmark.refcategory }} + {% endif %} +
+
+{% endblock %} diff --git a/apps/templates/front/index.html.twig b/apps/templates/front/index.html.twig index 14a1581fd..b80c32b00 100644 --- a/apps/templates/front/index.html.twig +++ b/apps/templates/front/index.html.twig @@ -9,22 +9,24 @@ {% endblock %} {% block header %} -
-

- - {{ edito.title }} - -

- {% set fond = attachment(edito.fond) %} - {% if fond is not null and fond.name is not null %} - - {{ edito.title|e('html_attr') }} - - {% endif %} -
- {{ edito.content|raw }} + {% if edito.id is defined %} +
+

+ + {{ edito.title }} + +

+ {% set fond = attachment(edito.fond) %} + {% if fond is not null and fond.name is not null %} + + {{ edito.title|e('html_attr') }} + + {% endif %} +
+ {{ edito.content|raw }} +
-
+ {% endif %} {% endblock %} {% block section %} {% for post in pagination %} @@ -55,14 +57,14 @@
{{ post.content|raw }}
-
- {% for libelle in post.libelles %} - {{ libelle }} - {% endfor %} - {% if post.refcategory %} - - {% endif %} -
+
+ {% for libelle in post.libelles %} + {{ libelle }} + {% endfor %} + {% if post.refcategory %} + + {% endif %} +
{% endfor %} {% if pagination is defined %} diff --git a/apps/templates/front/posts/aside.html.twig b/apps/templates/front/posts/aside.html.twig index 5cdeb71e8..3f43bcd65 100644 --- a/apps/templates/front/posts/aside.html.twig +++ b/apps/templates/front/posts/aside.html.twig @@ -16,7 +16,7 @@
    {% for category in categories %}
  1. - {{ category }} +
  2. {% endfor %}
@@ -28,7 +28,7 @@
    {% for libelle in libelles %}
  1. - {{ libelle }} + {{ libelle }}
  2. {% endfor %}
diff --git a/apps/templates/skeleton/home/header.html.twig b/apps/templates/skeleton/home/header.html.twig index bc8724838..482e0253c 100644 --- a/apps/templates/skeleton/home/header.html.twig +++ b/apps/templates/skeleton/home/header.html.twig @@ -14,6 +14,4 @@ Se connecter #} -{# {% include "skeleton/home/menu.html.twig" %} -#} diff --git a/apps/templates/skeleton/home/menu.html.twig b/apps/templates/skeleton/home/menu.html.twig new file mode 100644 index 000000000..e68713bb2 --- /dev/null +++ b/apps/templates/skeleton/home/menu.html.twig @@ -0,0 +1,4 @@ + diff --git a/apps/translations/admin.breadcrumb.fr.yaml b/apps/translations/admin.breadcrumb.fr.yaml index f2d0774ab..6a5e445b1 100644 --- a/apps/translations/admin.breadcrumb.fr.yaml +++ b/apps/translations/admin.breadcrumb.fr.yaml @@ -6,6 +6,12 @@ adresseuser.show: Voir adresseuser.title: Adresseuser adresseuser.trash: Corbeille attachment.title: Attachment +bookmark.edit: Éditer +bookmark.new: Nouveau +bookmark.preview: Aperçu +bookmark.show: Voir +bookmark.title: Bookmark +bookmark.trash: Corbeille category.edit: Éditer category.new: Nouveau category.preview: Aperçu @@ -38,6 +44,12 @@ groupuser.show: Voir groupuser.title: Groupuser groupuser.trash: Corbeille guard.title: Guard +libelle.edit: Éditer +libelle.new: Nouveau +libelle.preview: Aperçu +libelle.show: Voir +libelle.title: Libelle +libelle.trash: Corbeille lienuser.edit: Éditer lienuser.new: Nouveau lienuser.preview: Aperçu @@ -71,12 +83,6 @@ post.preview: Aperçu post.show: Voir post.title: Post post.trash: Corbeille -postlibelle.edit: Éditer -postlibelle.new: Nouveau -postlibelle.preview: Aperçu -postlibelle.show: Voir -postlibelle.title: Postlibelle -postlibelle.trash: Corbeille profil.title: Profil template.edit: Éditer template.new: Nouveau diff --git a/apps/translations/admin.form.fr.yaml b/apps/translations/admin.form.fr.yaml index ee083c168..af199b40d 100644 --- a/apps/translations/admin.form.fr.yaml +++ b/apps/translations/admin.form.fr.yaml @@ -14,6 +14,26 @@ adresse.zipcode.help: '' adresse.zipcode.label: 'Code postal' adresseuser.refuser.help: '' adresseuser.refuser.label: Utilisateur +bookmark.content.help: '' +bookmark.content.label: Contenu +bookmark.file.help: '' +bookmark.file.label: Fichier +bookmark.libelles.help: '' +bookmark.libelles.label: Libélles +bookmark.metaDescription.help: '' +bookmark.metaDescription.label: meta Description +bookmark.metaKeywords.help: '' +bookmark.metaKeywords.label: meta Keywords +bookmark.name.help: '' +bookmark.name.label: Nom +bookmark.refcategory.help: '' +bookmark.refcategory.label: Catégorie +bookmark.refuser.help: '' +bookmark.refuser.label: Utilisateur +bookmark.slug.help: '' +bookmark.slug.label: Slug +bookmark.url.help: '' +bookmark.url.label: Url category.name.help: '' category.name.label: Nom category.parent.help: '' @@ -29,7 +49,7 @@ edito.metaDescription.label: 'SEO description' edito.metaKeywords.help: '' edito.metaKeywords.label: 'SEO mot clef' edito.published.help: '' -edito.published.label: 'Publié ?' +edito.published.label: 'Date de publication' edito.refuser.help: '' edito.refuser.label: Utilisateur edito.title.help: '' @@ -219,7 +239,7 @@ post.metaDescription.label: 'SEO description' post.metaKeywords.help: '' post.metaKeywords.label: 'SEO mot clef' post.published.help: '' -post.published.label: 'Publié ?' +post.published.label: 'Date de publication' post.refcategory.help: '' post.refcategory.label: Catégorie post.refuser.help: '' diff --git a/apps/translations/admin.header.fr.yaml b/apps/translations/admin.header.fr.yaml index 9509f8926..98ba9c027 100644 --- a/apps/translations/admin.header.fr.yaml +++ b/apps/translations/admin.header.fr.yaml @@ -1,12 +1,14 @@ admin.title: Admin adresseuser.title: Adresseuser attachment.title: Attachment +bookmark.title: Bookmark category.title: Catégorie edito.title: Edito emailuser.title: Emailuser geocode.title: Geocode groupuser.title: Groupuser guard.title: Guard +libelle.title: Libelle lienuser.title: Lienuser menu.title: Menu noteinterne.title: Noteinterne @@ -14,7 +16,6 @@ oauth.title: Oauth param.title: Param phoneuser.title: Phoneuser post.title: Post -postlibelle.title: Postlibelle profil.title: Profil template.title: Template trash.title: Trash diff --git a/apps/translations/admin.messages.fr.yaml b/apps/translations/admin.messages.fr.yaml index 7ddd39b1b..569e37f46 100644 --- a/apps/translations/admin.messages.fr.yaml +++ b/apps/translations/admin.messages.fr.yaml @@ -9,9 +9,17 @@ attachment.seefile: 'Voir le fichier' attachment.size: Taille attachment.state: Étape attachment.workflow: Workflow +bookmark.category: Categorie +bookmark.content: Contenu +bookmark.image: Image +bookmark.name: Nom +bookmark.published: 'Date de publication' +bookmark.url: Url +bookmark.user: Utilisateur +bookmark.workflow: Workflow edito.content: Contenu edito.fond: Fond -edito.published: 'Publié ?' +edito.published: 'Date de publication' edito.state: Étape edito.title: Titre edito.user: Utilisateur @@ -92,7 +100,7 @@ post.content: Contenu post.image: Image post.libelle.name: Nom post.libelle.slug: Slug -post.published: 'Publié ?' +post.published: 'Date de publication' post.title: Titre post.user: Utilisateur post.workflow: Workflow diff --git a/apps/translations/messages.fr.yaml b/apps/translations/messages.fr.yaml index 212c0feb5..a673b244d 100644 --- a/apps/translations/messages.fr.yaml +++ b/apps/translations/messages.fr.yaml @@ -5,6 +5,10 @@ admin.group.guard.superadmin.nope: 'Le groupe superadmin n''est pas un groupe qu admin.robotstxt.file: 'Fichier %file% modifié' admin.togglenavigation: 'Basculer la navigation' admin.user.guard.superadmin.nope: 'L''utilisateur fait partie du groupe superadmin, qui n''est pas un groupe qui peut avoir des droits spécifique' +bookmark.categories: Categories +bookmark.infodate: '%date%' +bookmark.libelles: Libelles +bookmark.update: Modifier data.save: 'Données sauvegardé' error.page.400.message: 'La syntaxe de la requête est erronée.' error.page.400.title: 'Erreur 400' diff --git a/assets/scss/front.scss b/assets/scss/front.scss index d65ece0ca..9060ddd8a 100644 --- a/assets/scss/front.scss +++ b/assets/scss/front.scss @@ -275,7 +275,8 @@ main { @extend .col-12; } -.post_libelle { +.post_libelle, +.bookmark_libelle { &::before { @extend .fas; @extend .fa-tag; @@ -284,7 +285,8 @@ main { } } -.post_category { +.post_category, +.bookmark_category { &::before { @extend .far; @extend .fa-folder;