From 361c4fd0a39875ace4506bb0b628183ee2ff786d Mon Sep 17 00:00:00 2001 From: clfreville2 Date: Tue, 11 Jun 2024 20:40:01 +0200 Subject: [PATCH 01/12] Allow uploading images --- .gitignore | 1 + composer.json | 3 +- composer.lock | 175 +++++++++++++++++++++++- config/bundles.php | 1 + config/packages/vich_uploader.yaml | 11 ++ src/Entity/Post.php | 50 +++++++ src/Form/PostType.php | 2 + symfony.lock | 12 ++ templates/post/show.html.twig | 6 + tests/Controller/PostControllerTest.php | 21 +++ tests/image.png | Bin 0 -> 67 bytes 11 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 config/packages/vich_uploader.yaml create mode 100644 tests/image.png diff --git a/.gitignore b/.gitignore index be35b2f..f87ea38 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ phpstan.neon ###< phpstan/phpstan ### migrations +public/images diff --git a/composer.json b/composer.json index c02ecbd..eddf999 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,8 @@ "symfony/yaml": "7.0.*", "symfonycasts/verify-email-bundle": "^1.17", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "vich/uploader-bundle": "^2.3" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 12a1306..590bf82 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9df70d112adfdfa4fbcde08b504d0bb9", + "content-hash": "0f3c68d9e3c5fbe96fcb3367231dc539", "packages": [ { "name": "api-platform/core", @@ -1565,6 +1565,70 @@ ], "time": "2023-10-06T06:47:41+00:00" }, + { + "name": "jms/metadata", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/metadata.git", + "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "require-dev": { + "doctrine/cache": "^1.0", + "doctrine/coding-standard": "^8.0", + "mikey179/vfsstream": "^1.6.7", + "phpunit/phpunit": "^8.5|^9.0", + "psr/container": "^1.0|^2.0", + "symfony/cache": "^3.1|^4.0|^5.0", + "symfony/dependency-injection": "^3.1|^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Metadata\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "description": "Class/method/property metadata management in PHP", + "keywords": [ + "annotations", + "metadata", + "xml", + "yaml" + ], + "support": { + "issues": "https://github.com/schmittjoh/metadata/issues", + "source": "https://github.com/schmittjoh/metadata/tree/2.8.0" + }, + "time": "2023-02-15T13:44:18+00:00" + }, { "name": "monolog/monolog", "version": "3.6.0", @@ -7742,6 +7806,115 @@ ], "time": "2024-05-16T10:04:27+00:00" }, + { + "name": "vich/uploader-bundle", + "version": "2.3.3", + "source": { + "type": "git", + "url": "https://github.com/dustin10/VichUploaderBundle.git", + "reference": "4002ecc83bae414b5be287907ccecb27611eaa69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dustin10/VichUploaderBundle/zipball/4002ecc83bae414b5be287907ccecb27611eaa69", + "reference": "4002ecc83bae414b5be287907ccecb27611eaa69", + "shasum": "" + }, + "require": { + "doctrine/persistence": "^3", + "ext-simplexml": "*", + "jms/metadata": "^2.4", + "php": "^8.1", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher-contracts": "^3.1", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/mime": "^5.4 || ^6.0 || ^7.0", + "symfony/property-access": "^5.4 || ^6.0 || ^7.0", + "symfony/string": "^5.4 || ^6.0 || ^7.0" + }, + "conflict": { + "doctrine/annotations": "<1.12", + "league/flysystem": "<2.0" + }, + "require-dev": { + "dg/bypass-finals": "^1.3", + "doctrine/doctrine-bundle": "^2.7", + "doctrine/mongodb-odm": "^2.4", + "doctrine/orm": "^2.13", + "ext-sqlite3": "*", + "knplabs/knp-gaufrette-bundle": "dev-master", + "league/flysystem-bundle": "^2.4 || ^3.0", + "league/flysystem-memory": "^2.0 || ^3.0", + "matthiasnoback/symfony-dependency-injection-test": "^5.1", + "mikey179/vfsstream": "^1.6.11", + "phpunit/phpunit": "^9.6", + "symfony/asset": "^5.4 || ^6.0 || ^7.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/css-selector": "^5.4 || ^6.0 || ^7.0", + "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0", + "symfony/form": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^7.0", + "symfony/security-csrf": "^5.4 || ^6.0 || ^7.0", + "symfony/translation": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/validator": "^5.4 || ^6.0 || ^7.0", + "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", + "yoast/phpunit-polyfills": "^2.0" + }, + "suggest": { + "doctrine/annotations": "If you use doctrine/doctrine-bundle >2.7, this package is required to use annotations", + "doctrine/doctrine-bundle": "For integration with Doctrine", + "doctrine/mongodb-odm-bundle": "For integration with Doctrine ODM", + "doctrine/orm": "For integration with Doctrine ORM", + "doctrine/phpcr-odm": "For integration with Doctrine PHPCR", + "knplabs/knp-gaufrette-bundle": "For integration with Gaufrette", + "league/flysystem-bundle": "For integration with Flysystem", + "liip/imagine-bundle": "To generate image thumbnails", + "oneup/flysystem-bundle": "For integration with Flysystem", + "symfony/asset": "To generate better links", + "symfony/form": "To handle uploads in forms", + "symfony/yaml": "To use YAML mapping" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Vich\\UploaderBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dustin Dobervich", + "email": "ddobervich@gmail.com" + } + ], + "description": "Ease file uploads attached to entities", + "homepage": "https://github.com/dustin10/VichUploaderBundle", + "keywords": [ + "file uploads", + "upload" + ], + "support": { + "issues": "https://github.com/dustin10/VichUploaderBundle/issues", + "source": "https://github.com/dustin10/VichUploaderBundle/tree/2.3.3" + }, + "time": "2024-04-24T07:17:05+00:00" + }, { "name": "webmozart/assert", "version": "1.11.0", diff --git a/config/bundles.php b/config/bundles.php index fbce34f..168b1c5 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -18,4 +18,5 @@ return [ Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true], + Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true], ]; diff --git a/config/packages/vich_uploader.yaml b/config/packages/vich_uploader.yaml new file mode 100644 index 0000000..4106375 --- /dev/null +++ b/config/packages/vich_uploader.yaml @@ -0,0 +1,11 @@ +vich_uploader: + db_driver: orm + + metadata: + type: attribute + + mappings: + posts: + uri_prefix: /images/posts + upload_destination: '%kernel.project_dir%/public/images/posts' + namer: Vich\UploaderBundle\Naming\SmartUniqueNamer diff --git a/src/Entity/Post.php b/src/Entity/Post.php index 4d0b54f..1ec9f69 100644 --- a/src/Entity/Post.php +++ b/src/Entity/Post.php @@ -12,8 +12,10 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; +use Vich\UploaderBundle\Mapping\Annotation as Vich; #[ORM\Entity(repositoryClass: PostRepository::class)] #[ORM\HasLifecycleCallbacks] @@ -23,6 +25,7 @@ use Symfony\Component\Validator\Constraints as Assert; )] #[GetCollection(normalizationContext: ['groups' => ['post:collection:read']])] #[Metadata\ApiFilter(filterClass: SearchFilter::class, properties: ['species' => 'exact'])] +#[Vich\Uploadable] class Post { #[ORM\Id] @@ -41,6 +44,9 @@ class Post #[Groups(['post:collection:read'])] private ?\DateTimeImmutable $publicationDate = null; + #[ORM\Column] + private ?\DateTimeImmutable $updatedAt = null; + #[ORM\Column(nullable: true)] #[Groups(['post:collection:read'])] private ?float $latitude = null; @@ -53,6 +59,13 @@ class Post #[Groups(['post:collection:read'])] private ?float $altitude = null; + #[ORM\Column(length: 255, nullable: true)] + private ?string $image = null; + + #[Vich\UploadableField(mapping: 'posts', fileNameProperty: 'image')] + #[Assert\Image] + private ?File $imageFile = null; + #[ORM\Column(type: Types::TEXT)] #[Groups(['post:read'])] #[Assert\NotBlank] @@ -103,6 +116,18 @@ class Post return $this; } + public function getUpdatedAt(): ?\DateTimeImmutable + { + return $this->updatedAt; + } + + public function setUpdatedAt(\DateTimeImmutable $updatedAt): static + { + $this->updatedAt = $updatedAt; + + return $this; + } + public function getLatitude(): ?float { return $this->latitude; @@ -139,6 +164,30 @@ class Post return $this; } + public function getImage(): ?string + { + return $this->image; + } + + public function setImage(?string $image): static + { + $this->image = $image; + + return $this; + } + + public function getImageFile(): ?File + { + return $this->imageFile; + } + + public function setImageFile(?File $imageFile): static + { + $this->imageFile = $imageFile; + + return $this; + } + public function getCommentary(): ?string { return $this->commentary; @@ -170,6 +219,7 @@ class Post if ($this->publicationDate === null) { $this->publicationDate = new \DateTimeImmutable(); } + $this->updatedAt = new \DateTimeImmutable(); } /** diff --git a/src/Form/PostType.php b/src/Form/PostType.php index bea7e6f..d384eb3 100644 --- a/src/Form/PostType.php +++ b/src/Form/PostType.php @@ -6,6 +6,7 @@ use App\Entity\Post; use App\Entity\Species; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -20,6 +21,7 @@ class PostType extends AbstractType ->add('latitude') ->add('longitude') ->add('altitude') + ->add('imageFile', FileType::class) ->add('commentary') ->add('species', EntityType::class, [ 'class' => Species::class, diff --git a/symfony.lock b/symfony.lock index 5e18ec6..0bc2d80 100644 --- a/symfony.lock +++ b/symfony.lock @@ -343,5 +343,17 @@ }, "twig/extra-bundle": { "version": "v3.10.0" + }, + "vich/uploader-bundle": { + "version": "2.3", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.13", + "ref": "1b3064c2f6b255c2bc2f56461aaeb76b11e07e36" + }, + "files": [ + "config/packages/vich_uploader.yaml" + ] } } diff --git a/templates/post/show.html.twig b/templates/post/show.html.twig index be2823c..76d00e5 100644 --- a/templates/post/show.html.twig +++ b/templates/post/show.html.twig @@ -31,6 +31,12 @@ Altitude {{ post.altitude }} + {% if post.image %} + + Image + + + {% endif %} Commentary {{ post.commentary }} diff --git a/tests/Controller/PostControllerTest.php b/tests/Controller/PostControllerTest.php index bd0ddc2..963c410 100644 --- a/tests/Controller/PostControllerTest.php +++ b/tests/Controller/PostControllerTest.php @@ -8,6 +8,7 @@ use App\Repository\PostRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\HttpFoundation\File\UploadedFile; class PostControllerTest extends WebTestCase { @@ -147,4 +148,24 @@ class PostControllerTest extends WebTestCase $comments = $this->repository->find($fixture->getId())->getComments(); self::assertSame(1, $comments->count()); } + + public function testUploadImage() + { + $fixture = new Post(); + $fixture->setFoundDate(new \DateTimeImmutable('2024-01-01 00:00:00')); + $fixture->setCommentary('Cool stuff'); + + $this->manager->persist($fixture); + $this->manager->flush(); + + $file = new UploadedFile(__DIR__ . '/../image.png', 'image.png'); + + $this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId())); + + $this->client->submitForm('Update', [ + 'post[imageFile]' => $file, + ]); + + self::assertNotNull($this->repository->find($fixture->getId())->getImage()); + } } diff --git a/tests/image.png b/tests/image.png new file mode 100644 index 0000000000000000000000000000000000000000..252d9502d8573d033e633f5e377d81bebf8afd36 GIT binary patch literal 67 zcmeAS@N?(olHy`uVBq!ia0vp^j35jm7|ip2ssJf2PZ!6K3dZCFAe)JSvAC2`0?1 Date: Wed, 12 Jun 2024 09:05:30 +0200 Subject: [PATCH 02/12] Allow uploading images (#13) Adds an optional field for the post image. Fixes #12 Co-authored-by: clfreville2 Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/herbarium/pulls/13 Reviewed-by: Bastien OLLIER --- .gitignore | 1 + composer.json | 3 +- composer.lock | 175 +++++++++++++++++++++++- config/bundles.php | 1 + config/packages/vich_uploader.yaml | 11 ++ src/Entity/Post.php | 50 +++++++ src/Form/PostType.php | 2 + symfony.lock | 12 ++ templates/post/show.html.twig | 6 + tests/Controller/PostControllerTest.php | 21 +++ tests/image.png | Bin 0 -> 67 bytes 11 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 config/packages/vich_uploader.yaml create mode 100644 tests/image.png diff --git a/.gitignore b/.gitignore index be35b2f..f87ea38 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ phpstan.neon ###< phpstan/phpstan ### migrations +public/images diff --git a/composer.json b/composer.json index c02ecbd..eddf999 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,8 @@ "symfony/yaml": "7.0.*", "symfonycasts/verify-email-bundle": "^1.17", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "vich/uploader-bundle": "^2.3" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 12a1306..590bf82 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9df70d112adfdfa4fbcde08b504d0bb9", + "content-hash": "0f3c68d9e3c5fbe96fcb3367231dc539", "packages": [ { "name": "api-platform/core", @@ -1565,6 +1565,70 @@ ], "time": "2023-10-06T06:47:41+00:00" }, + { + "name": "jms/metadata", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/metadata.git", + "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "require-dev": { + "doctrine/cache": "^1.0", + "doctrine/coding-standard": "^8.0", + "mikey179/vfsstream": "^1.6.7", + "phpunit/phpunit": "^8.5|^9.0", + "psr/container": "^1.0|^2.0", + "symfony/cache": "^3.1|^4.0|^5.0", + "symfony/dependency-injection": "^3.1|^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Metadata\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "description": "Class/method/property metadata management in PHP", + "keywords": [ + "annotations", + "metadata", + "xml", + "yaml" + ], + "support": { + "issues": "https://github.com/schmittjoh/metadata/issues", + "source": "https://github.com/schmittjoh/metadata/tree/2.8.0" + }, + "time": "2023-02-15T13:44:18+00:00" + }, { "name": "monolog/monolog", "version": "3.6.0", @@ -7742,6 +7806,115 @@ ], "time": "2024-05-16T10:04:27+00:00" }, + { + "name": "vich/uploader-bundle", + "version": "2.3.3", + "source": { + "type": "git", + "url": "https://github.com/dustin10/VichUploaderBundle.git", + "reference": "4002ecc83bae414b5be287907ccecb27611eaa69" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dustin10/VichUploaderBundle/zipball/4002ecc83bae414b5be287907ccecb27611eaa69", + "reference": "4002ecc83bae414b5be287907ccecb27611eaa69", + "shasum": "" + }, + "require": { + "doctrine/persistence": "^3", + "ext-simplexml": "*", + "jms/metadata": "^2.4", + "php": "^8.1", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher-contracts": "^3.1", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/mime": "^5.4 || ^6.0 || ^7.0", + "symfony/property-access": "^5.4 || ^6.0 || ^7.0", + "symfony/string": "^5.4 || ^6.0 || ^7.0" + }, + "conflict": { + "doctrine/annotations": "<1.12", + "league/flysystem": "<2.0" + }, + "require-dev": { + "dg/bypass-finals": "^1.3", + "doctrine/doctrine-bundle": "^2.7", + "doctrine/mongodb-odm": "^2.4", + "doctrine/orm": "^2.13", + "ext-sqlite3": "*", + "knplabs/knp-gaufrette-bundle": "dev-master", + "league/flysystem-bundle": "^2.4 || ^3.0", + "league/flysystem-memory": "^2.0 || ^3.0", + "matthiasnoback/symfony-dependency-injection-test": "^5.1", + "mikey179/vfsstream": "^1.6.11", + "phpunit/phpunit": "^9.6", + "symfony/asset": "^5.4 || ^6.0 || ^7.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/css-selector": "^5.4 || ^6.0 || ^7.0", + "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0", + "symfony/form": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^7.0", + "symfony/security-csrf": "^5.4 || ^6.0 || ^7.0", + "symfony/translation": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/validator": "^5.4 || ^6.0 || ^7.0", + "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", + "yoast/phpunit-polyfills": "^2.0" + }, + "suggest": { + "doctrine/annotations": "If you use doctrine/doctrine-bundle >2.7, this package is required to use annotations", + "doctrine/doctrine-bundle": "For integration with Doctrine", + "doctrine/mongodb-odm-bundle": "For integration with Doctrine ODM", + "doctrine/orm": "For integration with Doctrine ORM", + "doctrine/phpcr-odm": "For integration with Doctrine PHPCR", + "knplabs/knp-gaufrette-bundle": "For integration with Gaufrette", + "league/flysystem-bundle": "For integration with Flysystem", + "liip/imagine-bundle": "To generate image thumbnails", + "oneup/flysystem-bundle": "For integration with Flysystem", + "symfony/asset": "To generate better links", + "symfony/form": "To handle uploads in forms", + "symfony/yaml": "To use YAML mapping" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Vich\\UploaderBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dustin Dobervich", + "email": "ddobervich@gmail.com" + } + ], + "description": "Ease file uploads attached to entities", + "homepage": "https://github.com/dustin10/VichUploaderBundle", + "keywords": [ + "file uploads", + "upload" + ], + "support": { + "issues": "https://github.com/dustin10/VichUploaderBundle/issues", + "source": "https://github.com/dustin10/VichUploaderBundle/tree/2.3.3" + }, + "time": "2024-04-24T07:17:05+00:00" + }, { "name": "webmozart/assert", "version": "1.11.0", diff --git a/config/bundles.php b/config/bundles.php index fbce34f..168b1c5 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -18,4 +18,5 @@ return [ Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true], + Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true], ]; diff --git a/config/packages/vich_uploader.yaml b/config/packages/vich_uploader.yaml new file mode 100644 index 0000000..4106375 --- /dev/null +++ b/config/packages/vich_uploader.yaml @@ -0,0 +1,11 @@ +vich_uploader: + db_driver: orm + + metadata: + type: attribute + + mappings: + posts: + uri_prefix: /images/posts + upload_destination: '%kernel.project_dir%/public/images/posts' + namer: Vich\UploaderBundle\Naming\SmartUniqueNamer diff --git a/src/Entity/Post.php b/src/Entity/Post.php index 4d0b54f..1ec9f69 100644 --- a/src/Entity/Post.php +++ b/src/Entity/Post.php @@ -12,8 +12,10 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; +use Vich\UploaderBundle\Mapping\Annotation as Vich; #[ORM\Entity(repositoryClass: PostRepository::class)] #[ORM\HasLifecycleCallbacks] @@ -23,6 +25,7 @@ use Symfony\Component\Validator\Constraints as Assert; )] #[GetCollection(normalizationContext: ['groups' => ['post:collection:read']])] #[Metadata\ApiFilter(filterClass: SearchFilter::class, properties: ['species' => 'exact'])] +#[Vich\Uploadable] class Post { #[ORM\Id] @@ -41,6 +44,9 @@ class Post #[Groups(['post:collection:read'])] private ?\DateTimeImmutable $publicationDate = null; + #[ORM\Column] + private ?\DateTimeImmutable $updatedAt = null; + #[ORM\Column(nullable: true)] #[Groups(['post:collection:read'])] private ?float $latitude = null; @@ -53,6 +59,13 @@ class Post #[Groups(['post:collection:read'])] private ?float $altitude = null; + #[ORM\Column(length: 255, nullable: true)] + private ?string $image = null; + + #[Vich\UploadableField(mapping: 'posts', fileNameProperty: 'image')] + #[Assert\Image] + private ?File $imageFile = null; + #[ORM\Column(type: Types::TEXT)] #[Groups(['post:read'])] #[Assert\NotBlank] @@ -103,6 +116,18 @@ class Post return $this; } + public function getUpdatedAt(): ?\DateTimeImmutable + { + return $this->updatedAt; + } + + public function setUpdatedAt(\DateTimeImmutable $updatedAt): static + { + $this->updatedAt = $updatedAt; + + return $this; + } + public function getLatitude(): ?float { return $this->latitude; @@ -139,6 +164,30 @@ class Post return $this; } + public function getImage(): ?string + { + return $this->image; + } + + public function setImage(?string $image): static + { + $this->image = $image; + + return $this; + } + + public function getImageFile(): ?File + { + return $this->imageFile; + } + + public function setImageFile(?File $imageFile): static + { + $this->imageFile = $imageFile; + + return $this; + } + public function getCommentary(): ?string { return $this->commentary; @@ -170,6 +219,7 @@ class Post if ($this->publicationDate === null) { $this->publicationDate = new \DateTimeImmutable(); } + $this->updatedAt = new \DateTimeImmutable(); } /** diff --git a/src/Form/PostType.php b/src/Form/PostType.php index bea7e6f..d384eb3 100644 --- a/src/Form/PostType.php +++ b/src/Form/PostType.php @@ -6,6 +6,7 @@ use App\Entity\Post; use App\Entity\Species; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -20,6 +21,7 @@ class PostType extends AbstractType ->add('latitude') ->add('longitude') ->add('altitude') + ->add('imageFile', FileType::class) ->add('commentary') ->add('species', EntityType::class, [ 'class' => Species::class, diff --git a/symfony.lock b/symfony.lock index 5e18ec6..0bc2d80 100644 --- a/symfony.lock +++ b/symfony.lock @@ -343,5 +343,17 @@ }, "twig/extra-bundle": { "version": "v3.10.0" + }, + "vich/uploader-bundle": { + "version": "2.3", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.13", + "ref": "1b3064c2f6b255c2bc2f56461aaeb76b11e07e36" + }, + "files": [ + "config/packages/vich_uploader.yaml" + ] } } diff --git a/templates/post/show.html.twig b/templates/post/show.html.twig index be2823c..76d00e5 100644 --- a/templates/post/show.html.twig +++ b/templates/post/show.html.twig @@ -31,6 +31,12 @@ Altitude {{ post.altitude }} + {% if post.image %} + + Image + + + {% endif %} Commentary {{ post.commentary }} diff --git a/tests/Controller/PostControllerTest.php b/tests/Controller/PostControllerTest.php index bd0ddc2..963c410 100644 --- a/tests/Controller/PostControllerTest.php +++ b/tests/Controller/PostControllerTest.php @@ -8,6 +8,7 @@ use App\Repository\PostRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\HttpFoundation\File\UploadedFile; class PostControllerTest extends WebTestCase { @@ -147,4 +148,24 @@ class PostControllerTest extends WebTestCase $comments = $this->repository->find($fixture->getId())->getComments(); self::assertSame(1, $comments->count()); } + + public function testUploadImage() + { + $fixture = new Post(); + $fixture->setFoundDate(new \DateTimeImmutable('2024-01-01 00:00:00')); + $fixture->setCommentary('Cool stuff'); + + $this->manager->persist($fixture); + $this->manager->flush(); + + $file = new UploadedFile(__DIR__ . '/../image.png', 'image.png'); + + $this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId())); + + $this->client->submitForm('Update', [ + 'post[imageFile]' => $file, + ]); + + self::assertNotNull($this->repository->find($fixture->getId())->getImage()); + } } diff --git a/tests/image.png b/tests/image.png new file mode 100644 index 0000000000000000000000000000000000000000..252d9502d8573d033e633f5e377d81bebf8afd36 GIT binary patch literal 67 zcmeAS@N?(olHy`uVBq!ia0vp^j35jm7|ip2ssJf2PZ!6K3dZCFAe)JSvAC2`0?1 Date: Thu, 13 Jun 2024 08:08:46 +0200 Subject: [PATCH 03/12] add Moderation.php (#14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bastien Co-authored-by: clfreville2 Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/herbarium/pulls/14 Reviewed-by: Clément FRÉVILLE --- .drone.yml | 4 ++ config/services.yaml | 6 +++ src/Entity/Post.php | 5 +++ src/Form/PostType.php | 4 +- src/Service/DummyImageSafetyService.php | 13 ++++++ src/Service/ImageSafetyServiceInterface.php | 10 +++++ src/Service/SightEngineImageSafetyService.php | 42 +++++++++++++++++++ src/Validator/ImageSafety.php | 15 +++++++ src/Validator/ImageSafetyValidator.php | 30 +++++++++++++ 9 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 src/Service/DummyImageSafetyService.php create mode 100644 src/Service/ImageSafetyServiceInterface.php create mode 100644 src/Service/SightEngineImageSafetyService.php create mode 100644 src/Validator/ImageSafety.php create mode 100644 src/Validator/ImageSafetyValidator.php diff --git a/.drone.yml b/.drone.yml index 945f522..2a41250 100644 --- a/.drone.yml +++ b/.drone.yml @@ -62,6 +62,10 @@ steps: CODEFIRST_CLIENTDRONE_ENV_SERVER_NAME: http://codefirst.iut.uca.fr CODEFIRST_CLIENTDRONE_ENV_CORS_ALLOW_ORIGIN: https://codefirst.iut.uca.fr CODEFIRST_CLIENTDRONE_ENV_TRUSTED_PROXIES: REMOTE_ADDR + CODEFIRST_CLIENTDRONE_ENV_API_USER_SIGHT_ENGINE: + from_secret: API_USER_SIGHT_ENGINE + CODEFIRST_CLIENTDRONE_ENV_API_KEY_SIGHT_ENGINE: + from_secret: API_KEY_SIGHT_ENGINE depends_on: - docker-image when: diff --git a/config/services.yaml b/config/services.yaml index 223b4e5..f07d469 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -26,5 +26,11 @@ services: bind: $processor: '@api_platform.doctrine.orm.state.persist_processor' + App\Service\ImageSafetyServiceInterface: '@App\Service\DummyImageSafetyService' + # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones + +when@prod: + services: + App\Service\ImageSafetyServiceInterface: '@App\Service\SightEngineImageSafetyService' diff --git a/src/Entity/Post.php b/src/Entity/Post.php index 1ec9f69..fa0217a 100644 --- a/src/Entity/Post.php +++ b/src/Entity/Post.php @@ -8,6 +8,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\GetCollection; use App\Repository\PostRepository; +use App\Validator\ImageSafety; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; @@ -64,6 +65,7 @@ class Post #[Vich\UploadableField(mapping: 'posts', fileNameProperty: 'image')] #[Assert\Image] + #[ImageSafety] private ?File $imageFile = null; #[ORM\Column(type: Types::TEXT)] @@ -184,6 +186,9 @@ class Post public function setImageFile(?File $imageFile): static { $this->imageFile = $imageFile; + if ($imageFile !== null) { + $this->updatedAt = new \DateTimeImmutable(); + } return $this; } diff --git a/src/Form/PostType.php b/src/Form/PostType.php index d384eb3..e32a849 100644 --- a/src/Form/PostType.php +++ b/src/Form/PostType.php @@ -21,7 +21,9 @@ class PostType extends AbstractType ->add('latitude') ->add('longitude') ->add('altitude') - ->add('imageFile', FileType::class) + ->add('imageFile', FileType::class, [ + 'required' => false, + ]) ->add('commentary') ->add('species', EntityType::class, [ 'class' => Species::class, diff --git a/src/Service/DummyImageSafetyService.php b/src/Service/DummyImageSafetyService.php new file mode 100644 index 0000000..56f7f25 --- /dev/null +++ b/src/Service/DummyImageSafetyService.php @@ -0,0 +1,13 @@ +getRealPath(), 'r'); + if ($handle === false) { + return false; + } + $response = $this->client->request('POST', 'https://api.sightengine.com/1.0/check.json', [ + 'body' => [ + 'media' => $handle, + 'models' => 'nudity-2.1', + 'api_user' => $this->apiUser, + 'api_secret' => $this->apiKey, + ], + ]); + fclose($handle); + + $output = $response->toArray(); + $scoreNudity = $output['nudity']; + + return $scoreNudity['sexual_activity'] < 0.8 && + $scoreNudity['sexual_display'] < 0.8 && + $scoreNudity['erotica'] < 0.8; + } +} diff --git a/src/Validator/ImageSafety.php b/src/Validator/ImageSafety.php new file mode 100644 index 0000000..0815de0 --- /dev/null +++ b/src/Validator/ImageSafety.php @@ -0,0 +1,15 @@ +imageSafetyService->isValid($value)) { + $this->context->buildViolation($constraint->message)->addViolation(); + } + } +} -- 2.43.0 From 8a1edeb938f56be2db332f93985ae10021500786 Mon Sep 17 00:00:00 2001 From: Hugo PRADIER Date: Thu, 13 Jun 2024 08:46:30 +0200 Subject: [PATCH 04/12] Ajout de la traduction (#15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: hugo.pradier2 Co-authored-by: clfreville2 Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/herbarium/pulls/15 Reviewed-by: Clément FRÉVILLE Co-authored-by: Hugo PRADIER Co-committed-by: Hugo PRADIER --- composer.lock | 12 +- config/packages/translation.yaml | 11 +- src/Controller/SettingController.php | 20 + src/EventListener/LocaleListener.php | 28 + templates/_pagination.html.twig | 4 +- templates/base.html.twig | 16 +- templates/post/_delete_form.html.twig | 4 +- templates/post/_form.html.twig | 2 +- templates/post/edit.html.twig | 7 +- templates/post/index.html.twig | 8 +- templates/post/new.html.twig | 6 +- templates/post/show.html.twig | 14 +- templates/post/table.html.twig | 20 +- templates/registration/register.html.twig | 6 +- templates/security/login.html.twig | 14 +- templates/species/_delete_form.html.twig | 4 +- templates/species/_form.html.twig | 2 +- templates/species/edit.html.twig | 9 +- templates/species/index.html.twig | 10 +- templates/species/new.html.twig | 4 +- templates/species/show.html.twig | 16 +- templates/species/table.html.twig | 20 +- translations/.gitignore | 0 translations/VerifyEmailBundle.en.xlf | 42 ++ translations/VerifyEmailBundle.fr.xlf | 42 ++ translations/messages.en.xlf | 166 ++++++ translations/messages.fr.xlf | 166 ++++++ translations/security.en.xlf | 82 +++ translations/security.fr.xlf | 82 +++ translations/validators.en.xlf | 598 ++++++++++++++++++++++ translations/validators.fr.xlf | 598 ++++++++++++++++++++++ 31 files changed, 1919 insertions(+), 94 deletions(-) create mode 100644 src/Controller/SettingController.php create mode 100644 src/EventListener/LocaleListener.php delete mode 100644 translations/.gitignore create mode 100644 translations/VerifyEmailBundle.en.xlf create mode 100644 translations/VerifyEmailBundle.fr.xlf create mode 100644 translations/messages.en.xlf create mode 100644 translations/messages.fr.xlf create mode 100644 translations/security.en.xlf create mode 100644 translations/security.fr.xlf create mode 100644 translations/validators.en.xlf create mode 100644 translations/validators.fr.xlf diff --git a/composer.lock b/composer.lock index 590bf82..b4a9fb4 100644 --- a/composer.lock +++ b/composer.lock @@ -6741,16 +6741,16 @@ }, { "name": "symfony/translation", - "version": "v7.0.7", + "version": "v7.0.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "1515e03afaa93e6419aba5d5c9d209159317100b" + "reference": "649a646a5aae6e86da1ea119643c53d4080624c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/1515e03afaa93e6419aba5d5c9d209159317100b", - "reference": "1515e03afaa93e6419aba5d5c9d209159317100b", + "url": "https://api.github.com/repos/symfony/translation/zipball/649a646a5aae6e86da1ea119643c53d4080624c2", + "reference": "649a646a5aae6e86da1ea119643c53d4080624c2", "shasum": "" }, "require": { @@ -6815,7 +6815,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.0.7" + "source": "https://github.com/symfony/translation/tree/v7.0.8" }, "funding": [ { @@ -6831,7 +6831,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-31T14:55:39+00:00" }, { "name": "symfony/translation-contracts", diff --git a/config/packages/translation.yaml b/config/packages/translation.yaml index b3f8f9c..705e4b8 100644 --- a/config/packages/translation.yaml +++ b/config/packages/translation.yaml @@ -1,7 +1,6 @@ framework: - default_locale: en - translator: - default_path: '%kernel.project_dir%/translations' - fallbacks: - - en - providers: + default_locale: "en" + translator: + default_path: "%kernel.project_dir%/translations" + fallbacks: + - "en" diff --git a/src/Controller/SettingController.php b/src/Controller/SettingController.php new file mode 100644 index 0000000..6518da9 --- /dev/null +++ b/src/Controller/SettingController.php @@ -0,0 +1,20 @@ +setLocale($locale); + $request->getSession()->set('_locale', $locale); + return $this->redirectToRoute('app_posts'); + } +} diff --git a/src/EventListener/LocaleListener.php b/src/EventListener/LocaleListener.php new file mode 100644 index 0000000..6a56c8c --- /dev/null +++ b/src/EventListener/LocaleListener.php @@ -0,0 +1,28 @@ +getRequest(); + if ($request->attributes->getBoolean('_stateless')) { + return; + } + $locale = $request->getSession()->get('_locale'); + if ($locale !== null) { + $this->localeSwitcher->setLocale($locale); + } + } +} diff --git a/templates/_pagination.html.twig b/templates/_pagination.html.twig index 1c4cc35..9c9fdae 100644 --- a/templates/_pagination.html.twig +++ b/templates/_pagination.html.twig @@ -2,7 +2,7 @@ diff --git a/templates/base.html.twig b/templates/base.html.twig index 1988983..4f29e24 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -2,7 +2,7 @@ - {% block title %}Welcome to Herbarium!{% endblock %} + {% block title %}{{ 'welcome_to_herbarium'|trans }}{% endblock %} {% block stylesheets %} @@ -16,11 +16,15 @@
diff --git a/templates/post/_delete_form.html.twig b/templates/post/_delete_form.html.twig index a3d1403..ce11f27 100644 --- a/templates/post/_delete_form.html.twig +++ b/templates/post/_delete_form.html.twig @@ -1,4 +1,4 @@ -
+ - +
diff --git a/templates/post/_form.html.twig b/templates/post/_form.html.twig index 9328bd5..09241c4 100644 --- a/templates/post/_form.html.twig +++ b/templates/post/_form.html.twig @@ -1,4 +1,4 @@ {{ form_start(form) }} {{ form_widget(form) }} - + {{ form_end(form) }} diff --git a/templates/post/edit.html.twig b/templates/post/edit.html.twig index 16b6b5f..b8167d8 100644 --- a/templates/post/edit.html.twig +++ b/templates/post/edit.html.twig @@ -3,11 +3,10 @@ {% block title %}Edit Post{% endblock %} {% block body %} -

