From d8065514776ee9b6d33ef01620348daa321f095e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 15 Jan 2022 20:33:31 +0100 Subject: [PATCH] notification, list item: manage option fold_item with macro --- .../views/Notification/_list_item.html.twig | 221 +++++++++--------- 1 file changed, 111 insertions(+), 110 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig index 62b593725..91de10f99 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig @@ -1,118 +1,119 @@ +{% macro title(c) %} +
+

+ + {{ 'notification.object_prefix'|trans ~ c.notification.title }} + +

+
+{% endmacro %} + +{% macro header(c) %} +
+
+
    + {% if c.step is not defined or c.step == 'inbox' %} +
  • + + + {{ 'notification.from'|trans }} : + + + {% if not c.notification.isSystem %} + + {{ c.notification.sender|chill_entity_render_string }} + + {% else %} + {{ 'notification.is_system'|trans }} + {% endif %} +
  • + {% endif %} + {% if c.notification.addressees|length > 0 %} +
  • + + + {{ 'notification.to'|trans }} : + + + {% for a in c.notification.addressees %} + + {{ a|chill_entity_render_string }} + + {% endfor %} +
  • + {% endif %} +
+
+
+ {{ c.notification.date|format_datetime('long', 'short') }} +
+
+{% endmacro %} + +{% macro content(c) %} +
+
+ {% include c.data.template with c.data.template_data %} +
+
+
+
+ {% if c.full_content is defined and c.full_content == 'true' %} + {{ c.notification.message|chill_markdown_to_html }} + {% else %} + {{ c.notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }} + {% endif %} +
+
+ {% if c.action_button is not defined or c.action_button != 'false' %} +
+ +
+ {% endif %} +{% endmacro %} +
{% if fold_item is defined and fold_item != 'false' %} -
- - {% endif %} - -
-
-
    - {% if step is not defined or step == 'inbox' %} -
  • - - - {{ 'notification.from'|trans }} : - - - {% if not notification.isSystem %} - - {{ notification.sender|chill_entity_render_string }} - - {% else %} - {{ 'notification.is_system'|trans }} - {% endif %} -
  • - {% endif %} - {% if notification.addressees|length > 0 %} -
  • - - - {{ 'notification.to'|trans }} : - - - {% for a in notification.addressees %} - - {{ a|chill_entity_render_string }} - - {% endfor %} -
  • - {% endif %} -
-
-
- {{ notification.date|format_datetime('long', 'short') }} -
+
+ + {{ _self.header(_context) }}
- - {% if fold_item is defined and fold_item != 'false' %} -
-
- {% endif %} - -
-
- {% include data.template with data.template_data %} -
+
+ {{ _self.content(_context) }}
-
-
- {% if full_content is defined and full_content == 'true' %} - {{ notification.message|chill_markdown_to_html }} - {% else %} - {{ notification.message|u.truncate(250, '…', false)|chill_markdown_to_html }} - {% endif %} -
-
- {% if action_button is not defined or action_button != 'false' %} -
-
    -
  • - {# Vue component #} - -
  • - {% if is_granted('CHILL_MAIN_NOTIFICATION_UPDATE', notification) %} -
  • - -
  • - {% endif %} - {% if is_granted('CHILL_MAIN_NOTIFICATION_SEE', notification) %} -
  • - -
  • - {% endif %} -
-
- {% endif %} - - {% if fold_item is defined and fold_item != 'false' %} -
+ {% else %} + {{ _self.title(_context) }} + {{ _self.header(_context) }} + {{ _self.content(_context) }} {% endif %}