mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 00:53:48 +00:00
Initialize a CRUD for entities
This commit is contained in:
4
Resources/config/crud/country.yml
Normal file
4
Resources/config/crud/country.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
name: 'country'
|
||||
actions: ['index', 'new', 'edit', 'delete']
|
||||
base_path: '/admin/country'
|
||||
controller: 'Chill\MainBundle\CRUD\Controller\CRUDController'
|
15
Resources/config/services/crud.yml
Normal file
15
Resources/config/services/crud.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
services:
|
||||
# Chill\MainBundle\CRUD\Routing\CRUDRoutesLoader:
|
||||
#
|
||||
# tags:
|
||||
# - routing.loader
|
||||
|
||||
Chill\MainBundle\CRUD\Resolver\Resolver:
|
||||
arguments:
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
|
||||
Chill\MainBundle\CRUD\Templating\TwigCRUDResolver:
|
||||
arguments:
|
||||
$resolver: '@Chill\MainBundle\CRUD\Resolver\Resolver'
|
||||
tags:
|
||||
- { name: twig.extension }
|
1
Resources/views/CRUD/_inc/default.html.twig
Normal file
1
Resources/views/CRUD/_inc/default.html.twig
Normal file
@@ -0,0 +1 @@
|
||||
{{ data }}
|
39
Resources/views/CRUD/index.html.twig
Normal file
39
Resources/views/CRUD/index.html.twig
Normal file
@@ -0,0 +1,39 @@
|
||||
{% extends '@ChillMain/layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ title|default('List of %class%')|trans({'%class%': class}) }}</h1>
|
||||
|
||||
{% if entities|length == 0 %}
|
||||
<p>{{ no_existing_entities_sentences|default('No entities')|trans }}</p>
|
||||
{% else %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{% for c in columns %}
|
||||
<th>{{ c|trans }}</th>
|
||||
{% endfor %}
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
{% for c in columns %}
|
||||
<td>{{ entity|chill_crud_display(c) }}</td>
|
||||
{% endfor %}
|
||||
|
||||
<td>
|
||||
<ul class="record-actions">
|
||||
{% for action in actions %}
|
||||
<li>{{ action }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock content %}
|
Reference in New Issue
Block a user