Edit Post

+

{{ 'edit_post'|trans }}

- {{ include('post/_form.html.twig', {'button_label': 'Update'}) }} - - back to list + {{ include('post/_form.html.twig', {'button_label': 'update'|trans}) }} + {{ 'back_to_list'|trans }} {{ include('post/_delete_form.html.twig') }} {% endblock %} diff --git a/templates/post/index.html.twig b/templates/post/index.html.twig index 93176ab..5ea65a2 100644 --- a/templates/post/index.html.twig +++ b/templates/post/index.html.twig @@ -1,19 +1,19 @@ {% extends 'base.html.twig' %} -{% block title %}Posts{% endblock %} +{% block title %}{{ 'posts'|trans }}{% endblock %} {% block body %} {% for post in posts.iterator %} -
+
-
{{ post.species ? post.species.vernacularName : 'Post' }}
+
{{ post.species ? post.species.vernacularName : 'post_undefined'|trans }}
{{ post.foundDate | date("d/m/Y \\à H \\h") }}

{{ post.latitude }}, {{ post.longitude }}, {{ post.altitude }}m

{{ post.commentary }}

{% endfor %} diff --git a/templates/post/new.html.twig b/templates/post/new.html.twig index b8bc236..ccd46d6 100644 --- a/templates/post/new.html.twig +++ b/templates/post/new.html.twig @@ -1,11 +1,11 @@ {% extends 'base.html.twig' %} -{% block title %}New Post{% endblock %} +{% block title %}{{ 'new_post'|trans }}{% endblock %} {% block body %} -

