diff --git a/migrations/Version20220813133942.php b/migrations/Version20220813133942.php new file mode 100644 index 0000000..ed102e4 --- /dev/null +++ b/migrations/Version20220813133942.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE directory ADD wanted_display TINYINT(1) DEFAULT \'1\' NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE directory DROP wanted_display'); + } +} diff --git a/public/robot.txt b/public/robots.txt similarity index 100% rename from public/robot.txt rename to public/robots.txt diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 59ec1b8..494ea68 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -29,7 +29,7 @@ class HomeController extends AbstractController ->order(['createdAt' => 'DESC']) ->getResult(), 'wanted' => - $DirectoryRepository->list()->notDead()->wanted()->getResult(), + $DirectoryRepository->list()->notDead()->wanted()->wantedDisplay()->getResult(), 'controller_name' => 'HomeController', ]); } diff --git a/src/Entity/Directory.php b/src/Entity/Directory.php index 654ccbb..b712fc2 100644 --- a/src/Entity/Directory.php +++ b/src/Entity/Directory.php @@ -415,6 +415,11 @@ class Directory */ private $wantedReason; + /** + * @ORM\Column(type="boolean", options={"default":"1"}) + */ + private $wantedDisplay = true; + /** * @ORM\OneToMany(targetEntity=Infringement::class, mappedBy="directory", orphanRemoval=true) * @ORM\OrderBy({"createdAt" = "DESC"}) @@ -1335,6 +1340,18 @@ class Directory return $this; } + public function getWantedDisplay(): ?bool + { + return $this->wantedDisplay; + } + + public function setWantedDisplay(bool $wantedDisplay): self + { + $this->wantedDisplay = $wantedDisplay; + + return $this; + } + /** * @return Collection|Infringement[] */ diff --git a/src/Form/DirectoryType.php b/src/Form/DirectoryType.php index 47bb452..b098dde 100644 --- a/src/Form/DirectoryType.php +++ b/src/Form/DirectoryType.php @@ -67,6 +67,7 @@ class DirectoryType extends AbstractType ->add('gangInfo', null, ['label' => 'form_label_gang_info']) ->add('wanted', null, ['label' => 'form_label_wanted']) ->add('wantedReason', null, ['label' => 'form_label_wantedReason', 'help' => 'form_help_wantedReason']) + ->add('wantedDisplay', null, ['label' => 'form_label_wantedDisplay']) ; } diff --git a/src/Repository/DirectoryRepository.php b/src/Repository/DirectoryRepository.php index dc74587..278a697 100644 --- a/src/Repository/DirectoryRepository.php +++ b/src/Repository/DirectoryRepository.php @@ -77,6 +77,18 @@ class DirectoryRepository extends ServiceEntityRepository return $this; } + public function wantedDisplay() + { + $this->qb->andWhere('d.wantedDisplay = 1'); + return $this; + } + + public function wantedNotDisplay() + { + $this->qb->andWhere('d.wantedDisplay = 0'); + return $this; + } + public function order(array $order) { foreach ($order as $key => $value) { diff --git a/templates/base.html.twig b/templates/base.html.twig index 581e618..ff1329e 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -2,8 +2,7 @@ - - + Vision - {% block title %}{% trans %}page_title{% endtrans %}{% endblock %} @@ -13,6 +12,21 @@ + + + + + + + + + + + + + + + diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index a258fad..0b2a17f 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -11,7 +11,7 @@
- +

{% trans %}title_login{% endtrans %}

{% if error %}
{{ error.messageKey | trans }}
diff --git a/templates/security/register.html.twig b/templates/security/register.html.twig index 2bd51fc..aa62c94 100644 --- a/templates/security/register.html.twig +++ b/templates/security/register.html.twig @@ -10,7 +10,7 @@
- +

{% trans %}title_register{% endtrans %}

{{ form(form) }}

{% trans %}already_have_account{% endtrans %} ? {% trans %}button_login{% endtrans %}

diff --git a/translations/messages+intl-icu.en.yaml b/translations/messages+intl-icu.en.yaml index 7c95218..9199269 100644 --- a/translations/messages+intl-icu.en.yaml +++ b/translations/messages+intl-icu.en.yaml @@ -353,6 +353,7 @@ form_label_upload_trucklicence: Heavy Truck License form_label_vehicle_type: Vehicle type form_label_versus: Versus form_label_wanted: This person is wanted +form_label_wantedDisplay: Display wanted card on homepage form_label_wantedReason: Reason for searching for this person form_placeholder_email: Email form_placeholder_firstname: First name diff --git a/translations/messages+intl-icu.fr.yaml b/translations/messages+intl-icu.fr.yaml index b6a92ff..7f2c396 100644 --- a/translations/messages+intl-icu.fr.yaml +++ b/translations/messages+intl-icu.fr.yaml @@ -353,6 +353,7 @@ form_label_upload_trucklicence: Permis Poids Lourd form_label_vehicle_type: Type de véhicule form_label_versus: Contre form_label_wanted: Cette personne est recherchée +form_label_wantedDisplay: Afficher la recherche sur l'accueil form_label_wantedReason: Raison de la recherche de cette personne form_placeholder_email: Email form_placeholder_firstname: Prénom diff --git a/visionversion.json b/visionversion.json index 1b1bbae..c65ea8d 100644 --- a/visionversion.json +++ b/visionversion.json @@ -1,3 +1,3 @@ { - "version": "0.2.5" + "version": "0.2.6" }