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

Disable the form in automatic scheduling mode

Henriette Darge583fc7cb5ad0
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 6b10303e45f..9bc9443154f 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
@@ -61,6 +61,7 @@
checked: !ignore_non_working_days?,
value: 0,
unchecked_value: 1,
+ disabled: disabled?,
data: { "work-packages--date-picker--preview-target": "fieldInput",
action: "work-packages--date-picker--preview#markFieldAsTouched" }))
end
@@ -72,6 +73,7 @@
work_package:,
focused_field:,
touched_field_map:,
+ disabled: disabled?,
start_date:,
due_date:,
duration:))
@@ -84,7 +86,7 @@
due_date: due_date,
ignore_non_working_days: ignore_non_working_days?,
schedule_manually:,
- is_schedulable: true # TODO
+ is_schedulable: !disabled?
}
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 300258d886a..aaacf666759 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.rb
+++ b/app/components/work_packages/date_picker/dialog_content_component.rb
@@ -48,6 +48,10 @@ module WorkPackages
private
+ def disabled?
+ !schedule_manually
+ end
+
def ignore_non_working_days?
if params[:work_package].present? && params[:work_package][:ignore_non_working_days].present?
ActiveModel::Type::Boolean.new.cast((params[:work_package][:ignore_non_working_days]))
diff --git a/app/forms/work_packages/date_picker/form.rb b/app/forms/work_packages/date_picker/form.rb
index a3918f5086f..09c979982ee 100644
--- a/app/forms/work_packages/date_picker/form.rb
+++ b/app/forms/work_packages/date_picker/form.rb
@@ -49,7 +49,11 @@ module WorkPackages
attr_reader :work_package
def initialize(work_package:,
- start_date:, due_date:, duration:, focused_field: :start_date,
+ start_date:,
+ due_date:,
+ duration:,
+ disabled:,
+ focused_field: :start_date,
touched_field_map: {})
super()
@@ -59,6 +63,7 @@ module WorkPackages
@start_date = start_date
@due_date = due_date
@duration = duration
+ @disabled = disabled
end
form do |query_form|
@@ -91,6 +96,7 @@ module WorkPackages
text_field_options = default_field_options(name).merge(
name:,
value: field_value(name, value),
+ disabled: @disabled,
label:,
validation_message: validation_message(name)
)