From a1ed0d3ce48b40256c572ef08ab5b06b2aa85073 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 10 Aug 2021 11:32:27 +0200 Subject: [PATCH] list.html.twig template added and adapted to display list of aside activities, still need to adapt to show only activities of logged in user --- .../ChillAsideActivityExtension.php | 2 +- .../views/asideActivity/index.html.twig | 4 +- .../views/asideActivity/list.html.twig | 79 +++++++++++++++++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php index 523c04495..69bde308e 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php @@ -80,7 +80,7 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte 'controller' => \Chill\AsideActivityBundle\Controller\AsideActivityController::class, 'actions' => [ 'index' => [ - 'template' => '@ChillAsideActivity/asideActivity/index.html.twig', + 'template' => '@ChillAsideActivity/asideActivity/list.html.twig', 'role' => 'ROLE_USER' ], 'new' => [ diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig index 3e0a4f404..0ad5ea3ee 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig @@ -6,7 +6,7 @@ - + {# #} @@ -14,7 +14,7 @@ {% for entity in entities %} - + {# #}
{{ 'Name'|trans }}{{ 'Name'|trans }}{{ 'Active'|trans }} {{ 'Actions'|trans }}
{{ entity.name|localize_translatable_string }}{{ entity.name|localize_translatable_string }} {%- if entity.active -%} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig new file mode 100644 index 000000000..0b1810452 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/list.html.twig @@ -0,0 +1,79 @@ +{# {% set person_id = null %} +{% if person %} + {% set person_id = person.id %} +{% endif %} #} +{% extends "@ChillActivity/Admin/layout_activity.html.twig" %} + +{% block admin_content %} +

{{ 'Activity list' |trans }}

+ +{% if entities|length == 0 %} +

+ {{ "There isn't any activities."|trans }} + +

+{% else %} + +
+ + {% for entity in entities %} + {% set t = entity.type %} +
+
+
+ + {% if entity.date %} +

{{ entity.date|format_date('long') }}

+ {% endif %} + +
+

+ + {{ entity.duration|date('H:i') }} +

+
+ +
+
+
    + {% if entity.createdBy %} +
  • + {{ 'by'|trans }}{{ entity.createdBy.usernameCanonical }} +
  • + {% endif %} + +
  • + {{ entity.type.title | localize_translatable_string }} +
  • + +
+
+
+ {% + if entity.note is not empty + or entity.createdBy|length > 0 + %} +
+ {% if entity.note is not empty %} +
+ {{ entity.note|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }} +
+ {% endif %} +
+ {% endif %} + +
+ {% endfor %} +
+{% endif %} + +{# TODO set this condition in configuration #} + + + {% endblock %}