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

add a log time button to the timelogging widget

ulferts3b9a4205f4d6
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 4823cb57a67..026125ebcab 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
@@ -90,3 +90,9 @@
padding-right: 5px
font-weight: bold
+.te-calendar--create-button
+ float: right
+ margin-right: 0
+ margin-top: 4px
+ height: 34px
+
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 5aacf5eb9e4..cb6ac656dbd 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
@@ -83,6 +83,10 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
protected memoizedTimeEntries:{start:Date, end:Date, entries:Promise<CollectionResource<TimeEntryResource>>};
protected memoizedCreateAllowed:boolean = false;
+ public text = {
+ logTime: this.i18n.t('js.button_log_time')
+ };
+
constructor(readonly states:States,
readonly timeEntryDm:TimeEntryDmService,
readonly $state:StateService,
@@ -311,6 +315,10 @@ export class TimeEntryCalendarComponent implements OnInit, OnDestroy, AfterViewI
});
}
+ public addEventToday() {
+ this.addEvent(moment(new Date()));
+ }
+
private addEvent(date:Moment) {
if (!this.memoizedCreateAllowed) {
return;
diff --git a/frontend/src/app/modules/calendar/te-calendar/te-calendar.template.html b/frontend/src/app/modules/calendar/te-calendar/te-calendar.template.html
index 61c8e628cdd..b45ca122872 100644
--- a/frontend/src/app/modules/calendar/te-calendar/te-calendar.template.html
+++ b/frontend/src/app/modules/calendar/te-calendar/te-calendar.template.html
@@ -2,6 +2,16 @@
<div class="te-calendar--container loading-indicator--location"
[attr.data-indicator-name]="'table'"
style="position: relative">
+
+ <button class="button te-calendar--create-button"
+ [attr.aria-label]="text.logTime"
+ (click)="addEventToday()">
+ <op-icon icon-classes="button--icon icon-log_time"></op-icon>
+ <span class="button--text"
+ [textContent]="text.logTime"
+ aria-hidden="true"></span>
+ </button>
+
<full-calendar #ucCalendar
[editable]="calendarEditable"
[eventLimit]="calendarEventLimit"