Skip to content

Commit 1ac13df

Browse files
Remet le champ Commentaire dans FairCalendar (#424)
1 parent 1fa6695 commit 1ac13df

5 files changed

Lines changed: 35 additions & 16 deletions

File tree

src/Infrastructure/FairCalendar/Controller/FairCalendarController.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,23 @@ export class FairCalendarController {
8787
})}`;
8888
}
8989

90+
const extendedProps: Record<string, any> = {
91+
summary: event.summary
92+
};
93+
94+
if (event.id) {
95+
extendedProps.url = this.resolver.resolve('faircalendar_events_edit', {
96+
id: event.id
97+
});
98+
}
99+
90100
return {
91101
// See: https://fullcalendar.io/docs/event-object
92102
type: fcEventType,
93103
start: event.date,
94104
end: event.date,
95105
title,
96-
...(event.id
97-
? {
98-
extendedProps: {
99-
url: this.resolver.resolve('faircalendar_events_edit', {
100-
id: event.id
101-
})
102-
}
103-
}
104-
: {}),
106+
extendedProps,
105107
textColor: `var(--event-${fcEventType}-text)`,
106108
backgroundColor: `var(--event-${fcEventType}-background)`,
107109
borderColor: `var(--event-${fcEventType}-border)`

src/assets/lib/lazy/eventCalendar.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,22 @@ export function createCalendar(target, date, events, goToEventCreate) {
2929
eventDurationEditable: false,
3030
// TODO: add testid on days
3131
eventContent: ({ event }) => {
32-
const url = event.extendedProps.url;
32+
const { url, summary } = event.extendedProps;
33+
3334
if (url) {
3435
return {
35-
html: `<a href="${url}">${event.title}</a>`
36+
html: `<a href="${url}" ${
37+
summary ? 'title="' + summary + '"' : ''
38+
}>${event.title}</a>`
39+
};
40+
}
41+
42+
if (summary) {
43+
return {
44+
html: `<span title="${summary}">${event.title}</span>`
3645
};
3746
}
47+
3848
return event.title;
3949
},
4050
dateClick: ({ event, date }) => {

src/templates/pages/faircalendar/_event_list.njk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@
3939
{% for event in dayEvents %}
4040
<li class="ec-event" style="background-color: {{ event.backgroundColor }}; color: {{ event.textColor }}; border: 1px solid {{ event.borderColor }};">
4141
{% if event.extendedProps.url %}
42-
<a href="{{ event.extendedProps.url }}">
42+
<a href="{{ event.extendedProps.url }}" {% if event.extendedProps.summary %}title="{{ event.extendedProps.summary }}"{% endif %}>
4343
{{ event.title }}
4444
</a>
45+
{% elseif event.extendedProps.summary %}
46+
<span title="{{ event.extendedProps.summary }}">{{ event.title }}</span>
4547
{% else %}
4648
{{ event.title }}
4749
{% endif %}

src/templates/pages/faircalendar/events/_form.njk

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% import 'macros/icons.njk' as icons %}
33
{% from 'macros/attr.njk' import render_attr %}
44

5-
{% macro event_form(event, types, projects, tasks, times, startDate, endDate, attr=null) %}
5+
{% macro event_form(event, types, projects, tasks, times, startDate=null, endDate=null, attr=null) %}
66

77
{% set isNotMission = event and event.type != 'mission' %}
88

@@ -48,8 +48,13 @@
4848
</div>
4949
</div>
5050

51-
<input type="hidden" name="startDate" value="{{ startDate }}T00:00:00">
52-
<input type="hidden" name="endDate" value="{{ endDate }}T00:00:00">
51+
<div class="pc-input-group">
52+
<label for="summary" class="pc-label">{{ 'faircalendar-summary-title'|trans }}</label>
53+
<input name="summary" id="summary" {% if event %}value="{{ event.summary }}"{% endif %}>
54+
</div>
55+
56+
{% if startDate %}<input type="hidden" name="startDate" value="{{ startDate }}T00:00:00">{% endif %}
57+
{% if endDate %}<input type="hidden" name="endDate" value="{{ endDate }}T00:00:00">{% endif %}
5358

5459
{{ buttons.save(attr={type: 'submit'}) }}
5560
</form>

src/translations/fr-FR.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ faircalendar-type-option = {$type ->
6464
faircalendar-taskId-title = Mission
6565
faircalendar-projectId-title = Projet
6666
faircalendar-time-title = Temps passé
67+
faircalendar-summary-title = Commentaire
6768
faircalendar-filters-month-title = Mois
6869
faircalendar-filters-year-title = Année
6970
faircalendar-filters-userId-title = Coopérateur·ice - salarié·e
@@ -107,7 +108,6 @@ profile-password = Mot de passe
107108
108109
people-title = FairRH
109110
110-
111111
leaves-title = Congés
112112
leaves-user = Coopérateur·ice - salarié·e
113113
leaves-period = Période

0 commit comments

Comments
 (0)