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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Always show the datepicker (if necessary in disabled state)
Henriette Darged61cbe7c4d8a
diff --git a/frontend/src/app/shared/components/datepicker/datepicker.modal.sass b/frontend/src/app/shared/components/datepicker/datepicker.modal.sassindex a7f9cf67a9c..90f853d08c1 100644--- a/frontend/src/app/shared/components/datepicker/datepicker.modal.sass+++ b/frontend/src/app/shared/components/datepicker/datepicker.modal.sass@@ -16,6 +16,8 @@display: gridgrid-template-columns: 1fr 1fr 150pxgrid-column-gap: $spot-spacing-1+ // avoid a jump when the today link is hidden in disabled mode+ min-height: 90px&--date-field&_current,diff --git a/frontend/src/app/shared/components/datepicker/datepicker.modal.ts b/frontend/src/app/shared/components/datepicker/datepicker.modal.tsindex f6b553ad0eb..b4aa639d467 100644--- a/frontend/src/app/shared/components/datepicker/datepicker.modal.ts+++ b/frontend/src/app/shared/components/datepicker/datepicker.modal.ts@@ -49,7 +49,10 @@ import { ResourceChangeset } from 'core-app/shared/components/fields/changeset/rimport { BrowserDetector } from 'core-app/core/browser/browser-detector.service';import { ConfigurationService } from 'core-app/core/config/configuration.service';import { TimezoneService } from 'core-app/core/datetime/timezone.service';-import { DayElement } from 'flatpickr/dist/types/instance';+import {+ DayElement,+ Instance,+} from 'flatpickr/dist/types/instance';import flatpickr from 'flatpickr';import { DatepickerModalService } from 'core-app/shared/components/datepicker/datepicker.modal.service';@@ -131,22 +134,15 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterV}ngAfterViewInit():void {- if (this.isSchedulable) {- this.initializeDatepicker();- }+ this.initializeDatepicker();this.onDataChange();}changeSchedulingMode():void {this.scheduleManually = !this.scheduleManually;+ this.toggleDisabledState(this.datePickerInstance.datepickerInstance);this.cdRef.detectChanges();-- if (this.scheduleManually) {- this.initializeDatepicker();- } else if (this.datepickerService.isParent) {- this.removeDateSelection();- }}save($event:Event):void {@@ -229,10 +225,6 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVreturn !this.scheduleManually && !!this.changeset.value('scheduleManually');}- private removeDateSelection() {- this.datePickerInstance.destroy();- }-private initializeDatepicker() {this.datePickerInstance?.destroy();this.datePickerInstance = new DatePicker(@@ -243,9 +235,7 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVshowMonths: this.browserDetector.isMobile ? 1 : 2,inline: true,onReady: (selectedDates, dateStr, instance) => {- if (!this.isSchedulable) {- instance.calendarContainer.classList.add('disabled');- }+ this.toggleDisabledState(instance);},onChange: (dates:Date[]) => {this.handleDatePickerChange(dates);@@ -347,4 +337,12 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterVprivate initialActivatedField():DateKeys {return this.locals.fieldName === 'dueDate' ? 'end' : 'start';}++ private toggleDisabledState(instance:Instance) {+ if (this.isSchedulable) {+ instance.calendarContainer.classList.remove('disabled');+ } else {+ instance.calendarContainer.classList.add('disabled');+ }+ }}