mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
activity list page: put item bloc in a separate include
This commit is contained in:
parent
8afd1ee275
commit
af6f3043ae
@ -0,0 +1,151 @@
|
|||||||
|
{% set t = activity.type %}
|
||||||
|
<div class="item-bloc activity-item{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
|
||||||
|
|
||||||
|
<div class="item-row">
|
||||||
|
<div class="wrap-list">
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
{% if activity.date %}
|
||||||
|
<p class="date-label">
|
||||||
|
{{ activity.date|format_date('short') }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
<h2 class="badge-title">
|
||||||
|
<span class="title_label"></span>
|
||||||
|
<span class="title_action">
|
||||||
|
{{ activity.type.name | localize_translatable_string }}
|
||||||
|
|
||||||
|
{% if activity.emergency %}
|
||||||
|
<span class="badge bg-danger rounded-pill fs-6 float-end">{{ 'Emergency'|trans|upper }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item-row column separator">
|
||||||
|
<div class="wrap-list">
|
||||||
|
{% if activity.location and t.locationVisible %}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title"><h3>{{ 'location'|trans }}</h3></div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
<p class="wl-item">
|
||||||
|
<span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
|
||||||
|
{{ activity.location.name }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
<p class="wl-item">
|
||||||
|
{{ activity.sentReceived|capitalize|trans }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if activity.user and t.userVisible %}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
<p class="wl-item">
|
||||||
|
{{ activity.user.usernameCanonical|chill_entity_render_string|capitalize }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||||
|
'context': context,
|
||||||
|
'with_display': 'wrap-list',
|
||||||
|
'entity': activity,
|
||||||
|
'badge_person': true
|
||||||
|
} %}
|
||||||
|
|
||||||
|
<div class="wrap-list">
|
||||||
|
{%- if activity.reasons is not empty and t.reasonsVisible -%}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
<h3>{{ 'Reasons'|trans }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
{% for r in activity.reasons %}
|
||||||
|
<p class="wl-item reasons">
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if activity.socialIssues is not empty and t.socialIssuesVisible -%}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
<h3>{{ 'Social issues'|trans }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
{% for r in activity.socialIssues %}
|
||||||
|
<p class="wl-item social-issues">
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if activity.socialActions is not empty and t.socialActionsVisible -%}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
<h3>{{ 'Social actions'|trans }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
{% for r in activity.socialActions %}
|
||||||
|
<p class="wl-item social-actions">
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if activity.comment.comment is not empty and is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
|
||||||
|
<div class="wl-row">
|
||||||
|
<div class="wl-col title">
|
||||||
|
<h3>{{ 'Comment'|trans }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="wl-col list">
|
||||||
|
{{ activity.comment|chill_entity_render_box({
|
||||||
|
'disable_markdown': false,
|
||||||
|
'limit_lines': 3,
|
||||||
|
'metadata': false
|
||||||
|
}) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
||||||
|
durationTime
|
||||||
|
travelTime
|
||||||
|
comment
|
||||||
|
documents
|
||||||
|
attendee
|
||||||
|
#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item-row separator">
|
||||||
|
<ul class="record_actions">
|
||||||
|
{{ recordAction }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
@ -1,3 +1,61 @@
|
|||||||
|
{% macro recordAction(activity, context = null, person_id = null, accompanying_course_id = null) %}
|
||||||
|
{% if no_action is not defined or no_action == false %}
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {
|
||||||
|
'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity',
|
||||||
|
'entityId': activity.id
|
||||||
|
}) }}">{{ 'notification.Notify'|trans }}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
||||||
|
{#
|
||||||
|
Disable person_id in following links, for redirect to accompanyingCourse context
|
||||||
|
#}
|
||||||
|
{% set person_id = null %}
|
||||||
|
{% set accompanying_course_id = activity.accompanyingPeriod.id %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ chill_path_add_return_path('chill_activity_activity_list',{
|
||||||
|
'accompanying_period_id': accompanying_course_id
|
||||||
|
}) }}"
|
||||||
|
class="btn btn-primary"
|
||||||
|
title="{{ 'See activity in accompanying course context'|trans }}">
|
||||||
|
<i class="fa fa-random fa-fw"></i>
|
||||||
|
{{ 'Period number %number%'|trans({'%number%': accompanying_course_id}) }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_activity_activity_show', {'id': activity.id,
|
||||||
|
'person_id': person_id,
|
||||||
|
'accompanying_period_id': accompanying_course_id
|
||||||
|
}) }}"
|
||||||
|
class="btn btn-show"
|
||||||
|
title="{{ 'Show'|trans }}"></a>
|
||||||
|
</li>
|
||||||
|
{% if no_action is not defined or no_action == false %}
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_activity_activity_edit', {'id': activity.id,
|
||||||
|
'person_id': person_id,
|
||||||
|
'accompanying_period_id': accompanying_course_id
|
||||||
|
}) }}"
|
||||||
|
class="btn btn-update"
|
||||||
|
title="{{ 'Edit'|trans }}"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_activity_activity_delete', {'id': activity.id,
|
||||||
|
'person_id': person_id,
|
||||||
|
'accompanying_period_id': accompanying_course_id
|
||||||
|
}) }}"
|
||||||
|
class="btn btn-delete"
|
||||||
|
title="{{ 'Delete'|trans }}"></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
<div class="context-{{ context }}">
|
<div class="context-{{ context }}">
|
||||||
|
|
||||||
{% if activities|length == 0 %}
|
{% if activities|length == 0 %}
|
||||||
@ -8,215 +66,10 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<div class="flex-table activity-list">
|
<div class="flex-table activity-list">
|
||||||
{% for activity in activities %}
|
{% for activity in activities %}
|
||||||
{% set t = activity.type %}
|
{% include 'ChillActivityBundle:Activity:_list_item.html.twig' with {
|
||||||
<div class="item-bloc">
|
'context': context,
|
||||||
|
'recordAction': _self.recordAction(activity, context, person_id, accompanying_course_id)
|
||||||
<div class="item-row">
|
} %}
|
||||||
<div class="wrap-list">
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title">
|
|
||||||
{% if activity.date %}
|
|
||||||
<p class="date-label">
|
|
||||||
{{ activity.date|format_date('short') }}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
<h2 class="badge-title">
|
|
||||||
<span class="title_label"></span>
|
|
||||||
<span class="title_action">
|
|
||||||
{{ activity.type.name | localize_translatable_string }}
|
|
||||||
|
|
||||||
{% if activity.emergency %}
|
|
||||||
<span class="badge bg-danger rounded-pill fs-6 float-end">{{ 'Emergency'|trans|upper }}</span>
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-row column separator">
|
|
||||||
<div class="wrap-list">
|
|
||||||
{% if activity.location and t.locationVisible %}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title"><h3>{{ 'location'|trans }}</h3></div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
<p class="wl-item">
|
|
||||||
<span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
|
|
||||||
{{ activity.location.name }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
<p class="wl-item">
|
|
||||||
{{ activity.sentReceived|capitalize|trans }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if activity.user and t.userVisible %}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
<p class="wl-item">
|
|
||||||
{{ activity.user.usernameCanonical|chill_entity_render_string|capitalize }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
|
||||||
'context': context,
|
|
||||||
'with_display': 'wrap-list',
|
|
||||||
'entity': activity,
|
|
||||||
'badge_person': true
|
|
||||||
} %}
|
|
||||||
|
|
||||||
<div class="wrap-list">
|
|
||||||
{%- if activity.reasons is not empty and t.reasonsVisible -%}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title">
|
|
||||||
<h3>{{ 'Reasons'|trans }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
{% for r in activity.reasons %}
|
|
||||||
<p class="wl-item reasons">
|
|
||||||
{{ r|chill_entity_render_box }}
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{%- if activity.socialIssues is not empty and t.socialIssuesVisible -%}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title">
|
|
||||||
<h3>{{ 'Social issues'|trans }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
{% for r in activity.socialIssues %}
|
|
||||||
<p class="wl-item social-issues">
|
|
||||||
{{ r|chill_entity_render_box }}
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{%- if activity.socialActions is not empty and t.socialActionsVisible -%}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title">
|
|
||||||
<h3>{{ 'Social actions'|trans }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
{% for r in activity.socialActions %}
|
|
||||||
<p class="wl-item social-actions">
|
|
||||||
{{ r|chill_entity_render_box }}
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if activity.comment.comment is not empty and is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
|
|
||||||
<div class="wl-row">
|
|
||||||
<div class="wl-col title">
|
|
||||||
<h3>{{ 'Comment'|trans }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="wl-col list">
|
|
||||||
{{ activity.comment|chill_entity_render_box({
|
|
||||||
'disable_markdown': false,
|
|
||||||
'limit_lines': 3,
|
|
||||||
'metadata': false
|
|
||||||
}) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
|
||||||
durationTime
|
|
||||||
travelTime
|
|
||||||
comment
|
|
||||||
documents
|
|
||||||
attendee
|
|
||||||
#}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% set notifications = chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %}
|
|
||||||
{% if notifications is not empty %}
|
|
||||||
<div class="item-row separator">
|
|
||||||
{{ notifications|raw }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="item-row separator">
|
|
||||||
<ul class="record_actions">
|
|
||||||
{% if no_action is not defined or no_action == false %}
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-notify" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': activity.id}) }}">{{ 'notification.Notify'|trans }}</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
|
||||||
{#
|
|
||||||
Disable person_id in following links, for redirect to accompanyingCourse context
|
|
||||||
#}
|
|
||||||
{% set person_id = null %}
|
|
||||||
{% set accompanying_course_id = activity.accompanyingPeriod.id %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ chill_path_add_return_path('chill_activity_activity_list',{
|
|
||||||
'accompanying_period_id': accompanying_course_id
|
|
||||||
}) }}"
|
|
||||||
class="btn btn-primary"
|
|
||||||
title="{{ 'See activity in accompanying course context'|trans }}">
|
|
||||||
<i class="fa fa-random fa-fw"></i>
|
|
||||||
{{ 'Period number %number%'|trans({'%number%': accompanying_course_id}) }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activity_show', {'id': activity.id,
|
|
||||||
'person_id': person_id,
|
|
||||||
'accompanying_period_id': accompanying_course_id
|
|
||||||
}) }}"
|
|
||||||
class="btn btn-show"
|
|
||||||
title="{{ 'Show'|trans }}"></a>
|
|
||||||
</li>
|
|
||||||
{% if no_action is not defined or no_action == false %}
|
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activity_edit', {'id': activity.id,
|
|
||||||
'person_id': person_id,
|
|
||||||
'accompanying_period_id': accompanying_course_id
|
|
||||||
}) }}"
|
|
||||||
class="btn btn-update"
|
|
||||||
title="{{ 'Edit'|trans }}"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activity_delete', {'id': activity.id,
|
|
||||||
'person_id': person_id,
|
|
||||||
'accompanying_period_id': accompanying_course_id
|
|
||||||
}) }}"
|
|
||||||
class="btn btn-delete"
|
|
||||||
title="{{ 'Delete'|trans }}"></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user