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

[#60578] Unable to use the date picker for stages

Dombi Attila31e8ecc2dc27
diff --git a/app/forms/projects/life_cycles/form.rb b/app/forms/projects/life_cycles/form.rb
index 1bd83b7b1f6..6d0233b9046 100644
--- a/app/forms/projects/life_cycles/form.rb
+++ b/app/forms/projects/life_cycles/form.rb
@@ -54,7 +54,7 @@ module Projects::LifeCycles
leading_visual: { icon: :calendar },
datepicker_options: {
inDialog: true,
- data: { action: "change->overview--project-life-cycles-form#handleChange" }
+ data: { action: "change->overview--project-life-cycles-form#previewForm" }
},
wrapper_data_attributes: {
"qa-field-name": qa_field_name
diff --git a/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
index 1cc2421b730..09c51ef995f 100644
--- a/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
@@ -35,7 +35,7 @@ export default class ProjectLifeCyclesFormController extends Controller {
declare readonly formTarget:HTMLFormElement;
- handleChange(event:Event) {
+ previewForm(event:Event) {
const target = event.target as HTMLElement;
const previewUrl = this.formTarget.dataset.previewUrl;
@@ -50,9 +50,6 @@ export default class ProjectLifeCyclesFormController extends Controller {
}
datePickerVisible(element:HTMLElement) {
- const nextElement = element.nextElementSibling;
- return nextElement
- && nextElement.classList.contains('flatpickr-calendar')
- && nextElement.classList.contains('open');
+ return element.classList.contains('active');
}
}
diff --git a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
index 59431c3ac7f..32f433111b2 100644
--- a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
@@ -88,9 +88,13 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, :w
# Retrying due to a race condition between filling the input vs submitting the form preview.
original_dates = [life_cycle_initiating.start_date, life_cycle_initiating.end_date]
dialog.set_date_for(life_cycle_initiating, value: original_dates)
+
+ page.driver.clear_network_traffic
dialog.set_date_for(life_cycle_initiating, value: initiating_dates)
dialog.expect_caption(life_cycle_initiating, text: "Duration: 8 working days")
+ # Ensure that only 1 ajax request is triggered after setting the date range.
+ expect(page.driver.browser.network.traffic.size).to eq(1)
end
ready_for_planning_date = start_date + 1.day