Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

visible duration for event

ulferts14e210cd6398
diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass
index bb9ba8e5c9c..e90f6c6962b 100644
--- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass
+++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.sass
@@ -54,3 +54,13 @@
font-weight: normal
font-size: 1.5rem
+ .fc-duration
+ border-right: 1px solid white
+ border-bottom: 1px solid white
+ margin-left: -1px
+ padding-left: 1px
+ display: inline-block
+ margin-right: 5px
+ padding-right: 5px
+ font-weight: bold
+
diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
index f449c3cfc19..b85c5eaa457 100644
--- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
+++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.component.ts
@@ -110,7 +110,7 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
// The full-calendar component's outputs do not seem to work
// see: https://github.com/fullcalendar/fullcalendar-angular/issues/228#issuecomment-523505044
// Therefore, setting the outputs via the underlying API
- this.ucCalendar.getApi().setOption('eventRender', (event:CalendarViewEvent) => { this.addTooltip(event); });
+ this.ucCalendar.getApi().setOption('eventRender', (event:CalendarViewEvent) => { this.alterEventEntry(event); });
this.ucCalendar.getApi().setOption('eventClick', (event:CalendarViewEvent) => { this.dispatchEventClick(event); });
this.ucCalendar.getApi().setOption('eventDrop', (event:CalendarMoveEvent) => { this.moveEvent(event); });
this.ucCalendar.getApi().setOption('dateClick', (event:CalendarDateClickEvent) => { this.addEvent(moment(event.date)); });
@@ -339,11 +339,16 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
});
}
- private addTooltip(event:CalendarViewEvent) {
+ private alterEventEntry(event:CalendarViewEvent) {
if (!event.event.extendedProps.entry) {
return;
}
+ this.addTooltip(event);
+ this.prependDuration(event);
+ }
+
+ private addTooltip(event:CalendarViewEvent) {
jQuery(event.el).tooltip({
content: this.tooltipContentString(event.event.extendedProps.entry),
items: '.fc-event',
@@ -352,6 +357,14 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
});
}
+ private prependDuration(event:CalendarViewEvent) {
+ let formattedDuration = this.timezone.formattedDuration(event.event.extendedProps.entry.hours);
+
+ jQuery(event.el)
+ .find('.fc-title')
+ .prepend(`<div class="fc-duration">${formattedDuration}</div>`);
+ }
+
private entryName(entry:TimeEntryResource) {
let name = entry.project.name;
if (entry.workPackage) {