mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
upgrade views, menus, routing
This commit is contained in:
parent
9d313dd68f
commit
2a3ebb3659
@ -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);
|
||||
|
@ -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')));
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
menus:
|
||||
admin:
|
||||
order: 100
|
||||
label: menu.person.admin.index
|
||||
helper: menu.person.admin.helper
|
@ -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) }}
|
||||
|
||||
<figure>
|
||||
<h2>{{ 'views.Person.view.family'|trans }}</h2>
|
||||
|
||||
<dl>
|
||||
<dt class="inline">{{ 'views.Person.view.civil_union'|trans }}</dt>
|
||||
<dd>{{ ('person.civil_union.' ~ person.civilUnion)|trans }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'views.Person.view.nb_of_childs'|trans }}</dt>
|
||||
<dd>{% transchoice person.nbOfChild with { '%nb%': person.nbOfChild } %}views.Person.view.nb_of_childs_count{% endtranschoice %}</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
</figure>
|
||||
|
||||
{{ include(edit_tmp_name, edit_tmp_args) }}
|
||||
|
||||
<figure>
|
||||
<h2>{{ 'views.Person.view.administrative'|trans }}</h2>
|
||||
|
||||
@ -97,11 +84,6 @@ This view should receive those arguments:
|
||||
|
||||
</dd>
|
||||
|
||||
<dt class="inline">{{ 'views.Person.view.national_number'|trans }}</dt>
|
||||
<dd>{{ person.belgianNationalNumber }}</dd>
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
</figure>
|
||||
|
||||
@ -111,8 +93,6 @@ This view should receive those arguments:
|
||||
<h2>{{ 'views.Person.view.contact'|trans }}</h2>
|
||||
|
||||
<dl>
|
||||
<dt class="inline">{{ 'views.Person.view.address'|trans }}</dt>
|
||||
<dd><pre>{{ person.address}} </pre></dd>
|
||||
|
||||
<dt class="inline">{{ 'views.Person.view.email'|trans }}</dt>
|
||||
<dd><pre>{{ person.email}} </pre></dd>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "CLChillMainBundle::layout.html.twig" %}
|
||||
{% extends "ChillMainBundle::layout.html.twig" %}
|
||||
|
||||
{% block css %}
|
||||
|
||||
@ -45,12 +45,11 @@
|
||||
|
||||
<section class="tabs vertical">
|
||||
{# 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
|
||||
})) }}
|
||||
}) }}
|
||||
|
||||
<div class="tab-content active columns height">
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<div class="columns four">
|
||||
<ul class="tab-nav follow-href-path">
|
||||
{% for menu in menu_composer.getRoutesFor(menu) %}
|
||||
{% for route in routes %}
|
||||
<li class="{% spaceless %}
|
||||
{% if menu.route == activeRouteKey %}
|
||||
{% if route.key == activeRouteKey %}
|
||||
active
|
||||
{% endif %}
|
||||
{% endspaceless %} ">
|
||||
<a href="{{ path(menu.route, args) }}" >{{ menu.label|trans }}</a>
|
||||
<a href="{{ path(route.key, args ) }}" >{{ route.label|trans }}</a>
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user