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
Add the working days switch to the datepicker on Work packages
Dombi Attila765fca739097
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.tsindex 1f8224a6d8a..1b79f47191b 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts@@ -39,6 +39,7 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';[id]="handler.htmlId"class="inline-edit--field"[opened]="opened"+ [showIgnoreNonWorkingDays]="showIgnoreNonWorkingDays"(closed)="onModalClosed()"></op-single-date-picker>`,@@ -47,12 +48,18 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';export class DateEditFieldComponent extends EditFieldComponent implements OnInit {@InjectField() readonly timezoneService:TimezoneService;+ showIgnoreNonWorkingDays = false;+opened = false;ngOnInit():void {super.ngOnInit();// Open the datepicker when the field is not part of an editing form.this.opened = !this.handler.inEditMode;++ if (this.name.startsWith('customField')) {+ this.showIgnoreNonWorkingDays = true;+ }}public get value() {diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rbindex 04b876d4414..d9b996e47ad 100644--- a/spec/features/work_packages/details/date_editor_spec.rb+++ b/spec/features/work_packages/details/date_editor_spec.rb@@ -299,6 +299,7 @@ describe 'date inplace editor',# Open date pickercf_field.input_element.click+ datepicker.expect_working_days_only_enableddatepicker.set_date Time.zone.todaydatepicker.save!@@ -316,8 +317,9 @@ describe 'date inplace editor',cf_field.activate!cf_field.expect_active!- datepicker.set_date Time.zone.today+ datepicker.expect_working_days_only_enabled+ datepicker.set_date Time.zone.todaydatepicker.expect_year Time.zone.today.yeardatepicker.expect_month Time.zone.today.strftime("%B")datepicker.expect_day Time.zone.today.daydiff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rbindex 4184d60bce0..47f9518c45c 100644--- a/spec/support/components/datepicker/datepicker.rb+++ b/spec/support/components/datepicker/datepicker.rb@@ -159,6 +159,20 @@ module Componentsexpect_input(date.iso8601)end+ ##+ # Expect the "Working days only" switch to be enabled++ def expect_working_days_only_enabled+ expect(container).to have_field("Working days only", checked: true)+ end++ ##+ # Expect the "Working days only" switch to be disabled++ def expect_working_days_only_disabled+ expect(container).to have_field("Working days only", checked: false)+ end+### Expect the given date to be non workingdef expect_non_working(date)