Create new Post

+

{{ 'create_new_post'|trans }}

{{ include('post/_form.html.twig') }} - back to list + {{ 'back_to_list'|trans }} {% endblock %} diff --git a/templates/post/show.html.twig b/templates/post/show.html.twig index 76d00e5..0e8056a 100644 --- a/templates/post/show.html.twig +++ b/templates/post/show.html.twig @@ -1,9 +1,9 @@ {% extends 'base.html.twig' %} -{% block title %}Post{% endblock %} +{% block title %}{{ 'post'|trans }}{% endblock %} {% block body %} -

Post

+

{{ 'post'|trans }}

@@ -12,11 +12,11 @@ - + - + @@ -38,15 +38,15 @@ {% endif %} - +
{{ post.id }}
FoundDate{{ 'found_date'|trans }} {{ post.foundDate ? post.foundDate|date('Y-m-d H:i:s') : '' }}
PublicationDate{{ 'publication_date'|trans }} {{ post.publicationDate ? post.publicationDate|date('Y-m-d H:i:s') : '' }}
Commentary{{ 'commentary'|trans }} {{ post.commentary }}
- back to list + {{ 'back_to_list'|trans }} - edit + {{ 'edit'|trans }} {{ include('post/_delete_form.html.twig') }} diff --git a/templates/post/table.html.twig b/templates/post/table.html.twig index 3a5db93..89af356 100644 --- a/templates/post/table.html.twig +++ b/templates/post/table.html.twig @@ -1,21 +1,21 @@ {% extends 'base.html.twig' %} -{% block title %}Post index{% endblock %} +{% block title %}{{ 'post_index'|trans }}{% endblock %} {% block body %} -

