override relevant part of the main CRUD template

Add a person_id to every button in person crud templates
This commit is contained in:
Julien Fastré 2020-06-18 16:40:22 +02:00
parent e703419513
commit 4c2ec6761a
6 changed files with 90 additions and 3 deletions

View File

@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/_index.html.twig' %}
{% block list_actions %}
<ul class="record_actions sticky-form-buttons">
{% block add_new %}
<li>
<a href="{{ chill_path_add_return_path('chill_crud_' ~ crud_name ~ '_new', { 'person_id': person.id }) }}" class="sc-button bt-new">{{ ('crud.'~crud_name~'.index.add_new')|trans( {'%crud_name%': crud_name} ) }}</a>
</li>
{% endblock %}
</ul>
{% endblock list_actions %}

View File

@ -0,0 +1,30 @@
{% extends '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_back %}
<li class="cancel">
<a class="sc-button bt-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index', { 'person_id': person.id }) }}">
{{ 'Cancel'|trans }}
</a>
</li>
{% endblock %}
{% block content_form_actions_save_and_close %}
<li class="">
<button type="submit" name="submit" value="save-and-close" class="sc-button bt-create">
{{ 'crud.new.save_and_close'|trans }}
</button>
</li>
{% endblock %}
{% block content_form_actions_save_and_show %}
<li class="">
<button type="submit" name="submit" value="save-and-show" class="sc-button bt-create">
{{ 'crud.new.save_and_show'|trans }}
</button>
</li>
{% endblock %}
{% block content_form_actions_save_and_new %}
<li class="">
<button type="submit" name="submit" value="save-and-new" class="sc-button bt-create">
{{ 'crud.new.save_and_new'|trans }}
</button>
</li>
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends '@ChillMain/CRUD/_view_content.html.twig' %}
{% block content_view_actions_back %}
<li class="cancel">
<a class="sc-button bt-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index', { 'person_id': person.id }) }}">
{{ 'Cancel'|trans }}
</a>
</li>
{% endblock %}
{% block content_form_actions_delete %}
{% if chill_crud_action_exists(crud_name, 'delete') %}
{% if is_granted(chill_crud_config('role', crud_name, 'delete'), entity) %}
<li class="">
<a class="sc-button bt-delete" href="{{ chill_path_add_return_path('chill_crud_'~crud_name~'_delete', { 'id': entity.id, 'person_id': person.id }) }}">
{{ 'crud.delete.link_to_form'|trans }}
</a>
</li>
{% endif %}
{% endif %}
{% endblock content_form_actions_delete %}
{% block content_view_actions_duplicate_link %}
{% if chill_crud_action_exists(crud_name, 'new') %}
{% if is_granted(chill_crud_config('role', crud_name, 'new'), entity) %}
<li>
<a class="sc-button bt-duplicate" href="{{ chill_path_add_return_path('chill_crud_'~crud_name~'_new', { 'duplicate_id': entity.id, 'duplicate': true, 'person_id': person.id }) }}">
{{ 'crud.view.link_duplicate'|trans }}
</a>
</li>
{% endif %}
{% endif %}
{% endblock content_view_actions_duplicate_link %}
{% block content_view_actions_edit_link %}
{% if chill_crud_action_exists(crud_name, 'edit') %}
{% if is_granted(chill_crud_config('role', crud_name, 'edit'), entity) %}
<li>
<a class="sc-button bt-edit" href="{{ chill_path_forward_return_path('chill_crud_'~crud_name~'_edit', { 'id': entity.id, 'person_id': person.id }) }}">
{{ 'crud.new.link_edit'|trans }}
</a>
</li>
{% endif %}
{% endif %}
{% endblock content_view_actions_edit_link %}

View File

@ -5,7 +5,7 @@
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block personcontent %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% embed '@ChillPerson/CRUD/_index.html.twig' %}
{% block add_new %}
<li>
<a href="{{ chill_path_add_return_path('chill_crud_' ~ crud_name ~ '_new', { 'person_id': person.id } ) }}" class="sc-button bt-new">{{ ('crud.'~crud_name~'.index.add_new')|trans( {'%crud_name%': crud_name} ) }}</a>

View File

@ -8,7 +8,7 @@
{% endblock %}
{% block personcontent %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% embed '@ChillPerson/CRUD/_new_content.html.twig' %}
{% block crud_content_header %}
<h1>{{ ('crud.'~crud_name~'.title_new')|trans({'%person%': person|chill_entity_render_string }) }}</h1>
{% endblock crud_content_header %}

View File

@ -8,7 +8,7 @@
{% endblock %}
{% block personcontent %}
{% embed '@ChillMain/CRUD/_view_content.html.twig' %}
{% embed '@ChillPerson/CRUD/_view_content.html.twig' %}
{% block crud_content_header %}
<h1>{{ ('crud.' ~ crud_name ~ '.title_view')|trans({'%person%': person|chill_entity_render_string }) }}</h1>
{% endblock crud_content_header %}