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 value update for date picker in wp table

Benjamin Bädorfbade5147f3e8
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
index ad326bc56a1..6e16b2fa54d 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
@@ -1,14 +1,16 @@
<spot-drop-modal
- [open]="isOpened"
+ [open]="opened"
(closed)="cancel()"
alignment="bottom-center"
>
- <button
+ <input
slot="trigger"
- type="button"
- (click)="showDatePickerModal()"
- class="spot-link"
- >{{ dates }}</button>
+ type="text"
+ class="spot-input"
+ (click)="onInputClick($event)"
+ [value]="dates"
+ (focus)="showDatePickerModal()"
+ />
<op-wp-single-date-form
*ngIf="!isMultiDate"
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
index 72f26d46e2c..7de0e7e882f 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
@@ -36,7 +36,7 @@ import { WorkPackageResource } from 'core-app/features/hal/resources/work-packag
export class CombinedDateEditFieldComponent extends DatePickerEditFieldComponent {
dates = '';
- isOpened = true;
+ opened = true;
text = {
placeholder: {
@@ -50,14 +50,18 @@ export class CombinedDateEditFieldComponent extends DatePickerEditFieldComponent
return !this.change.schema.isMilestone;
}
+ public onInputClick(event:MouseEvent) {
+ event.stopPropagation();
+ }
+
public onModalClosed():void {
- this.isOpened = false;
+ this.opened = false;
this.resetDates();
super.onModalClosed();
}
public save():void {
- this.handler.deactivate(true);
+ this.handler.handleUserSubmit();
}
public cancel():void {
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
index 2984342a318..da0ef517654 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
@@ -62,9 +62,7 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent im
super.ngOnDestroy();
}
- public showDatePickerModal():void {
- console.log('show datepicker modal');
- }
+ public showDatePickerModal():void { }
protected onModalClosed():void {
void this.handler.handleUserSubmit();
diff --git a/spec/features/work_packages/table/duration_field_spec.rb b/spec/features/work_packages/table/duration_field_spec.rb
index a3eaab536ba..fcc010644c4 100644
--- a/spec/features/work_packages/table/duration_field_spec.rb
+++ b/spec/features/work_packages/table/duration_field_spec.rb
@@ -37,6 +37,7 @@ describe 'Duration field in the work package table',
duration.expect_state_text '4 days'
duration.activate!
+ byebug
date_field.expect_duration_highlighted
expect(page).to have_focus_on('[data-qa-selector="op-datepicker-modal--duration-field"] input[name="duration"]')
expect(page).to have_field('duration', with: '4', wait: 10)