From e390c891d8c35309c21c02b8368c48e068b6e997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Nov 2013 12:50:18 +0100 Subject: [PATCH] mise en forme formulaire et lien edition-view --- Form/PersonType.php | 6 ++-- Resources/assets/css/sass/person.scss | 19 ++++++++++++ Resources/public/css/person.css | 4 +++ Resources/translations/messages.fr.yml | 6 ++++ Resources/views/Form/form_control.html.twig | 9 ++++++ Resources/views/Form/go_to_form.html.twig | 6 ++++ Resources/views/Person/edit.html.twig | 15 ++++++++-- Resources/views/Person/view.html.twig | 32 +++++++++++++++++++++ 8 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 Resources/views/Form/form_control.html.twig create mode 100644 Resources/views/Form/go_to_form.html.twig diff --git a/Form/PersonType.php b/Form/PersonType.php index 9b655022c..a03d9c25c 100644 --- a/Form/PersonType.php +++ b/Form/PersonType.php @@ -31,9 +31,9 @@ class PersonType extends AbstractType ->add('nbOfChild', 'integer', array('required' => false)) ->add('belgian_national_number', new BelgianNationalNumberType(), array('required' => false)) - ->add('memo', 'text', array('required' => false)) - ->add('address', 'text', array('required' => false)) - ->add('email', 'text', array('required' => false)) + ->add('memo', 'textarea', array('required' => false)) + ->add('address', 'textarea', array('required' => false)) + ->add('email', 'textarea', array('required' => false)) ->add('countryOfBirth', 'entity', array( 'required' => false, 'class' => 'CL\Chill\MainBundle\Entity\Country' diff --git a/Resources/assets/css/sass/person.scss b/Resources/assets/css/sass/person.scss index 7f301c95e..fbec51b25 100644 --- a/Resources/assets/css/sass/person.scss +++ b/Resources/assets/css/sass/person.scss @@ -35,6 +35,25 @@ div#person_wrapper { margin: 0 0 0 199px; padding: 0 0 0.5em 0; } + + label { + color: green; + } + + label:not(.radio) { + min-width: 190px; + font-weight: bold; + } + + label.radio{ + margin-left: 0.2em; + } + + div.form_control { + .controls { + float: right; + } + } } } diff --git a/Resources/public/css/person.css b/Resources/public/css/person.css index 930ea6bad..23793ac50 100644 --- a/Resources/public/css/person.css +++ b/Resources/public/css/person.css @@ -4,3 +4,7 @@ div#person_wrapper div#person_details dl { padding: 0.5em; } div#person_wrapper div#person_details dt { float: left; clear: left; width: 190px; text-align: right; font-weight: bold; color: green; } div#person_wrapper div#person_details dt:after { content: " :"; } div#person_wrapper div#person_details dd { margin: 0 0 0 199px; padding: 0 0 0.5em 0; } +div#person_wrapper div#person_details label { color: green; } +div#person_wrapper div#person_details label:not(.radio) { min-width: 190px; font-weight: bold; } +div#person_wrapper div#person_details label.radio { margin-left: 0.2em; } +div#person_wrapper div#person_details div.form_control .controls { float: right; } diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 9b04e6cbc..2ed63761a 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -31,6 +31,8 @@ views: layout: born: '{0} Né le %date% | {1} Née le %date%' without_nationality: Nationalité inconnue + common: + edit: Modifier Person: view: general: Généralités @@ -54,6 +56,10 @@ views: name: Nom gender: Genre memo: Mémo + edit: + cancel: Retour + reset: Remise à zéro + submit: Envoi list: without_nationality: Nationalité inconnue diff --git a/Resources/views/Form/form_control.html.twig b/Resources/views/Form/form_control.html.twig new file mode 100644 index 000000000..b127179be --- /dev/null +++ b/Resources/views/Form/form_control.html.twig @@ -0,0 +1,9 @@ +
+ + +
+
+
+
+ +
diff --git a/Resources/views/Form/go_to_form.html.twig b/Resources/views/Form/go_to_form.html.twig new file mode 100644 index 000000000..61d1b871a --- /dev/null +++ b/Resources/views/Form/go_to_form.html.twig @@ -0,0 +1,6 @@ +
+ + +
diff --git a/Resources/views/Person/edit.html.twig b/Resources/views/Person/edit.html.twig index edcd17794..614e3cfb3 100644 --- a/Resources/views/Person/edit.html.twig +++ b/Resources/views/Person/edit.html.twig @@ -9,8 +9,10 @@ {% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %} {{ form_start(form) }} - - +{% set include_temp = 'CLChillPersonBundle:Form:form_control.html.twig' %} +{% set include_args = {'return_key': 'chill_person_view', + 'return_args' : { 'id' : person.id} } %} +{{ include(include_temp, include_args) }}

{{ 'views.Person.view.general'|trans }}

@@ -19,6 +21,8 @@ {{ form_row(form.genre, {'label' : 'views.Person.view.gender'}) }}
+{{ include(include_temp, include_args) }} +

{{ 'views.Person.view.birth'|trans }}

{{ form_row(form.dateOfBirth, {'label': 'views.Person.view.dateOfBirth'} ) }} @@ -26,6 +30,8 @@ {{ form_row(form.countryOfBirth, { 'label' : 'views.Person.view.contry_of_birth' } ) }}
+{{ include(include_temp, include_args) }} +

{{ 'views.Person.view.family'|trans }}

{{ form_row(form.civil_union, {'label' : 'views.Person.view.civil_union'}) }} @@ -33,12 +39,16 @@
+{{ include(include_temp, include_args) }} +

{{ 'views.Person.view.administrative'|trans }}

{{ form_row(form.nationality, { 'label' : 'views.Person.view.nationality'|trans} ) }} {{ form_row(form.belgian_national_number, { 'label' : 'views.Person.view.national_number'}) }}
+{{ include(include_temp, include_args) }} +

{{ 'views.Person.view.contact'|trans }}

{{ form_row(form.address, {'label' : 'views.Person.view.address'}) }} @@ -48,6 +58,7 @@ {{ form_row(form.memo, {'label' : 'views.Person.view.memo'} ) }} +{{ include(include_temp, include_args) }} {{ form_rest(form) }} {{ form_end(form) }} diff --git a/Resources/views/Person/view.html.twig b/Resources/views/Person/view.html.twig index 6264628df..a45823e85 100644 --- a/Resources/views/Person/view.html.twig +++ b/Resources/views/Person/view.html.twig @@ -12,8 +12,34 @@ This view should receive those arguments: {% block title %}CLChillPersonBundle:Person:see{% endblock %} +{% set edit_tmp_name = 'CLChillPersonBundle:Form:go_to_form.html.twig' %} +{% set edit_tmp_args = { 'form_path_args' : { 'id': person.id }, + 'form_path_key' : 'chill_person_general_edit' } %} + + {% block personcontent %} + +{{ include(edit_tmp_name, edit_tmp_args) }} + +
+

{{ 'views.Person.view.general'|trans }}

+ +
+
{{ 'views.Person.view.surname'|trans }}
+
{{ person.surname }}
+ +
{{ 'views.Person.view.name'|trans }}
+
{{ person.surname }}
+ +
{{ 'views.Person.view.gender'|trans }}
+
{{ ( 'person.gender.' ~ person.genre|default('undefined'))|trans }}
+ +
+ + +
+

{{ 'views.Person.view.birth'|trans }}

@@ -38,6 +64,8 @@ This view should receive those arguments:
+{{ include(edit_tmp_name, edit_tmp_args) }} +

{{ 'views.Person.view.family'|trans }}

@@ -52,6 +80,8 @@ This view should receive those arguments:
+{{ include(edit_tmp_name, edit_tmp_args) }} +

{{ 'views.Person.view.administrative'|trans }}

@@ -74,6 +104,8 @@ This view should receive those arguments:
+{{ include(edit_tmp_name, edit_tmp_args) }} +

{{ 'views.Person.view.contact'|trans }}