Post index

+

{{ 'post_index'|trans }}

- - + + - - + + @@ -29,17 +29,17 @@ {% else %} - + {% endfor %}
IdFoundDatePublicationDate{{ 'found_date'|trans }}{{ 'publication_date'|trans }} Latitude Longitude AltitudeCommentaryactions{{ 'commentary'|trans }}Actions
{{ post.altitude }} {{ post.commentary }} - show - edit + {{ 'show'|trans }} + {{ 'edit'|trans }}
no records found{{ 'no_records_found'|trans }}
- Create new + {{ 'create_new'|trans }} {% endblock %} diff --git a/templates/registration/register.html.twig b/templates/registration/register.html.twig index 4bbc321..0aa84e8 100644 --- a/templates/registration/register.html.twig +++ b/templates/registration/register.html.twig @@ -1,9 +1,9 @@ {% extends 'base.html.twig' %} -{% block title %}Register{% endblock %} +{% block title %}{{ 'register'|trans }}{% endblock %} {% block body %} -

Register

+

{{ 'register'|trans }}

{{ form_errors(registrationForm) }} @@ -14,6 +14,6 @@ }) }} {{ form_row(registrationForm.agreeTerms) }} - + {{ form_end(registrationForm) }} {% endblock %} diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index d24cfff..6db2e51 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -1,6 +1,6 @@ {% extends 'base.html.twig' %} -{% block title %}Log in!{% endblock %} +{% block title %}{{ 'log_in'|trans }}{% endblock %} {% block body %}
@@ -10,17 +10,17 @@ {% if app.user %}
- You are logged in as {{ app.user.userIdentifier }}, Logout + You are logged in as {{ app.user.userIdentifier }}, {{ 'logout'|trans }}
{% endif %} -

Please sign in

+

{{ 'sign_in'|trans }}

- +
@@ -34,16 +34,16 @@
#} - Sign up + {{ 'sign_up'|trans }}
{% endblock %} diff --git a/templates/species/_delete_form.html.twig b/templates/species/_delete_form.html.twig index bc97a0a..e195c78 100644 --- a/templates/species/_delete_form.html.twig +++ b/templates/species/_delete_form.html.twig @@ -1,4 +1,4 @@ -
+ - +
diff --git a/templates/species/_form.html.twig b/templates/species/_form.html.twig index bf20b98..09241c4 100644 --- a/templates/species/_form.html.twig +++ b/templates/species/_form.html.twig @@ -1,4 +1,4 @@ {{ form_start(form) }} {{ form_widget(form) }} - + {{ form_end(form) }} diff --git a/templates/species/edit.html.twig b/templates/species/edit.html.twig index 8e4401b..63a9d4e 100644 --- a/templates/species/edit.html.twig +++ b/templates/species/edit.html.twig @@ -1,13 +1,12 @@ {% extends 'base.html.twig' %} -{% block title %}Edit Species{% endblock %} +{% block title %}{{ 'edit_species'|trans }}{% endblock %} {% block body %} -

