diff --git a/public/styles/colors.css b/public/styles/colors.css index 15e0bc4..0110143 100644 --- a/public/styles/colors.css +++ b/public/styles/colors.css @@ -7,9 +7,12 @@ --secondary-dark: #c59687; --light: #f8f5ec; --dark: #131007; - --green: #19b340; - --green-light: #79ec96; - --green-dark: #0a4318; + --green: #428a54; + --green-light: #87c596; + --green-dark: #193420; + --red: #8a4242; + --red-light: #c58787; + --red-dark: #341919; } .color-green { @@ -22,4 +25,16 @@ .color-green-dark { color: var(--green-dark); +} + +.color-red { + color: var(--red); +} + +.color-red-light { + color: var(--red-light); +} + +.color-red-dark { + color: var(--red-dark); } \ No newline at end of file diff --git a/public/styles/form.css b/public/styles/form.css index f9f80d8..aabfcaf 100644 --- a/public/styles/form.css +++ b/public/styles/form.css @@ -34,6 +34,13 @@ border-color: var(--secondary-dark); } +input[type=text][class*=input-invalid], +textarea[class*=input-invalid] { + border-color: var(--red); + border-width: 0 0 0 0.2em; + background-color: var(--red-light); +} + button { color: black; background-color: var(--light); @@ -77,4 +84,11 @@ color: black; font-weight: bold; font-size: 0.75em; +} + +label[class*=required]::after { + display: inline-block; + margin-left: 0.2em; + content: "*"; + color: var(--red) } \ No newline at end of file diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php index dc90897..3626066 100644 --- a/src/Controller/SettingsController.php +++ b/src/Controller/SettingsController.php @@ -2,6 +2,7 @@ namespace App\Controller; use Symfony\Component\HttpFoundation\Response; +use App\Form\ActorAddForm; class SettingsController extends AbstractExtendedController { @@ -11,8 +12,12 @@ * @return Response */ public function actors(): Response - { + { + // Actor add form + $actorAddFom = $this->createNamedCustomForm("actorAdd", ActorAddForm::class); + return $this->render("actors.html.twig", [ + "actorAddForm" => $actorAddFom, ]); } } diff --git a/src/Form/ActorAddForm.php b/src/Form/ActorAddForm.php new file mode 100644 index 0000000..f887505 --- /dev/null +++ b/src/Form/ActorAddForm.php @@ -0,0 +1,30 @@ +add('firstName', TextType::class, [ + 'required' => true + ])->add('lastName', TextType::class, [ + 'required' => true + ])->add('nickname', TextType::class, [ + 'required' => false + ])->add('submit', SubmitType::class); + } +} \ No newline at end of file diff --git a/src/Form/WorkspaceAddForm.php b/src/Form/WorkspaceAddForm.php deleted file mode 100644 index 685277d..0000000 --- a/src/Form/WorkspaceAddForm.php +++ /dev/null @@ -1,30 +0,0 @@ -add('name', TextType::class, [ - 'required' => true - ])->add('submit', SubmitType::class); - } -} \ No newline at end of file diff --git a/templates/_includes/html/form/actorAdd.html.twig b/templates/_includes/html/form/actorAdd.html.twig new file mode 100644 index 0000000..f37843c --- /dev/null +++ b/templates/_includes/html/form/actorAdd.html.twig @@ -0,0 +1,17 @@ +{{ form_start(form, {'attr': {'class': 'ajax-form'}}) }} +
+ {{ form_label(form.firstName, 'Prénom', {'label_attr': {'class': 'input-text-label'}}) }} + {{ form_widget(form.firstName, {'attr': {'class': 'w-100'}}) }} +
+
+ {{ form_label(form.lastName, 'Nom', {'label_attr': {'class': 'input-text-label'}}) }} + {{ form_widget(form.lastName, {'attr': {'class': 'w-100'}}) }} +
+
+ {{ form_label(form.nickname, 'Surnom', {'label_attr': {'class': 'input-text-label'}}) }} + {{ form_widget(form.nickname, {'attr': {'class': 'w-100'}}) }} +
+{{ form_widget(form.submit, {'attr': {'class': 'w-100'}, 'label': 'Nouvel acteur'}) }} +

+

+{{ form_end(form) }} \ No newline at end of file diff --git a/templates/_includes/html/form/workspaceAdd.html.twig b/templates/_includes/html/form/workspaceAdd.html.twig deleted file mode 100644 index c133e16..0000000 --- a/templates/_includes/html/form/workspaceAdd.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{{ form_start(form, {'attr': {'class': 'ajax-form'}}) }} -
- {{ form_label(form.name, 'Nom', {'label_attr': {'class': 'input-text-label'}}) }} - {{ form_widget(form.name, {'attr': {'class': 'w-100'}}) }} -
-{{ form_widget(form.submit, {'attr': {'class': 'w-100'}, 'label': 'Nouveau workspace'}) }} -

-

-{{ form_end(form) }} \ No newline at end of file diff --git a/templates/actors.html.twig b/templates/actors.html.twig index b17996f..0069c88 100644 --- a/templates/actors.html.twig +++ b/templates/actors.html.twig @@ -32,6 +32,7 @@

Ajouter un acteur

+ {% include '_includes/html/genericForm.html.twig' with {'form': actorAddForm} only %}