Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remet le champ Commentaire dans FairCalendar #424

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,23 @@ export class FairCalendarController {
})}`;
}

const extendedProps: Record<string, any> = {
summary: event.summary
};

if (event.id) {
extendedProps.url = this.resolver.resolve('faircalendar_events_edit', {
id: event.id
});
}

return {
// See: https://fullcalendar.io/docs/event-object
type: fcEventType,
start: event.date,
end: event.date,
title,
...(event.id
? {
extendedProps: {
url: this.resolver.resolve('faircalendar_events_edit', {
id: event.id
})
}
}
: {}),
extendedProps,
textColor: `var(--event-${fcEventType}-text)`,
backgroundColor: `var(--event-${fcEventType}-background)`,
borderColor: `var(--event-${fcEventType}-border)`
Expand Down
14 changes: 12 additions & 2 deletions src/assets/lib/lazy/eventCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ export function createCalendar(target, date, events, goToEventCreate) {
eventDurationEditable: false,
// TODO: add testid on days
eventContent: ({ event }) => {
const url = event.extendedProps.url;
const { url, summary } = event.extendedProps;

if (url) {
return {
html: `<a href="${url}">${event.title}</a>`
html: `<a href="${url}" ${
summary ? 'title="' + summary + '"' : ''
}>${event.title}</a>`
};
}

if (summary) {
return {
html: `<span title="${summary}">${event.title}</span>`
};
}

return event.title;
},
dateClick: ({ event, date }) => {
Expand Down
4 changes: 3 additions & 1 deletion src/templates/pages/faircalendar/_event_list.njk
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
{% for event in dayEvents %}
<li class="ec-event" style="background-color: {{ event.backgroundColor }}; color: {{ event.textColor }}; border: 1px solid {{ event.borderColor }};">
{% if event.extendedProps.url %}
<a href="{{ event.extendedProps.url }}">
<a href="{{ event.extendedProps.url }}" {% if event.extendedProps.summary %}title="{{ event.extendedProps.summary }}"{% endif %}>
{{ event.title }}
</a>
{% elseif event.extendedProps.summary %}
<span title="{{ event.extendedProps.summary }}">{{ event.title }}</span>
{% else %}
{{ event.title }}
{% endif %}
Expand Down
11 changes: 8 additions & 3 deletions src/templates/pages/faircalendar/events/_form.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% import 'macros/icons.njk' as icons %}
{% from 'macros/attr.njk' import render_attr %}

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

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

Expand Down Expand Up @@ -48,8 +48,13 @@
</div>
</div>

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

{% if startDate %}<input type="hidden" name="startDate" value="{{ startDate }}T00:00:00">{% endif %}
{% if endDate %}<input type="hidden" name="endDate" value="{{ endDate }}T00:00:00">{% endif %}

{{ buttons.save(attr={type: 'submit'}) }}
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/translations/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ faircalendar-type-option = {$type ->
faircalendar-taskId-title = Mission
faircalendar-projectId-title = Projet
faircalendar-time-title = Temps passé
faircalendar-summary-title = Commentaire
faircalendar-filters-month-title = Mois
faircalendar-filters-year-title = Année
faircalendar-filters-userId-title = Coopérateur·ice - salarié·e
Expand Down Expand Up @@ -107,7 +108,6 @@ profile-password = Mot de passe

people-title = FairRH


leaves-title = Congés
leaves-user = Coopérateur·ice - salarié·e
leaves-period = Période
Expand Down
Loading