diff --git a/Controller/PersonController.php b/Controller/PersonController.php index 10f0e6ef2..48b763c1c 100644 --- a/Controller/PersonController.php +++ b/Controller/PersonController.php @@ -11,12 +11,12 @@ use Symfony\Component\HttpFoundation\Response; class PersonController extends Controller { - public function viewAction($id){ + public function viewAction($person_id){ - $person = $this->_getPerson($id); + $person = $this->_getPerson($person_id); if ($person === null) { - return $this->createNotFoundException("Person with id $id not found on this server"); + return $this->createNotFoundException("Person with id $person_id not found on this server"); } return $this->render('ChillPersonBundle:Person:view.html.twig', @@ -25,8 +25,8 @@ class PersonController extends Controller { } - public function editAction($id) { - $person = $this->_getPerson($id); + public function editAction($person_id) { + $person = $this->_getPerson($person_id); if ($person === null) { return $this->createNotFoundException(); @@ -34,7 +34,7 @@ class PersonController extends Controller { $form = $this->createForm(new PersonType(), $person, array( 'action' => $this->generateUrl('chill_person_general_update', array( - 'id' => $id + 'person_id' => $person_id )) )); @@ -45,8 +45,8 @@ class PersonController extends Controller { 'form' => $form->createView())); } - public function updateAction($id, Request $request) { - $person = $this->_getPerson($id); + public function updateAction($person_id, Request $request) { + $person = $this->_getPerson($person_id); if ($person === null) { return $this->createNotFoundException(); @@ -79,7 +79,7 @@ class PersonController extends Controller { $em->flush(); $url = $this->generateUrl('chill_person_view', array( - 'id' => $person->getId() + 'person_id' => $person->getId() )); return $this->redirect($url); diff --git a/DependencyInjection/ChillPersonExtension.php b/DependencyInjection/ChillPersonExtension.php index 5d4c0a657..231773bdc 100644 --- a/DependencyInjection/ChillPersonExtension.php +++ b/DependencyInjection/ChillPersonExtension.php @@ -6,13 +6,14 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; /** * This is the class that loads and manages your bundle configuration * * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} */ -class ChillPersonExtension extends Extension +class ChillPersonExtension extends Extension implements PrependExtensionInterface { /** * {@inheritDoc} @@ -28,4 +29,18 @@ class ChillPersonExtension extends Extension $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); } + + public function prepend(ContainerBuilder $container) + { + $bundles = $container->getParameter('kernel.bundles'); + //add ChillMain to assetic-enabled bundles + if (!isset($bundles['AsseticBundle'])) { + throw new MissingBundleException('AsseticBundle'); + } + + $asseticConfig = $container->getExtensionConfig('assetic'); + $asseticConfig['bundles'][] = 'ChillPersonBundle'; + $container->prependExtensionConfig('assetic', + array('bundles' => array('ChillPersonBundle'))); + } } diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index 2707fb00a..cdf07c8c5 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -1,31 +1,32 @@ chill_person_view: - pattern: /view/{id} + pattern: /person/view/{person_id}/general defaults: { _controller: ChillPersonBundle:Person:view } options: - menu: person - order: 50 - label: menu.person.general_view + menus: + person: + order: 50 + label: Person View chill_person_general_edit: - pattern: /view/{id}/edit + pattern: /person/view/{person_id}/edit defaults: {_controller: ChillPersonBundle:Person:edit } chill_person_general_update: - pattern: /view/{id}/update + pattern: /person/view/{person_id}/update defaults: {_controller: ChillPersonBundle:Person:update } chill_person_new: - pattern: /new + pattern: /person/new defaults: {_controller: ChillPersonBundle:Person:new } chill_person_review: - pattern: /review + pattern: /person/review defaults: {_controller: ChillPersonBundle:Person:review } chill_person_create: - pattern: /create + pattern: /person/create defaults: {_controller: ChillPersonBundle:Person:create } @@ -34,102 +35,37 @@ chill_person_search: defaults: { _controller: ChillPersonBundle:Person:search } chill_person_history_list: - pattern: /{id}/history + pattern: /person/{person_id}/history defaults: { _controller: ChillPersonBundle:History:list } options: - menu: person - order: 100 - label: menu.person.history + menus: + person: + order: 100 + label: menu.person.history chill_person_history_create: - pattern: /{personId}/history/create + pattern: /person/{person_id}/history/create defaults: { _controller: ChillPersonBundle:History:create } chill_person_history_update: - pattern: /{id}/history/{historyId}/update + pattern: /person/{person_id}/history/{historyId}/update defaults: { _controller: ChillPersonBundle:History:update } chill_person_history_close: - pattern: /{id}/history/close + pattern: /person/{person_id}/history/close defaults: { _controller: ChillPersonBundle:History:close } chill_person_history_open: - pattern: /{id}/history/open + pattern: /person/{person_id}/history/open defaults: { _controller: ChillPersonBundle:History:open } chill_person_admin: pattern: /admin defaults: { _controller: ChillPersonBundle:Admin:index } - options: - menu: admin - order: 100 - label: menu.person.admin.index - helper: menu.person.admin.helper - -#sample admin_person menu: -chill_person_admin_test_one: - pattern: /admin/test_one - defaults: { _controller: ChillPersonBundle:Admin:test } - options: - menu: admin_person - order: 100 - label: menu.person.admin.test_one - helper: menu.person.admin.helper_one - -#sample -chill_appointment_list: - pattern: /view/{id}/appointment/list - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 200 - label: "Rendez-vous" - -chill_prof_status_view: - pattern: /view/{id}/prof/list - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 300 - label: "Statut Professionnel" - -chill_admin_view: - pattern: /view/{id}/administrative - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 400 - label: "Statut administratif" - -chill_language: - pattern: /view/{id}/language/list - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 500 - label: "Langues" - -chill_studies: - pattern: /view/{id}/studies - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 600 - label: "Études" - -chill_notes: - pattern: /view/{id}/notes - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 700 - label: "Informations" - -chill_docs: - pattern: /view/{id}/docs - defaults: {_controller: ChillPersonBundle:Person:view} - options: - menu: person - order: 800 - label: "Documents" + options: + menus: + admin: + order: 100 + label: menu.person.admin.index + helper: menu.person.admin.helper \ No newline at end of file diff --git a/Resources/views/Person/view.html.twig b/Resources/views/Person/view.html.twig index 36a1e49bb..d6d79631d 100644 --- a/Resources/views/Person/view.html.twig +++ b/Resources/views/Person/view.html.twig @@ -11,9 +11,12 @@ This view should receive those arguments: #} {% block title %}ChillPersonBundle:Person:see{% endblock %} - +{# + we define variables to include an edit form repeated multiple time across + the page +#} {% set edit_tmp_name = 'ChillPersonBundle:Form:go_to_form.html.twig' %} -{% set edit_tmp_args = { 'form_path_args' : { 'id': person.id }, +{% set edit_tmp_args = { 'form_path_args' : { 'person_id': person.id }, 'form_path_key' : 'chill_person_general_edit' } %} @@ -67,22 +70,6 @@ This view should receive those arguments: {{ include(edit_tmp_name, edit_tmp_args) }} -
-

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

- -
-
{{ 'views.Person.view.civil_union'|trans }}
-
{{ ('person.civil_union.' ~ person.civilUnion)|trans }}
- -
{{ 'views.Person.view.nb_of_childs'|trans }}
-
{% transchoice person.nbOfChild with { '%nb%': person.nbOfChild } %}views.Person.view.nb_of_childs_count{% endtranschoice %}
- - -
-
- -{{ include(edit_tmp_name, edit_tmp_args) }} -

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

@@ -95,12 +82,7 @@ This view should receive those arguments: {{ 'views.Person.view.without_nationality'|trans }} {% endif %} - - -
{{ 'views.Person.view.national_number'|trans }}
-
{{ person.belgianNationalNumber }}
- - +
@@ -111,8 +93,6 @@ This view should receive those arguments:

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

-
{{ 'views.Person.view.address'|trans }}
-
{{ person.address}} 
{{ 'views.Person.view.email'|trans }}
{{ person.email}} 
diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index 9c512e466..0563e2541 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -1,4 +1,4 @@ -{% extends "CLChillMainBundle::layout.html.twig" %} +{% extends "ChillMainBundle::layout.html.twig" %} {% block css %} @@ -45,12 +45,11 @@
{# Note: activeRouteKey should be defined in Controller or child layout #} - {{ render(controller("CLChillMainBundle:Menu:writeMenu", { - 'menu' : 'person', + {{ chill_menu('person', { 'layout': 'ChillPersonBundle::menu.html.twig', - 'args' : {'id': person.id }, + 'args' : {'person_id': person.id }, 'activeRouteKey': activeRouteKey - })) }} + }) }}
diff --git a/Resources/views/menu.html.twig b/Resources/views/menu.html.twig index 76f93dc58..f47d98440 100644 --- a/Resources/views/menu.html.twig +++ b/Resources/views/menu.html.twig @@ -1,12 +1,12 @@