Edit Species

+

{{ 'edit_species'|trans }}

+ {{ include('species/_form.html.twig', {'button_label': 'update'|trans}) }} - {{ include('species/_form.html.twig', {'button_label': 'Update'}) }} - - back to list + {{ 'back_to_list'|trans }} {{ include('species/_delete_form.html.twig') }} {% endblock %} diff --git a/templates/species/index.html.twig b/templates/species/index.html.twig index e855f6c..421b653 100644 --- a/templates/species/index.html.twig +++ b/templates/species/index.html.twig @@ -1,6 +1,6 @@ {% extends 'base.html.twig' %} -{% block title %}Species{% endblock %} +{% block title %}{{ 'species'|trans }}{% endblock %} {% block body %}
-

Liste des espèces

+

{{ 'list_of_species'|trans }}

{% for specie in species %} @@ -19,12 +19,12 @@
- 🔬 Nom Scientifique : {{ specie.scientificName }}
- 📍 Region : {{ specie.region }} + 🔬 {{ 'scientific_name'|trans }} : {{ specie.scientificName }}
+ 📍 {{ 'region'|trans }} : {{ specie.region }}

{% endfor %}
- Create new + {{ 'create_new'|trans }}
{% endblock %} diff --git a/templates/species/new.html.twig b/templates/species/new.html.twig index 8e58597..9b20266 100644 --- a/templates/species/new.html.twig +++ b/templates/species/new.html.twig @@ -3,9 +3,9 @@ {% block title %}New Species{% endblock %} {% block body %} -

Create new Species

+

{{ 'create_new_species'|trans }}

{{ include('species/_form.html.twig') }} - back to list + {{ 'back_to_list'|trans }} {% endblock %} diff --git a/templates/species/show.html.twig b/templates/species/show.html.twig index 152ea09..c3dd4e1 100644 --- a/templates/species/show.html.twig +++ b/templates/species/show.html.twig @@ -1,16 +1,16 @@ {% extends 'base.html.twig' %} -{% block title %}Species{% endblock %} +{% block title %}{{ 'species'|trans }}{% endblock %} {% block body %}

{{ species.vernacularName }}

- 🔬 Nom Scientifique : {{ species.scientificName }}
- 📍 Region : {{ species.region }} + 🔬 {{ 'scientific_name'|trans }} : {{ species.scientificName }}
+ 📍 {{ 'region'|trans }} : {{ species.region }}

-

Posts :

+

{{ 'posts'|trans }} :

{% for post in species.posts %}
@@ -18,18 +18,18 @@

{{ post.publicationDate | date }}

-
📍Géolocalisation
+
📍{{ 'geolocation'|trans }}
{{ post.longitude }} - {{ post.latitude }}
-
📍Commentaire
+
💬{{ 'commentary'|trans }}
{{ post.getCommentary }}
{% endfor %} - back to list + {{ 'back_to_list'|trans }} - edit + {{ 'edit'|trans }} {{ include('species/_delete_form.html.twig') }}
diff --git a/templates/species/table.html.twig b/templates/species/table.html.twig index 1303738..ba8c565 100644 --- a/templates/species/table.html.twig +++ b/templates/species/table.html.twig @@ -1,18 +1,18 @@ {% extends 'base.html.twig' %} -{% block title %}Species index{% endblock %} +{% block title %}{{ 'species_index'|trans }}{% endblock %} {% block body %} -

Species index

+

{{ 'species_index'|trans }}

