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

Show date form when the WorkPackage is in automatic scheduling mode and has children

Henriette Darge0aacbb4495ed
diff --git a/app/components/work_packages/date_picker/dialog_content_component.html.erb b/app/components/work_packages/date_picker/dialog_content_component.html.erb
index a847b3656ad..d00a0effd79 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.html.erb
+++ b/app/components/work_packages/date_picker/dialog_content_component.html.erb
@@ -5,7 +5,7 @@
test_selector: "op-datepicker-modal" },
class: "wp-datepicker-dialog--content") do
component_collection do |collection|
- if schedulable? && has_relations?
+ if show_banner?
collection.with_component(WorkPackages::DatePicker::BannerComponent.new(work_package:, manually_scheduled: schedule_manually))
end
@@ -16,7 +16,7 @@
tab.with_text { I18n.t("work_packages.datepicker_modal.tabs.dates") }
tab.with_panel do
render(WorkPackages::DatePicker::FormContentComponent.new(form_id: DIALOG_FORM_ID,
- schedulable: schedulable?,
+ show_date_form: content_editable?,
work_package:,
schedule_manually:,
focused_field:,
@@ -64,7 +64,7 @@
type: :submit,
form: DIALOG_FORM_ID,
test_selector: "op-datepicker-modal--action",
- disabled: !schedulable?)) do
+ disabled: !content_editable?)) do
I18n.t("button_save")
end
end
diff --git a/app/components/work_packages/date_picker/dialog_content_component.rb b/app/components/work_packages/date_picker/dialog_content_component.rb
index c1250092b87..bfed9196319 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.rb
+++ b/app/components/work_packages/date_picker/dialog_content_component.rb
@@ -79,10 +79,13 @@ module WorkPackages
]
end
- def schedulable?
- @schedule_manually || follows_relations.any?
+ def content_editable?
+ @schedule_manually || follows_relations.any? || children.any?
end
+ def show_banner?
+ @schedule_manually || has_relations?
+ end
def has_relations?
precedes_relations.any? || follows_relations.any? || children.any?
end
diff --git a/app/components/work_packages/date_picker/form_content_component.html.erb b/app/components/work_packages/date_picker/form_content_component.html.erb
index c161167bb29..8289be4dbcc 100644
--- a/app/components/work_packages/date_picker/form_content_component.html.erb
+++ b/app/components/work_packages/date_picker/form_content_component.html.erb
@@ -53,7 +53,7 @@
end
end
- if schedulable
+ if show_date_form
body.with_row(mb: 3, classes: "FormControl-horizontalGroup--sm-vertical") do
render(WorkPackages::DatePicker::DateForm.new(f,
work_package:,
diff --git a/app/components/work_packages/date_picker/form_content_component.rb b/app/components/work_packages/date_picker/form_content_component.rb
index d24c1c12e1d..7406e021682 100644
--- a/app/components/work_packages/date_picker/form_content_component.rb
+++ b/app/components/work_packages/date_picker/form_content_component.rb
@@ -34,10 +34,10 @@ module WorkPackages
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
- attr_accessor :form_id, :schedulable, :work_package, :schedule_manually, :focused_field, :touched_field_map
+ attr_accessor :form_id, :show_date_form, :work_package, :schedule_manually, :focused_field, :touched_field_map
def initialize(form_id:,
- schedulable:,
+ show_date_form:,
work_package:,
schedule_manually: true,
focused_field: :start_date,
@@ -45,7 +45,7 @@ module WorkPackages
super
@form_id = form_id
- @schedulable = schedulable
+ @show_date_form = show_date_form
@work_package = work_package
@schedule_manually = ActiveModel::Type::Boolean.new.cast(schedule_manually)
@focused_field = parse_focused_field(focused_field)