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

Fix/start day of of calendar (#8691)

ulferts59c4ec76f2b9
diff --git a/frontend/src/app/components/datepicker/datepicker.modal.ts b/frontend/src/app/components/datepicker/datepicker.modal.ts
index aedd3bd12ac..f5051c3f335 100644
--- a/frontend/src/app/components/datepicker/datepicker.modal.ts
+++ b/frontend/src/app/components/datepicker/datepicker.modal.ts
@@ -48,6 +48,7 @@ import {HalResourceEditingService} from "core-app/modules/fields/edit/services/h
import {ResourceChangeset} from "core-app/modules/fields/changeset/resource-changeset";
import {DatePickerModalHelper} from "core-components/datepicker/datepicker.modal.helper";
import {BrowserDetector} from "core-app/modules/common/browser/browser-detector.service";
+import {ConfigurationService} from "core-app/modules/common/config/configuration.service";
export type DateKeys = 'date'|'start'|'end';
@@ -100,7 +101,8 @@ export class DatePickerModal extends OpModalComponent implements AfterViewInit {
constructor(readonly injector:Injector,
@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
readonly cdRef:ChangeDetectorRef,
- readonly elementRef:ElementRef) {
+ readonly elementRef:ElementRef,
+ readonly configurationService:ConfigurationService) {
super(locals, cdRef, elementRef);
this.changeset = locals.changeset;
this.htmlId = `wp-datepicker-${locals.fieldName}`;
@@ -264,7 +266,9 @@ export class DatePickerModal extends OpModalComponent implements AfterViewInit {
},
onMonthChange: () => { this.datepickerHelper.setRangeClasses(this.dates); },
onYearChange: () => { this.datepickerHelper.setRangeClasses(this.dates); },
- }
+ },
+ undefined,
+ this.configurationService
);
}
diff --git a/frontend/src/app/globals/global-listeners/augmented-date-picker.ts b/frontend/src/app/globals/global-listeners/augmented-date-picker.ts
index b255f739614..c2bbed3329d 100644
--- a/frontend/src/app/globals/global-listeners/augmented-date-picker.ts
+++ b/frontend/src/app/globals/global-listeners/augmented-date-picker.ts
@@ -12,15 +12,19 @@ export function augmentedDatePicker(evt:JQuery.TriggeredEvent, target:JQuery) {
target
.attr('autocomplete', 'off'); // Disable autocomplete for those fields
- var datePicker = new DatePicker(
- '.-augmented-datepicker',
- target.val(),
- {
- weekNumbers: true,
- allowInput: true
- },
- target[0]
- );
- datePicker.show();
+ window.OpenProject.getPluginContext()
+ .then(context => {
+ var datePicker = new DatePicker(
+ '.-augmented-datepicker',
+ target.val(),
+ {
+ weekNumbers: true,
+ allowInput: true
+ },
+ target[0],
+ context.services.configurationService
+ );
+ datePicker.show();
+ });
}
}
diff --git a/frontend/src/app/modules/calendar/wp-calendar/wp-calendar.component.ts b/frontend/src/app/modules/calendar/wp-calendar/wp-calendar.component.ts
index 31f53ee0793..5a68fe3e96c 100644
--- a/frontend/src/app/modules/calendar/wp-calendar/wp-calendar.component.ts
+++ b/frontend/src/app/modules/calendar/wp-calendar/wp-calendar.component.ts
@@ -116,23 +116,26 @@ export class WorkPackagesCalendarController extends UntilDestroyedMixin implemen
}
private initializeCalendar() {
- this.calendarOptions = {
- editable: false,
- locale: this.i18n.locale,
- fixedWeekCount: false,
- firstDay: this.configuration.startOfWeek(),
- events: this.calendarEventsFunction.bind(this),
- plugins: [dayGridPlugin],
- initialView: (() => {
- if (this.static) {
- return 'dayGridWeek';
- } else {
- return undefined;
- }
- })(),
- height: this.calendarHeight(),
- headerToolbar: this.buildHeader()
- };
+ this.configuration.initialized
+ .then(() => {
+ this.calendarOptions = {
+ editable: false,
+ locale: this.i18n.locale,
+ fixedWeekCount: false,
+ firstDay: this.configuration.startOfWeek(),
+ events: this.calendarEventsFunction.bind(this),
+ plugins: [dayGridPlugin],
+ initialView: (() => {
+ if (this.static) {
+ return 'dayGridWeek';
+ } else {
+ return undefined;
+ }
+ })(),
+ height: this.calendarHeight(),
+ headerToolbar: this.buildHeader()
+ };
+ });
}
public updateTimeframe(fetchInfo:{ start:Date, end:Date, timeZone:string }) {
diff --git a/frontend/src/app/modules/plugins/plugin-context.ts b/frontend/src/app/modules/plugins/plugin-context.ts
index 654212b9979..8da4a516dc9 100644
--- a/frontend/src/app/modules/plugins/plugin-context.ts
+++ b/frontend/src/app/modules/plugins/plugin-context.ts
@@ -22,6 +22,7 @@ import {CKEditorPreviewService} from "core-app/modules/common/ckeditor/ckeditor-
import {ExternalRelationQueryConfigurationService} from "core-components/wp-table/external-configuration/external-relation-query-configuration.service";
import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
import {APIV3Service} from "core-app/modules/apiv3/api-v3.service";
+import {ConfigurationService} from "core-app/modules/common/config/configuration.service";
/**
* Plugin context bridge for plugins outside the CLI compiler context
@@ -53,7 +54,8 @@ export class OpenProjectPluginContext {
ckEditorPreview: this.injector.get<CKEditorPreviewService>(CKEditorPreviewService),
pathHelperService: this.injector.get<PathHelperService>(PathHelperService),
states: this.injector.get<States>(States),
- apiV3Service: this.injector.get<APIV3Service>(APIV3Service)
+ apiV3Service: this.injector.get<APIV3Service>(APIV3Service),
+ configurationService: this.injector.get<ConfigurationService>(ConfigurationService)
};
// Random collection of classes needed outside of angular