- - - - + + + + @@ -23,17 +23,17 @@ {% else %} - + {% endfor %}
IdScientific_nameVernacular_nameRegionactions{{ 'scientific_name'|trans }}{{ 'vernacular_name'|trans }}{{ 'region'|trans }}Actions
{{ species.vernacularName }} {{ species.region }} - show - edit + {{ 'show'|trans }} + {{ 'edit'|trans }}
no records found{{ 'no_records_found'|trans }}
- Create new + {{ 'create_new'|trans }} {% endblock %} diff --git a/translations/.gitignore b/translations/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/translations/VerifyEmailBundle.en.xlf b/translations/VerifyEmailBundle.en.xlf new file mode 100644 index 0000000..0522bde --- /dev/null +++ b/translations/VerifyEmailBundle.en.xlf @@ -0,0 +1,42 @@ + + + +
+ +
+ + + %count% year|%count% years + %count% year|%count% years + + + %count% month|%count% months + %count% month|%count% months + + + %count% day|%count% days + %count% day|%count% days + + + %count% hour|%count% hours + %count% hour|%count% hours + + + %count% minute|%count% minutes + %count% minute|%count% minutes + + + The link to verify your email has expired. Please request a new link. + The link to verify your email has expired. Please request a new link. + + + The link to verify your email is invalid. Please request a new link. + The link to verify your email is invalid. Please request a new link. + + + The link to verify your email appears to be for a different account or email. Please request a new link. + The link to verify your email appears to be for a different account or email. Please request a new link. + + +
+
diff --git a/translations/VerifyEmailBundle.fr.xlf b/translations/VerifyEmailBundle.fr.xlf new file mode 100644 index 0000000..bfbb78c --- /dev/null +++ b/translations/VerifyEmailBundle.fr.xlf @@ -0,0 +1,42 @@ + + + +
+ +
+ + + %count% year|%count% years + %count% année|%count% années + + + %count% month|%count% months + %count% mois|%count% mois + + + %count% day|%count% days + %count% jour|%count% jours + + + %count% hour|%count% hours + %count% heure|%count% heures + + + %count% minute|%count% minutes + %count% minute|%count% minutes + + + The link to verify your email has expired. Please request a new link. + Le lien pour vérifier votre adresse e-mail a expiré. Veuillez refaire une demande de réinitialisation. + + + The link to verify your email is invalid. Please request a new link. + Le lien pour vérifier votre adresse e-mail est invalide. Veuillez refaire une demande de réinitialisation. + + + The link to verify your email appears to be for a different account or email. Please request a new link. + Le lien permettant de vérifier votre adresse e-mail semble correspondre à un autre compte ou e-mail. Veuillez refaire une demande de réinitialisation. + + +
+
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf new file mode 100644 index 0000000..587e1f6 --- /dev/null +++ b/translations/messages.en.xlf @@ -0,0 +1,166 @@ + + + +
+ +
+ + + delete + Delete + + + delete_confirm + Are you sure you want to delete ? + + + log_out + Log out + + + sign_in + Sign in + + + welcome_to_herbarium + Welcome to Herbarium + + + new_post + New post + + + create_new_post + Create new post + + + back_to_list + Back to list + + + post + Post + + + found_date + Found date + + + publication_date + Publication date + + + commentary + Commentary + + + edit + Edit + + + post_index + Post index + + + show + Show + + + no_records_found + No records found + + + create_new + Create new + + + register + Register + + + log_in + Log in + + + logout + Log out + + + password + Password + + + sign_up + Sign up + + + species + Species + + + list_of_species + List of species + + + scientific_name + Scientific name + + + region + Region + + + create_new_species + Create new species + + + posts + Posts + + + geolocation + Geolocation + + + species_index + Species index + + + vernacular_name + Vernacular name + + + delete_item_confirmation + Are you sure you want to delete this item ? + + + previous + Previous + + + next + Next + + + post_undefined + Post undefined + + + edit_species + Edit species + + + edit_post + Edit post + + + update + Update + + + save + Save + + +
+
diff --git a/translations/messages.fr.xlf b/translations/messages.fr.xlf new file mode 100644 index 0000000..f518d69 --- /dev/null +++ b/translations/messages.fr.xlf @@ -0,0 +1,166 @@ + + + +
+ +
+ + + delete + Supprimer + + + delete_confirm + Êtes-vous sûr de vouloir supprimer ? + + + log_out + Se déconnecter + + + sign_in + Se connecter + + + welcome_to_herbarium + Bienvenue sur Herbarium + + + new_post + Nouvelle publication + + + create_new_post + Création d'une nouvelle publication + + + back_to_list + Retour à la liste + + + post + Publication + + + found_date + Date de découverte + + + publication_date + Date de publication + + + commentary + Commentaire + + + edit + Éditer + + + post_index + Index des publications + + + show + Montrer + + + no_records_found + Pas d'enregistrements trouvés + + + create_new + Création d'un nouvel enregistrement + + + register + Créer un compte + + + log_in + Se connecter + + + logout + Se déconnecter + + + password + Mot de passe + + + sign_up + S'inscrire + + + species + Espèces + + + list_of_species + Liste des espèces + + + scientific_name + Nom scientifique + + + region + Région + + + create_new_species + Créer une nouvelle espèce + + + posts + Publications + + + geolocation + Géolocalisation + + + species_index + Index des espèces + + + vernacular_name + Nom vernaculaire + + + delete_item_confirmation + Êtes-vous sûr de vouloir supprimer ? + + + previous + Retour + + + next + Suivant + + + post_undefined + Publication non définie + + + edit_species + Éditer l'espèce + + + edit_post + Éditer la publication + + + update + Mettre à jour + + + save + Sauvegarder + + +
+
diff --git a/translations/security.en.xlf b/translations/security.en.xlf new file mode 100644 index 0000000..cde7936 --- /dev/null +++ b/translations/security.en.xlf @@ -0,0 +1,82 @@ + + + +
+ +
+ + + An authentication exception occurred. + An authentication exception occurred. + + + Authentication credentials could not be found. + Authentication credentials could not be found. + + + Authentication request could not be processed due to a system problem. + Authentication request could not be processed due to a system problem. + + + Invalid credentials. + Invalid credentials. + + + Cookie has already been used by someone else. + Cookie has already been used by someone else. + + + Not privileged to request the resource. + Not privileged to request the resource. + + + Invalid CSRF token. + Invalid CSRF token. + + + No authentication provider found to support the authentication token. + No authentication provider found to support the authentication token. + + + No session available, it either timed out or cookies are not enabled. + No session available, it either timed out or cookies are not enabled. + + + No token could be found. + No token could be found. + + + Username could not be found. + Username could not be found. + + + Account has expired. + Account has expired. + + + Credentials have expired. + Credentials have expired. + + + Account is disabled. + Account is disabled. + + + Account is locked. + Account is locked. + + + Too many failed login attempts, please try again later. + Too many failed login attempts, please try again later. + + + Invalid or expired login link. + Invalid or expired login link. + + + Too many failed login attempts, please try again in %minutes% minute. + Too many failed login attempts, please try again in %minutes% minute. + + +
+
diff --git a/translations/security.fr.xlf b/translations/security.fr.xlf new file mode 100644 index 0000000..4735733 --- /dev/null +++ b/translations/security.fr.xlf @@ -0,0 +1,82 @@ + + + +
+ +
+ + + An authentication exception occurred. + Une exception d'authentification s'est produite. + + + Authentication credentials could not be found. + Les identifiants d'authentification n'ont pas pu être trouvés. + + + Authentication request could not be processed due to a system problem. + La requête d'authentification n'a pas pu être executée à cause d'un problème système. + + + Invalid credentials. + Identifiants invalides. + + + Cookie has already been used by someone else. + Le cookie a déjà été utilisé par quelqu'un d'autre. + + + Not privileged to request the resource. + Privilèges insuffisants pour accéder à la ressource. + + + Invalid CSRF token. + Jeton CSRF invalide. + + + No authentication provider found to support the authentication token. + Aucun fournisseur d'authentification n'a été trouvé pour supporter le jeton d'authentification. + + + No session available, it either timed out or cookies are not enabled. + Aucune session disponible, celle-ci a expiré ou les cookies ne sont pas activés. + + + No token could be found. + Aucun jeton n'a pu être trouvé. + + + Username could not be found. + Le nom d'utilisateur n'a pas pu être trouvé. + + + Account has expired. + Le compte a expiré. + + + Credentials have expired. + Les identifiants ont expiré. + + + Account is disabled. + Le compte est désactivé. + + + Account is locked. + Le compte est bloqué. + + + Too many failed login attempts, please try again later. + Plusieurs tentatives de connexion ont échoué, veuillez réessayer plus tard. + + + Invalid or expired login link. + Lien de connexion invalide ou expiré. + + + Too many failed login attempts, please try again in %minutes% minute. + Plusieurs tentatives de connexion ont échoué, veuillez réessayer dans %minutes% minute. + + +
+
diff --git a/translations/validators.en.xlf b/translations/validators.en.xlf new file mode 100644 index 0000000..71cbc03 --- /dev/null +++ b/translations/validators.en.xlf @@ -0,0 +1,598 @@ + + + +
+ +
+ + + This value should be false. + This value should be false. + + + This value should be true. + This value should be true. + + + This value should be of type {{ type }}. + This value should be of type {{ type }}. + + + This value should be blank. + This value should be blank. + + + The value you selected is not a valid choice. + The value you selected is not a valid choice. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + + + One or more of the given values is invalid. + One or more of the given values is invalid. + + + This field was not expected. + This field was not expected. + + + This field is missing. + This field is missing. + + + This value is not a valid date. + This value is not a valid date. + + + This value is not a valid datetime. + This value is not a valid datetime. + + + This value is not a valid email address. + This value is not a valid email address. + + + The file could not be found. + The file could not be found. + + + The file is not readable. + The file is not readable. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + + + This value should be {{ limit }} or less. + This value should be {{ limit }} or less. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + + + This value should be {{ limit }} or more. + This value should be {{ limit }} or more. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + + + This value should not be blank. + This value should not be blank. + + + This value should not be null. + This value should not be null. + + + This value should be null. + This value should be null. + + + This value is not valid. + This value is not valid. + + + This value is not a valid time. + This value is not a valid time. + + + This value is not a valid URL. + This value is not a valid URL. + + + The two values should be equal. + The two values should be equal. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + + + The file is too large. + The file is too large. + + + The file could not be uploaded. + The file could not be uploaded. + + + This value should be a valid number. + This value should be a valid number. + + + This file is not a valid image. + This file is not a valid image. + + + This is not a valid IP address. + This value is not a valid IP address. + + + This value is not a valid language. + This value is not a valid language. + + + This value is not a valid locale. + This value is not a valid locale. + + + This value is not a valid country. + This value is not a valid country. + + + This value is already used. + This value is already used. + + + The size of the image could not be detected. + The size of the image could not be detected. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + + + This value should be the user's current password. + This value should be the user's current password. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + + + The file was only partially uploaded. + The file was only partially uploaded. + + + No file was uploaded. + No file was uploaded. + + + No temporary folder was configured in php.ini. + No temporary folder was configured in php.ini, or the configured folder does not exist. + + + Cannot write temporary file to disk. + Cannot write temporary file to disk. + + + A PHP extension caused the upload to fail. + A PHP extension caused the upload to fail. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + + + Invalid card number. + Invalid card number. + + + Unsupported card type or invalid card number. + Unsupported card type or invalid card number. + + + This is not a valid International Bank Account Number (IBAN). + This value is not a valid International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + This value is not a valid ISBN-10. + + + This value is not a valid ISBN-13. + This value is not a valid ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + This value is neither a valid ISBN-10 nor a valid ISBN-13. + + + This value is not a valid ISSN. + This value is not a valid ISSN. + + + This value is not a valid currency. + This value is not a valid currency. + + + This value should be equal to {{ compared_value }}. + This value should be equal to {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + This value should be greater than {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + This value should be greater than or equal to {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + This value should be less than {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + This value should be less than or equal to {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + This value should not be equal to {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + + + An empty file is not allowed. + An empty file is not allowed. + + + The host could not be resolved. + The host could not be resolved. + + + This value does not match the expected {{ charset }} charset. + This value does not match the expected {{ charset }} charset. + + + This is not a valid Business Identifier Code (BIC). + This value is not a valid Business Identifier Code (BIC). + + + Error + Error + + + This is not a valid UUID. + This value is not a valid UUID. + + + This value should be a multiple of {{ compared_value }}. + This value should be a multiple of {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + + + This value should be valid JSON. + This value should be valid JSON. + + + This collection should contain only unique elements. + This collection should contain only unique elements. + + + This value should be positive. + This value should be positive. + + + This value should be either positive or zero. + This value should be either positive or zero. + + + This value should be negative. + This value should be negative. + + + This value should be either negative or zero. + This value should be either negative or zero. + + + This value is not a valid timezone. + This value is not a valid timezone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + This password has been leaked in a data breach, it must not be used. Please use another password. + + + This value should be between {{ min }} and {{ max }}. + This value should be between {{ min }} and {{ max }}. + + + This value is not a valid hostname. + This value is not a valid hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + The number of elements in this collection should be a multiple of {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + This value should satisfy at least one of the following constraints: + + + Each element of this collection should satisfy its own set of constraints. + Each element of this collection should satisfy its own set of constraints. + + + This value is not a valid International Securities Identification Number (ISIN). + This value is not a valid International Securities Identification Number (ISIN). + + + This value should be a valid expression. + This value should be a valid expression. + + + This value is not a valid CSS color. + This value is not a valid CSS color. + + + This value is not a valid CIDR notation. + This value is not a valid CIDR notation. + + + The value of the netmask should be between {{ min }} and {{ max }}. + The value of the netmask should be between {{ min }} and {{ max }}. + + + The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less. + The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less. + + + The password strength is too low. Please use a stronger password. + The password strength is too low. Please use a stronger password. + + + This value contains characters that are not allowed by the current restriction-level. + This value contains characters that are not allowed by the current restriction-level. + + + Using invisible characters is not allowed. + Using invisible characters is not allowed. + + + Mixing numbers from different scripts is not allowed. + Mixing numbers from different scripts is not allowed. + + + Using hidden overlay characters is not allowed. + Using hidden overlay characters is not allowed. + + + The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. + The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. + + + The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. + The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. + + + This value is not a valid MAC address. + This value is not a valid MAC address. + + + This URL is missing a top-level domain. + This URL is missing a top-level domain. + + + This form should not contain extra fields. + This form should not contain extra fields. + + + The uploaded file was too large. Please try to upload a smaller file. + The uploaded file was too large. Please try to upload a smaller file. + + + The CSRF token is invalid. Please try to resubmit the form. + The CSRF token is invalid. Please try to resubmit the form. + + + This value is not a valid HTML5 color. + This value is not a valid HTML5 color. + + + Please enter a valid birthdate. + Please enter a valid birthdate. + + + The selected choice is invalid. + The selected choice is invalid. + + + The collection is invalid. + The collection is invalid. + + + Please select a valid color. + Please select a valid color. + + + Please select a valid country. + Please select a valid country. + + + Please select a valid currency. + Please select a valid currency. + + + Please choose a valid date interval. + Please choose a valid date interval. + + + Please enter a valid date and time. + Please enter a valid date and time. + + + Please enter a valid date. + Please enter a valid date. + + + Please select a valid file. + Please select a valid file. + + + The hidden field is invalid. + The hidden field is invalid. + + + Please enter an integer. + Please enter an integer. + + + Please select a valid language. + Please select a valid language. + + + Please select a valid locale. + Please select a valid locale. + + + Please enter a valid money amount. + Please enter a valid money amount. + + + Please enter a number. + Please enter a number. + + + The password is invalid. + The password is invalid. + + + Please enter a percentage value. + Please enter a percentage value. + + + The values do not match. + The values do not match. + + + Please enter a valid time. + Please enter a valid time. + + + Please select a valid timezone. + Please select a valid timezone. + + + Please enter a valid URL. + Please enter a valid URL. + + + Please enter a valid search term. + Please enter a valid search term. + + + Please provide a valid phone number. + Please provide a valid phone number. + + + The checkbox has an invalid value. + The checkbox has an invalid value. + + + Please enter a valid email address. + Please enter a valid email address. + + + Please select a valid option. + Please select a valid option. + + + Please select a valid range. + Please select a valid range. + + + Please enter a valid week. + Please enter a valid week. + + + There is already an account with this email + There is already an account with this email + + + You should agree to our terms. + You should agree to our terms. + + + Please enter a password + Please enter a password + + + Your password should be at least {{ limit }} characters + Your password should be at least {{ limit }} characters + + +
+
diff --git a/translations/validators.fr.xlf b/translations/validators.fr.xlf new file mode 100644 index 0000000..666570a --- /dev/null +++ b/translations/validators.fr.xlf @@ -0,0 +1,598 @@ + + + +
+ +
+ + + This value should be false. + Cette valeur doit être fausse. + + + This value should be true. + Cette valeur doit être vraie. + + + This value should be of type {{ type }}. + Cette valeur doit être de type {{ type }}. + + + This value should be blank. + Cette valeur doit être vide. + + + The value you selected is not a valid choice. + Cette valeur doit être l'un des choix proposés. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Vous devez sélectionner au moins {{ limit }} choix.|Vous devez sélectionner au moins {{ limit }} choix. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Vous devez sélectionner au maximum {{ limit }} choix.|Vous devez sélectionner au maximum {{ limit }} choix. + + + One or more of the given values is invalid. + Une ou plusieurs des valeurs soumises sont invalides. + + + This field was not expected. + Ce champ n'a pas été prévu. + + + This field is missing. + Ce champ est manquant. + + + This value is not a valid date. + Cette valeur n'est pas une date valide. + + + This value is not a valid datetime. + Cette valeur n'est pas une date valide. + + + This value is not a valid email address. + Cette valeur n'est pas une adresse email valide. + + + The file could not be found. + Le fichier n'a pas été trouvé. + + + The file is not readable. + Le fichier n'est pas lisible. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Le fichier est trop volumineux ({{ size }} {{ suffix }}). Sa taille ne doit pas dépasser {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Le type du fichier est invalide ({{ type }}). Les types autorisés sont {{ types }}. + + + This value should be {{ limit }} or less. + Cette valeur doit être inférieure ou égale à {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Cette chaîne est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaîne est trop longue. Elle doit avoir au maximum {{ limit }} caractères. + + + This value should be {{ limit }} or more. + Cette valeur doit être supérieure ou égale à {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Cette chaîne est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaîne est trop courte. Elle doit avoir au minimum {{ limit }} caractères. + + + This value should not be blank. + Cette valeur ne doit pas être vide. + + + This value should not be null. + Cette valeur ne doit pas être nulle. + + + This value should be null. + Cette valeur doit être nulle. + + + This value is not valid. + Cette valeur n'est pas valide. + + + This value is not a valid time. + Cette valeur n'est pas une heure valide. + + + This value is not a valid URL. + Cette valeur n'est pas une URL valide. + + + The two values should be equal. + Les deux valeurs doivent être identiques. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Le fichier est trop volumineux. Sa taille ne doit pas dépasser {{ limit }} {{ suffix }}. + + + The file is too large. + Le fichier est trop volumineux. + + + The file could not be uploaded. + Le téléchargement de ce fichier est impossible. + + + This value should be a valid number. + Cette valeur doit être un nombre. + + + This file is not a valid image. + Ce fichier n'est pas une image valide. + + + This is not a valid IP address. + Cette valeur n'est pas une adresse IP valide. + + + This value is not a valid language. + Cette langue n'est pas valide. + + + This value is not a valid locale. + Ce paramètre régional n'est pas valide. + + + This value is not a valid country. + Ce pays n'est pas valide. + + + This value is already used. + Cette valeur est déjà utilisée. + + + The size of the image could not be detected. + La taille de l'image n'a pas pu être détectée. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La largeur de l'image est trop grande ({{ width }}px). La largeur maximale autorisée est de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La largeur de l'image est trop petite ({{ width }}px). La largeur minimale attendue est de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La hauteur de l'image est trop grande ({{ height }}px). La hauteur maximale autorisée est de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La hauteur de l'image est trop petite ({{ height }}px). La hauteur minimale attendue est de {{ min_height }}px. + + + This value should be the user's current password. + Cette valeur doit être le mot de passe actuel de l'utilisateur. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Cette chaîne doit avoir exactement {{ limit }} caractère.|Cette chaîne doit avoir exactement {{ limit }} caractères. + + + The file was only partially uploaded. + Le fichier a été partiellement transféré. + + + No file was uploaded. + Aucun fichier n'a été transféré. + + + No temporary folder was configured in php.ini. + Aucun répertoire temporaire n'a été configuré dans le php.ini, ou le répertoire configuré n'existe pas. + + + Cannot write temporary file to disk. + Impossible d'écrire le fichier temporaire sur le disque. + + + A PHP extension caused the upload to fail. + Une extension PHP a empêché le transfert du fichier. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Cette collection doit contenir {{ limit }} élément ou plus.|Cette collection doit contenir {{ limit }} éléments ou plus. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Cette collection doit contenir {{ limit }} élément ou moins.|Cette collection doit contenir {{ limit }} éléments ou moins. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Cette collection doit contenir exactement {{ limit }} élément.|Cette collection doit contenir exactement {{ limit }} éléments. + + + Invalid card number. + Numéro de carte invalide. + + + Unsupported card type or invalid card number. + Type de carte non supporté ou numéro invalide. + + + This is not a valid International Bank Account Number (IBAN). + Cette valeur n'est pas un Numéro de Compte Bancaire International (IBAN) valide. + + + This value is not a valid ISBN-10. + Cette valeur n'est pas un code ISBN-10 valide. + + + This value is not a valid ISBN-13. + Cette valeur n'est pas un code ISBN-13 valide. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Cette valeur n'est ni un code ISBN-10, ni un code ISBN-13 valide. + + + This value is not a valid ISSN. + Cette valeur n'est pas un code ISSN valide. + + + This value is not a valid currency. + Cette valeur n'est pas une devise valide. + + + This value should be equal to {{ compared_value }}. + Cette valeur doit être égale à {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Cette valeur doit être supérieure à {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Cette valeur doit être supérieure ou égale à {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Cette valeur doit être identique à {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Cette valeur doit être inférieure à {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Cette valeur doit être inférieure ou égale à {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Cette valeur ne doit pas être égale à {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Cette valeur ne doit pas être identique à {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Le rapport largeur/hauteur de l'image est trop grand ({{ ratio }}). Le rapport maximal autorisé est {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Le rapport largeur/hauteur de l'image est trop petit ({{ ratio }}). Le rapport minimal attendu est {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'image est carrée ({{ width }}x{{ height }}px). Les images carrées ne sont pas autorisées. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'image est au format paysage ({{ width }}x{{ height }}px). Les images au format paysage ne sont pas autorisées. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'image est au format portrait ({{ width }}x{{ height }}px). Les images au format portrait ne sont pas autorisées. + + + An empty file is not allowed. + Un fichier vide n'est pas autorisé. + + + The host could not be resolved. + Le nom de domaine n'a pas pu être résolu. + + + This value does not match the expected {{ charset }} charset. + Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu. + + + This is not a valid Business Identifier Code (BIC). + Cette valeur n'est pas un Code Identifiant de Business (BIC) valide. + + + Error + Erreur + + + This is not a valid UUID. + Cette valeur n'est pas un UUID valide. + + + This value should be a multiple of {{ compared_value }}. + Cette valeur doit être un multiple de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ce code d'identification d'entreprise (BIC) n'est pas associé à l'IBAN {{ iban }}. + + + This value should be valid JSON. + Cette valeur doit être un JSON valide. + + + This collection should contain only unique elements. + Cette collection ne doit pas comporter de doublons. + + + This value should be positive. + Cette valeur doit être strictement positive. + + + This value should be either positive or zero. + Cette valeur doit être supérieure ou égale à zéro. + + + This value should be negative. + Cette valeur doit être strictement négative. + + + This value should be either negative or zero. + Cette valeur doit être inférieure ou égale à zéro. + + + This value is not a valid timezone. + Cette valeur n'est pas un fuseau horaire valide. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ce mot de passe a été divulgué lors d'une fuite de données, il ne doit plus être utilisé. Veuillez utiliser un autre mot de passe. + + + This value should be between {{ min }} and {{ max }}. + Cette valeur doit être comprise entre {{ min }} et {{ max }}. + + + This value is not a valid hostname. + Cette valeur n'est pas un nom d'hôte valide. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Cette valeur doit satisfaire à au moins une des contraintes suivantes : + + + Each element of this collection should satisfy its own set of constraints. + Chaque élément de cette collection doit satisfaire à son propre jeu de contraintes. + + + This value is not a valid International Securities Identification Number (ISIN). + Cette valeur n'est pas un code international de sécurité valide (ISIN). + + + This value should be a valid expression. + Cette valeur doit être une expression valide. + + + This value is not a valid CSS color. + Cette valeur n'est pas une couleur CSS valide. + + + This value is not a valid CIDR notation. + Cette valeur n'est pas une notation CIDR valide. + + + The value of the netmask should be between {{ min }} and {{ max }}. + La valeur du masque de réseau doit être comprise entre {{ min }} et {{ max }}. + + + The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less. + Le nom du fichier est trop long. Il doit contenir au maximum {{ filename_max_length }} caractère.|Le nom de fichier est trop long. Il doit contenir au maximum {{ filename_max_length }} caractères. + + + The password strength is too low. Please use a stronger password. + La robustesse du mot de passe est trop faible. Veuillez utiliser un mot de passe plus fort. + + + This value contains characters that are not allowed by the current restriction-level. + Cette valeur contient des caractères qui ne sont pas autorisés par le niveau de restriction actuel. + + + Using invisible characters is not allowed. + Utiliser des caractères invisibles n'est pas autorisé. + + + Mixing numbers from different scripts is not allowed. + Mélanger des chiffres provenant de différents scripts n'est pas autorisé. + + + Using hidden overlay characters is not allowed. + Utiliser des caractères de superposition cachés n'est pas autorisé. + + + The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}. + L'extension du fichier est invalide ({{ extension }}). Les extensions autorisées sont {{ extensions }}. + + + The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}. + L'encodage de caractères détecté est invalide ({{ detected }}). Les encodages autorisés sont {{ encodings }}. + + + This value is not a valid MAC address. + Cette valeur n'est pas une adresse MAC valide. + + + This URL is missing a top-level domain. + Cette URL doit contenir un domaine de premier niveau. + + + This form should not contain extra fields. + Ce formulaire ne doit pas contenir de champs supplémentaires. + + + The uploaded file was too large. Please try to upload a smaller file. + Le fichier téléchargé est trop volumineux. Merci d'essayer d'envoyer un fichier plus petit. + + + The CSRF token is invalid. Please try to resubmit the form. + Le jeton CSRF est invalide. Veuillez renvoyer le formulaire. + + + This value is not a valid HTML5 color. + Cette valeur n'est pas une couleur HTML5 valide. + + + Please enter a valid birthdate. + Veuillez entrer une date de naissance valide. + + + The selected choice is invalid. + Le choix sélectionné est invalide. + + + The collection is invalid. + La collection est invalide. + + + Please select a valid color. + Veuillez sélectionner une couleur valide. + + + Please select a valid country. + Veuillez sélectionner un pays valide. + + + Please select a valid currency. + Veuillez sélectionner une devise valide. + + + Please choose a valid date interval. + Veuillez choisir un intervalle de dates valide. + + + Please enter a valid date and time. + Veuillez saisir une date et une heure valides. + + + Please enter a valid date. + Veuillez entrer une date valide. + + + Please select a valid file. + Veuillez sélectionner un fichier valide. + + + The hidden field is invalid. + Le champ masqué n'est pas valide. + + + Please enter an integer. + Veuillez saisir un entier. + + + Please select a valid language. + Veuillez sélectionner une langue valide. + + + Please select a valid locale. + Veuillez sélectionner une langue valide. + + + Please enter a valid money amount. + Veuillez saisir un montant valide. + + + Please enter a number. + Veuillez saisir un nombre. + + + The password is invalid. + Le mot de passe est invalide. + + + Please enter a percentage value. + Veuillez saisir un pourcentage valide. + + + The values do not match. + Les valeurs ne correspondent pas. + + + Please enter a valid time. + Veuillez saisir une heure valide. + + + Please select a valid timezone. + Veuillez sélectionner un fuseau horaire valide. + + + Please enter a valid URL. + Veuillez saisir une URL valide. + + + Please enter a valid search term. + Veuillez saisir un terme de recherche valide. + + + Please provide a valid phone number. + Veuillez fournir un numéro de téléphone valide. + + + The checkbox has an invalid value. + La case à cocher a une valeur non valide. + + + Please enter a valid email address. + Veuillez saisir une adresse email valide. + + + Please select a valid option. + Veuillez sélectionner une option valide. + + + Please select a valid range. + Veuillez sélectionner une plage valide. + + + Please enter a valid week. + Veuillez entrer une semaine valide. + + + There is already an account with this email + Il existe déjà un compte avec cet email + + + You should agree to our terms. + Vous devez accepter nos conditions + + + Please enter a password + Veuillez entrer un mot de passe + + + Your password should be at least {{ limit }} characters + Votre mot de passe doit comporter au moins {{ limite }} caractères + + +
+
-- 2.43.0 From bc6951d0a59575931563e99b7fbb0a5b7e582431 Mon Sep 17 00:00:00 2001 From: clfreville2 Date: Thu, 13 Jun 2024 09:12:03 +0200 Subject: [PATCH 05/12] Remove hardcoded values --- templates/post/index.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/post/index.html.twig b/templates/post/index.html.twig index 5ea65a2..d14adbc 100644 --- a/templates/post/index.html.twig +++ b/templates/post/index.html.twig @@ -4,16 +4,16 @@ {% block body %} {% for post in posts.iterator %} -
+
-
{{ post.species ? post.species.vernacularName : 'post_undefined'|trans }}
+
{{ post.species ? post.species.vernacularName : 'post_undefined'|trans }}
{{ post.foundDate | date("d/m/Y \\à H \\h") }}

{{ post.latitude }}, {{ post.longitude }}, {{ post.altitude }}m

{{ post.commentary }}

{% endfor %} -- 2.43.0 From 0beb0cd95f6a6d41da53c79303dd160f9ac1d3b4 Mon Sep 17 00:00:00 2001 From: Bastien OLLIER Date: Thu, 13 Jun 2024 09:30:25 +0200 Subject: [PATCH 06/12] Update interface (#17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bastien ollier Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/herbarium/pulls/17 Reviewed-by: Clément FRÉVILLE Co-authored-by: Bastien OLLIER Co-committed-by: Bastien OLLIER --- src/Controller/PostController.php | 17 +++++++--------- src/Controller/SpeciesController.php | 2 +- templates/base.html.twig | 23 +++++++++++++++++++++- templates/post/edit.html.twig | 2 +- templates/post/new.html.twig | 2 +- templates/post/show.html.twig | 4 ++-- templates/post/table.html.twig | 2 +- templates/species/_form.html.twig | 2 +- templates/species/edit.html.twig | 2 +- templates/species/new.html.twig | 2 +- templates/species/show.html.twig | 4 ++-- tests/Controller/PostControllerTest.php | 6 +++--- tests/Controller/SpeciesControllerTest.php | 2 +- translations/messages.fr.xlf | 2 +- 14 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index af3d395..7f4e77f 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -34,16 +34,13 @@ class PostController extends AbstractController ]); } - #[Route('/post', name: 'app_post_index', methods: ['GET'])] + #[Route('/posts', name: 'app_post_index', methods: ['GET'])] public function table(PostRepository $repository): Response { - $posts = $repository->findAll(); - return $this->render('post/table.html.twig', [ - 'posts' => $posts, - ]); + return $this->redirectToRoute('app_posts', [], Response::HTTP_SEE_OTHER); } - #[Route('/post/new', name: 'app_post_new', methods: ['GET', 'POST'])] + #[Route('/posts/new', name: 'app_post_new', methods: ['GET', 'POST'])] #[IsGranted('ROLE_USER')] public function new(Request $request, EntityManagerInterface $entityManager): Response { @@ -64,7 +61,7 @@ class PostController extends AbstractController ]); } - #[Route('/post/{id}', name: 'app_post_show', methods: ['GET'])] + #[Route('/posts/{id}', name: 'app_post_show', methods: ['GET'])] public function show(Post $post): Response { $form = $this->createForm(CommentType::class, new Comment(), [ @@ -76,7 +73,7 @@ class PostController extends AbstractController ]); } - #[Route('/post/{id}/edit', name: 'app_post_edit', methods: ['GET', 'POST'])] + #[Route('/posts/{id}/edit', name: 'app_post_edit', methods: ['GET', 'POST'])] #[IsGranted('ROLE_USER')] public function edit(Request $request, Post $post, EntityManagerInterface $entityManager): Response { @@ -95,7 +92,7 @@ class PostController extends AbstractController ]); } - #[Route('/post/{id}', name: 'app_post_delete', methods: ['POST'])] + #[Route('/posts/{id}', name: 'app_post_delete', methods: ['POST'])] #[IsGranted('ROLE_USER')] public function delete(Request $request, Post $post, EntityManagerInterface $entityManager): Response { @@ -107,7 +104,7 @@ class PostController extends AbstractController return $this->redirectToRoute('app_posts', [], Response::HTTP_SEE_OTHER); } - #[Route('/post/{id}/comment', name: 'app_post_comment', methods: ['POST'])] + #[Route('/posts/{id}/comment', name: 'app_post_comment', methods: ['POST'])] public function publishComment(Request $request, Post $post, EntityManagerInterface $entityManager, #[CurrentUser] User $user): Response { $comment = new Comment(); diff --git a/src/Controller/SpeciesController.php b/src/Controller/SpeciesController.php index a495a0f..4af751c 100644 --- a/src/Controller/SpeciesController.php +++ b/src/Controller/SpeciesController.php @@ -18,7 +18,7 @@ class SpeciesController extends AbstractController #[Route('/', name: 'app_species_index', methods: ['GET'])] public function table(SpeciesRepository $speciesRepository): Response { - return $this->render('species/table.html.twig', [ + return $this->render('species/index.html.twig', [ 'species' => $speciesRepository->findAll(), ]); } diff --git a/templates/base.html.twig b/templates/base.html.twig index 4f29e24..0ced7a9 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -15,7 +15,28 @@
{% endfor %} {% include '_pagination.html.twig' %} {% endblock %} + +{% block javascripts %} + {{ parent() }} + +{% endblock %} -- 2.43.0 From ba82630d8a42760c437c3d26024bcdc8479a0ea3 Mon Sep 17 00:00:00 2001 From: clfreville2 Date: Fri, 14 Jun 2024 09:42:09 +0200 Subject: [PATCH 09/12] Disable service implementation --- config/services.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index f07d469..8919b4f 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -30,7 +30,3 @@ services: # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones - -when@prod: - services: - App\Service\ImageSafetyServiceInterface: '@App\Service\SightEngineImageSafetyService' -- 2.43.0 From 4f19bac7078530d5535c0b1b66d714c3eba78be0 Mon Sep 17 00:00:00 2001 From: clfreville2 Date: Fri, 14 Jun 2024 12:18:58 +0200 Subject: [PATCH 10/12] Fix upload base URL behind a subdirectory --- templates/post/show.html.twig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/post/show.html.twig b/templates/post/show.html.twig index e990e12..c79e591 100644 --- a/templates/post/show.html.twig +++ b/templates/post/show.html.twig @@ -34,7 +34,8 @@ {% if post.image %} Image - + {# Vich doesn't prefix the path, as asset() would. #} + {% endif %} -- 2.43.0 From 71ddec420c7226323fc0879a4d0ffe5212eb4eff Mon Sep 17 00:00:00 2001 From: clfreville2 Date: Fri, 14 Jun 2024 12:51:03 +0200 Subject: [PATCH 11/12] Tweak style --- public/css/app.css | 12 ++++++++++++ templates/_pagination.html.twig | 2 +- templates/base.html.twig | 6 +++--- templates/post/index.html.twig | 12 +++++++++++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/public/css/app.css b/public/css/app.css index 5da752c..c62a3cc 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -10,3 +10,15 @@ .no-style:focus { outline: none; } + +.grid-4 { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 1rem; +} + +@media (max-width: 992px) { + .grid-4 { + grid-template-columns: 1fr; + } +} diff --git a/templates/_pagination.html.twig b/templates/_pagination.html.twig index 9c9fdae..c3f6baa 100644 --- a/templates/_pagination.html.twig +++ b/templates/_pagination.html.twig @@ -1,6 +1,6 @@ {% set route = app.request.attributes.get('_route') %}
-