layout of page calendar list

This commit is contained in:
Julien Fastré 2022-06-01 12:34:07 +02:00
parent 4217524e63
commit 089c92d0ee
4 changed files with 93 additions and 53 deletions

View File

@ -1,3 +1,14 @@
{#
WARNING: this file is in use in both ActivityBundle and CalendarBundle.
Take care when editing this file.
Maybe should we think about abstracting this file a bit more ? Moving it to PersonBundle ?
#}
{% if context == 'calendar_accompanyingCourse' %}
{% import "@ChillCalendar/_invite.html.twig" as invite %}
{% endif %}
{% macro href(pathname, key, value) %} {% macro href(pathname, key, value) %}
{% set parms = { (key): value } %} {% set parms = { (key): value } %}
{{ path(pathname, parms) }} {{ path(pathname, parms) }}
@ -132,6 +143,12 @@
{% if bloc.type == 'user' %} {% if bloc.type == 'user' %}
<span class="badge-user"> <span class="badge-user">
{{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }} {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
{%- if context == 'calendar_accompanyingCourse' %}
{% set invite = entity.inviteForUser(item) %}
{% if invite is not null %}
{{ invite.invite_span(invite) }}
{% endif %}
{%- endif -%}
</span> </span>
{% else %} {% else %}
{{ _self.insert_onthefly(bloc.type, item) }} {{ _self.insert_onthefly(bloc.type, item) }}

View File

@ -33,14 +33,14 @@
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row main"> <div class="item-row main">
<div class="item-col"> <div class="item-col">
<div class="wrap-header">
{% if calendar.startDate and calendar.endDate %} <div class="wl-row">
<div class="wl-col title">
{% if calendar.endDate.diff(calendar.startDate).days >= 1 %} {% if calendar.endDate.diff(calendar.startDate).days >= 1 %}
<h3>{{ "From the day"|trans }} {{ calendar.startDate|format_datetime('medium', 'short') }} </h3> <p class="date-label">{{ calendar.startDate|format_datetime('short', 'short') }} - {{ calendar.endDate|format_datetime('short', 'short') }}</p>
<h3>{{ "to the day"|trans }} {{ calendar.endDate|format_datetime('medium', 'short') }}</h3>
{% else %} {% else %}
<h3>{{ calendar.startDate|format_date('full') }} </h3> <p class="date-label">{{ calendar.startDate|format_datetime('short', 'short') }} - {{ calendar.endDate|format_datetime('none', 'short') }}</p>
<h3>{{ calendar.startDate|format_datetime('none', 'short', locale='fr') }} - {{ calendar.endDate|format_datetime('none', 'short', locale='fr') }}</h3> {% endif %}
<div class="duration"> <div class="duration">
<p> <p>
@ -48,20 +48,46 @@
{{ calendar.duration|date('%H:%I')}} {{ calendar.duration|date('%H:%I')}}
</p> </p>
</div> </div>
{% endif %}
{% endif %}
</div> </div>
</div>
</div>
<div class="item-col"> <div class="item-col">
<ul class="list-content"> <ul class="list-content">
{% if calendar.mainUser is not empty %} {% if calendar.mainUser is not empty %}
<li> <span class="badge-user">{{ calendar.mainUser|chill_entity_render_box }}</span>
<b>{{ 'main user concerned'|trans }}: {{ calendar.mainUser.usernameCanonical }}</b> {% endif %}
</li> </ul>
</div>
</div>
</div>
{%
if calendar.comment.comment is not empty
or calendar.users|length > 0
or calendar.thirdParties|length > 0
or calendar.users|length > 0
%}
<div class="item-row details separator">
<div class="item-col">
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': 'calendar_accompanyingCourse',
'render': 'wrap-list',
'entity': calendar
} %}
</div>
{% if calendar.comment.comment is not empty %}
<div class="item-col comment">
{{ calendar.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
</div>
{% endif %}
</div>
{% endif %} {% endif %}
</ul> <div class="item-row separator">
<ul class="record_actions"> <ul class="record_actions">
{% if (calendar.isInvited(app.user)) %} {% if (calendar.isInvited(app.user)) %}
{% set invite = calendar.inviteForUser(app.user) %} {% set invite = calendar.inviteForUser(app.user) %}
@ -89,32 +115,9 @@
{% endif %} {% endif %}
#} #}
</ul> </ul>
</div>
</div>
{%
if calendar.comment.comment is not empty
or calendar.users|length > 0
or calendar.thirdParties|length > 0
or calendar.users|length > 0
%}
<div class="item-row details">
<div class="item-col">
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
'context': 'calendar_accompanyingCourse',
'render': 'row',
'entity': calendar
} %}
</div> </div>
{% if calendar.comment.comment is not empty %}
<div class="item-col comment">
{{ calendar.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
</div>
{% endif %}
</div>
{% endif %}
</div> </div>
{% endfor %} {% endfor %}

View File

@ -0,0 +1,14 @@
{% macro invite_span(invite) %}
{% if invite.status == 'accepted' %}
{% set fa = 'check' %}
{% elseif invite.status == 'declined' %}
{% set fa = 'times' %}
{% elseif invite.status == 'pending' %}
{% set fa = 'hourglass' %}
{% elseif invite.status == 'tentative' %}
{% set fa = 'question' %}
{% else %}
{% set fa = invite.status %}
{% endif %}
<i class="fa fa-{{ fa }}" title="{{ ('invite.'~invite.status)|trans|e('html_attr') }}"></i>
{% endmacro %}

View File

@ -56,3 +56,9 @@ remote_ms_graph:
remote_calendar: remote_calendar:
calendar_range_title: Plage de disponibilité Chill calendar_range_title: Plage de disponibilité Chill
invite:
accepted: Accepté
declined: Refusé
pending: En attente
tentative: Accepté provisoirement