From 4c2ec6761a46e9cdd60a66cef879dc59a775bb63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 18 Jun 2020 16:40:22 +0200 Subject: [PATCH] override relevant part of the main CRUD template Add a person_id to every button in person crud templates --- Resources/views/CRUD/_index.html.twig | 11 +++++ Resources/views/CRUD/_new_content.html.twig | 30 +++++++++++++ Resources/views/CRUD/_view_content.html.twig | 46 ++++++++++++++++++++ Resources/views/CRUD/index.html.twig | 2 +- Resources/views/CRUD/new.html.twig | 2 +- Resources/views/CRUD/view.html.twig | 2 +- 6 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 Resources/views/CRUD/_index.html.twig create mode 100644 Resources/views/CRUD/_new_content.html.twig create mode 100644 Resources/views/CRUD/_view_content.html.twig diff --git a/Resources/views/CRUD/_index.html.twig b/Resources/views/CRUD/_index.html.twig new file mode 100644 index 000000000..14e10af4e --- /dev/null +++ b/Resources/views/CRUD/_index.html.twig @@ -0,0 +1,11 @@ +{% extends '@ChillMain/CRUD/_index.html.twig' %} + +{% block list_actions %} + +{% endblock list_actions %} diff --git a/Resources/views/CRUD/_new_content.html.twig b/Resources/views/CRUD/_new_content.html.twig new file mode 100644 index 000000000..83f35fcc7 --- /dev/null +++ b/Resources/views/CRUD/_new_content.html.twig @@ -0,0 +1,30 @@ +{% extends '@ChillMain/CRUD/_new_content.html.twig' %} + +{% block content_form_actions_back %} +
  • + + {{ 'Cancel'|trans }} + +
  • +{% endblock %} +{% block content_form_actions_save_and_close %} +
  • + +
  • +{% endblock %} +{% block content_form_actions_save_and_show %} +
  • + +
  • +{% endblock %} +{% block content_form_actions_save_and_new %} +
  • + +
  • +{% endblock %} diff --git a/Resources/views/CRUD/_view_content.html.twig b/Resources/views/CRUD/_view_content.html.twig new file mode 100644 index 000000000..e7076bf55 --- /dev/null +++ b/Resources/views/CRUD/_view_content.html.twig @@ -0,0 +1,46 @@ +{% extends '@ChillMain/CRUD/_view_content.html.twig' %} + +{% block content_view_actions_back %} +
  • + + {{ 'Cancel'|trans }} + +
  • +{% 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) %} +
  • + + {{ 'crud.delete.link_to_form'|trans }} + +
  • + {% 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) %} +
  • + + {{ 'crud.view.link_duplicate'|trans }} + +
  • + {% 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) %} +
  • + + {{ 'crud.new.link_edit'|trans }} + +
  • + {% endif %} + {% endif %} +{% endblock content_view_actions_edit_link %} diff --git a/Resources/views/CRUD/index.html.twig b/Resources/views/CRUD/index.html.twig index 994e25e1d..f7e3aa2f2 100644 --- a/Resources/views/CRUD/index.html.twig +++ b/Resources/views/CRUD/index.html.twig @@ -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 %}
  • {{ ('crud.'~crud_name~'.index.add_new')|trans( {'%crud_name%': crud_name} ) }} diff --git a/Resources/views/CRUD/new.html.twig b/Resources/views/CRUD/new.html.twig index c5ac70128..aae169447 100644 --- a/Resources/views/CRUD/new.html.twig +++ b/Resources/views/CRUD/new.html.twig @@ -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 %}

    {{ ('crud.'~crud_name~'.title_new')|trans({'%person%': person|chill_entity_render_string }) }}

    {% endblock crud_content_header %} diff --git a/Resources/views/CRUD/view.html.twig b/Resources/views/CRUD/view.html.twig index 502999cbb..148b4bc34 100644 --- a/Resources/views/CRUD/view.html.twig +++ b/Resources/views/CRUD/view.html.twig @@ -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 %}

    {{ ('crud.' ~ crud_name ~ '.title_view')|trans({'%person%': person|chill_entity_render_string }) }}

    {% endblock crud_content_header %}