templates changed to use the standard CRUD templates + delete template added

This commit is contained in:
Julie Lenaerts 2021-08-10 15:45:00 +02:00
parent fc6a9ad64f
commit 7d97889cbf
9 changed files with 95 additions and 17 deletions

View File

@ -87,9 +87,17 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
'role' => 'ROLE_USER',
'template' => '@ChillAsideActivity/asideActivity/new.html.twig',
],
'view' => [
'role' => 'ROLE_USER',
'template' => '@ChillAsideActivity/asideActivity/view.html.twig',
],
'edit' => [
'role' => 'ROLE_USER',
'template' => '@ChillAsideActivity/asideActivity/edit.html.twig',
],
'delete' => [
'role' => 'ROLE_USER',
'template' => '@ChillAsideActivity/asideActivity/delete.html.twig',
]
]
],

View File

@ -0,0 +1,37 @@
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
{% block crud_content_header %}
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': entity|chill_entity_render_string }) }}</h1>
{% endblock crud_content_header %}
<p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': entity|chill_entity_render_string }) }}</p>
{{ form_start(form) }}
<ul class="record_actions">
{% block content_form_actions_back %}
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
{{ 'Cancel'|trans }}
</a>
</li>
{% endblock %}
{% block content_form_actions_before %}{% endblock %}
{% block content_form_actions_view %}
{% if is_granted(chill_crud_config('role', crud_name, 'view'), entity) %}
<li class="">
<a class="btn btn-show" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_view', { 'id': entity.id }) }}">
{{ 'crud.edit.back_to_view'|trans }}
</a>
</li>
{% endif %}
{% endblock %}
{% block content_form_actions_confirm_delete %}
<li>
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
</li>
{% endblock content_form_actions_confirm_delete %}
{% block content_form_actions_after %}{% endblock %}
</ul>
{{ form_end(form) }}
</div>

View File

@ -0,0 +1,8 @@
{% extends '@ChillMain/layout.html.twig' %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.delete.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block content %}
{% embed '@ChillAsideActivity/AsideActivity/_delete.html.twig' %}
{% endembed %}
{% endblock content %}

View File

@ -1,12 +1,13 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block admin_content %}
{# {% as we are in the admin layout, we override the admin content with the CRUD content %} #}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{# we do not have "view" page. We empty the corresponding block #}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endembed %}
{% endblock %}

View File

@ -0,0 +1,8 @@
{% extends '@ChillMain/layout.html.twig' %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block content %}
{% embed '@ChillAsideActivity/AsideActivity/_index.html.twig' %}
{% endembed %}
{% endblock content %}

View File

@ -78,9 +78,9 @@
{% endif %}
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
#}
{# <li>
<a href="{{ path('chill_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a>
</li> #}
<li>
<a href="{{ path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a>
</li>
{#
{% endif %}
#}

View File

@ -1,11 +1,11 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block layout_wvm_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endembed %}
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends '@ChillPerson/Person/layout.html.twig' %}
{% set person = entity.person %}
{% set activeRouteKey = '' %}
{% block title %}
{% include('@ChillPerson/CRUD/_view_title.html.twig') %}
{% endblock %}
{% block personcontent %}
{% 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 %}
{% endembed %}
{% endblock %}