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

[34291] Use placeholder for new resource dates

Oliver Güntherd29266f5bdd8
diff --git a/frontend/src/app/components/wp-custom-actions/wp-custom-actions.component.ts b/frontend/src/app/components/wp-custom-actions/wp-custom-actions.component.ts
index e2289d289f3..9a44a0891ed 100644
--- a/frontend/src/app/components/wp-custom-actions/wp-custom-actions.component.ts
+++ b/frontend/src/app/components/wp-custom-actions/wp-custom-actions.component.ts
@@ -58,7 +58,7 @@ export class WpCustomActionsComponent extends UntilDestroyedMixin implements OnI
this.untilDestroyed()
)
.subscribe((wp) => {
- this.actions = [...wp.customActions];
+ this.actions = wp.customActions ? [...wp.customActions] : [];
this.cdRef.detectChanges();
});
}
diff --git a/frontend/src/app/modules/fields/edit/field-types/combined-date-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/combined-date-edit-field.component.ts
index 85dd54f5012..6e0ea5ea29e 100644
--- a/frontend/src/app/modules/fields/edit/field-types/combined-date-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/combined-date-edit-field.component.ts
@@ -47,6 +47,8 @@ export class CombinedDateEditFieldComponent extends DateEditFieldComponent imple
@InjectField() opModalService:OpModalService;
dates:string = '';
+ text_no_start_date = this.I18n.t('js.label_no_start_date');
+ text_no_due_date = this.I18n.t('js.label_no_due_date');
private modal:OpModalComponent;
@@ -104,6 +106,14 @@ export class CombinedDateEditFieldComponent extends DateEditFieldComponent imple
// this breaks the preceived abstraction of the edit fields. But the date picker
// is already highly specific to start and due Date.
- this.dates = `${this.resource['startDate']} - ${this.resource['dueDate']}`;
+ this.dates = `${this.currentStartDate} - ${this.currentDueDate}`;
+ }
+
+ protected get currentStartDate():string {
+ return this.resource.startDate || this.text_no_start_date;
+ }
+
+ protected get currentDueDate():string {
+ return this.resource.dueDate || this.text_no_due_date;
}
}
diff --git a/spec/features/work_packages/new/new_work_package_spec.rb b/spec/features/work_packages/new/new_work_package_spec.rb
index a4c37f256b5..d5f6462ebfa 100644
--- a/spec/features/work_packages/new/new_work_package_spec.rb
+++ b/spec/features/work_packages/new/new_work_package_spec.rb
@@ -304,6 +304,15 @@ describe 'new work package', js: true do
click_on 'Cancel'
end
+ it 'sets a default date that is readable (Regression #34291)' do
+ create_work_package_globally(type_bug, project.name)
+
+ date_field = wp_page.edit_field(:combinedDate)
+ date_field.expect_value("no start date - no end date")
+
+ click_on 'Cancel'
+ end
+
it 'can save the work package with an assignee (Regression #32887)' do
create_work_package_globally(type_task, project.name)
expect(page).to have_selector(safeguard_selector, wait: 10)
@@ -452,17 +461,6 @@ describe 'new work package', js: true do
click_link('Create new child')
- ## The dates are taken over from the parent by default
- #date_field = wp_page_create.edit_field(:combinedDate)
- #date_field.expect_value("#{parent.start_date} - #{parent.due_date}" )
-
- #date_field.input_element.click
- #sleep 1
- #date_field.clear with_backspace: true
- #date_field.input_element.send_keys :backspace
-
- #date_field.save!
-
subject = EditField.new wp_page, :subject
subject.set_value 'Child'
subject.submit_by_enter