mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
adding crud to manage marital statuses in admin area (CRUDController way, minimal study case)
This commit is contained in:
parent
1839d829bc
commit
5c9e88784f
15
Controller/AdminMaritalStatusController.php
Normal file
15
Controller/AdminMaritalStatusController.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
|
||||
/**
|
||||
* Class AdminMaritalStatusController
|
||||
*
|
||||
* @package Chill\PersonBundle\Controller
|
||||
*/
|
||||
class AdminMaritalStatusController extends CRUDController
|
||||
{
|
||||
// for minimal cases, nothing is required here !
|
||||
}
|
@ -282,6 +282,27 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
'template' => '@ChillPerson/ClosingMotive/edit.html.twig',
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'class' => \Chill\PersonBundle\Entity\MaritalStatus::class,
|
||||
'name' => 'marital_status',
|
||||
'base_path' => '/admin/marital-status',
|
||||
'form_class' => \Chill\PersonBundle\Form\MaritalStatusType::class,
|
||||
'controller' => \Chill\PersonBundle\Controller\AdminMaritalStatusController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/MaritalStatus/index.html.twig',
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/MaritalStatus/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/MaritalStatus/edit.html.twig',
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
45
Form/MaritalStatusType.php
Normal file
45
Form/MaritalStatusType.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Chill\PersonBundle\Entity\MaritalStatus;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* Class MaritalStatusType
|
||||
*
|
||||
* @package Chill\PersonBundle\Form
|
||||
*/
|
||||
class MaritalStatusType extends AbstractType
|
||||
{
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('id', TextType::class, [
|
||||
'label' => 'Identifiant'
|
||||
])
|
||||
->add('name', TranslatableStringFormType::class, [
|
||||
'label' => 'Nom'
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolver $resolver
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('class', MaritalStatus::class)
|
||||
;
|
||||
}
|
||||
}
|
@ -38,6 +38,15 @@
|
||||
|
||||
<p>{{ 'person_admin.closing motive explanation'|trans }}</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<a href="{{ path('chill_crud_marital_status_index') }}">
|
||||
<strong>{{ 'person_admin.marital status list'|trans }}</strong>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p>{{ 'person_admin.marital status explanation'|trans }}</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
12
Resources/views/MaritalStatus/edit.html.twig
Normal file
12
Resources/views/MaritalStatus/edit.html.twig
Normal file
@ -0,0 +1,12 @@
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
{% block content_form_actions_view %}{% endblock %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
27
Resources/views/MaritalStatus/index.html.twig
Normal file
27
Resources/views/MaritalStatus/index.html.twig
Normal file
@ -0,0 +1,27 @@
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
||||
{% block table_entities_thead_tr %}
|
||||
<th>{{ 'Id'|trans }}</th>
|
||||
<th>{{ 'Name'|trans }}</th>
|
||||
<th> </th>
|
||||
{% endblock %}
|
||||
|
||||
{% block table_entities_tbody %}
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td>{{ entity.id }}</td>
|
||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_marital_status_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
11
Resources/views/MaritalStatus/new.html.twig
Normal file
11
Resources/views/MaritalStatus/new.html.twig
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
@ -229,7 +229,12 @@ crud:
|
||||
add_new: Ajouter un nouveau
|
||||
title_new: Nouveau motif de clotûre
|
||||
title_edit: Modifier le motif de clotûre
|
||||
|
||||
marital_status:
|
||||
index:
|
||||
title: Liste des états civils
|
||||
add_new: Ajouter un nouveau
|
||||
title_new: Nouvel état civil
|
||||
title_edit: Modifier l'état civil
|
||||
|
||||
# specific to closing motive
|
||||
closing_motive:
|
||||
@ -243,9 +248,11 @@ person_admin:
|
||||
closing motive explanation: >
|
||||
Les motifs de clotûre donnent des indications sur la fermeture
|
||||
d'une période d'accompagnement.
|
||||
marital status list: Liste des états civils
|
||||
marital status explanation: >
|
||||
Configurer la liste des états civils.
|
||||
|
||||
accompanying_period:
|
||||
dates: Période
|
||||
dates_from_%opening_date%: Ouvert depuis le %opening_date%
|
||||
dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date%
|
||||
|
Loading…
x
Reference in New Issue
Block a user