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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Display the datepicker input fields on the life cycle edit form
Dombi Attiladdf938c2c7c6
diff --git a/app/forms/projects/life_cycles/form.rb b/app/forms/projects/life_cycles/form.rbindex 989e0a2267c..2df57d431c4 100644--- a/app/forms/projects/life_cycles/form.rb+++ b/app/forms/projects/life_cycles/form.rb@@ -44,17 +44,52 @@ module Projects::LifeCyclesendend+ def invalid?+ model.errors.any?+ end++ def validation_message+ model.errors.full_messages.join(", ") if invalid?+ end++ def qa_field_name+ "life-cycle-step-#{model.id}"+ end++ def base_input_attributes+ {+ label: "#{icon} #{text}".html_safe, # rubocop:disable Rails/OutputSafety+ leading_visual: { icon: :calendar },+ required: true,+ invalid: invalid?,+ validation_message:,+ datepicker_options: { inDialog: true },+ wrapper_data_attributes: {+ "qa-field-name": qa_field_name+ }+ }+ end+def single_value_life_cycle_input(form)- form.text_field name: :date, label: "#{icon} #{text}".html_safe, type: :date # rubocop:disable Rails/OutputSafety+ input_attributes = base_input_attributes.merge(+ name: :start_date,+ value: model.start_date+ )++ form.single_date_picker **input_attributesenddef multi_value_life_cycle_input(form)- helpers.angular_component_tag "opce-range-date-picker",- inputs: {- name: "my-datepicker",- value: model.start_date- }- form.text_field name: :start_date, label: "#{icon} #{text}".html_safe, type: :date # rubocop:disable Rails/OutputSafety+ value = [+ helpers.format_date(model.start_date),+ helpers.format_date(model.end_date)+ ].compact.join(" - ")++ input_attributes = base_input_attributes.merge(+ name: :start_date,+ value:+ )+ form.range_date_picker **input_attributesenddef textdiff --git a/modules/overviews/app/components/project_life_cycles/sections/edit_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/edit_component.html.erbindex 27eb079bfd7..df496c4cb8f 100644--- a/modules/overviews/app/components/project_life_cycles/sections/edit_component.html.erb+++ b/modules/overviews/app/components/project_life_cycles/sections/edit_component.html.erb@@ -9,8 +9,9 @@url: update_project_life_cycles_path(project_id: model.id),) do |f|render(Primer::Forms::SpacingWrapper.new) do- f.fields_for(:life_cycle_steps, life_cycle_steps) do |lcf|- render(Projects::LifeCycles::Form.new(lcf))+ f.fields_for(:life_cycle_steps, life_cycle_steps) do |life_cycle_form|+ render(Projects::LifeCycles::Form.new(life_cycle_form)+ )endendenddiff --git a/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erbindex 0e51a1686c9..94fa971e49a 100644--- a/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb+++ b/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb@@ -1,6 +1,6 @@<%=render(Primer::Alpha::Dialog.new(title: t("label_life_cycle_plural"),- size: :medium_portrait,+ size: :large,id: "edit-project-life-cycles-dialog")) do |d|d.with_header(variant: :large)d.with_body(classes: "Overlay-body_autocomplete_height") do