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

Revert "have an explicit html id to enable idiomorph to match new and old dom element"

Dombi Attila2c75c8f69edd
diff --git a/app/forms/projects/life_cycles/form.rb b/app/forms/projects/life_cycles/form.rb
index 0d6d800f829..c0e1f93dfbc 100644
--- a/app/forms/projects/life_cycles/form.rb
+++ b/app/forms/projects/life_cycles/form.rb
@@ -44,7 +44,7 @@ module Projects::LifeCycles
end
end
- def field_id
+ def qa_field_name
"life-cycle-step-#{model.id}"
end
@@ -54,14 +54,10 @@ module Projects::LifeCycles
leading_visual: { icon: :calendar },
datepicker_options: {
inDialog: ProjectLifeCycles::Sections::EditDialogComponent::DIALOG_ID,
- data: { action: "change->overview--project-life-cycles-form#previewForm" },
- # An id is required on the angular dom element to have the turbo morphing identify
- # the custom dom uniquely when updating the form. Otherwise, there will be two fields
- # after the first update.
- component_id: field_id
+ data: { action: "change->overview--project-life-cycles-form#previewForm" }
},
wrapper_data_attributes: {
- "qa-field-name": field_id
+ "qa-field-name": qa_field_name
}
}
end
diff --git a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts
index fb99576cd5b..b57cea6b821 100644
--- a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts
+++ b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.ts
@@ -137,13 +137,11 @@ export class OpBasicRangeDatePickerComponent implements OnInit, ControlValueAcce
readonly cdRef:ChangeDetectorRef,
readonly elementRef:ElementRef,
readonly deviceService:DeviceService,
- ) {}
+ ) {
+ populateInputsFromDataset(this);
+ }
ngOnInit() {
- // The populateInputsFromDataset function is called here and not in the constructor as this way,
- // the inputs are filled in the last possible moment. This prevents the id attribute on the angular element from being
- // used as the input instead of what is set in the dataset.
- populateInputsFromDataset(this);
this.mobile = this.deviceService.isMobile;
}
diff --git a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts
index e06e6b4fde9..34e7f9e1b54 100644
--- a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts
+++ b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.ts
@@ -116,13 +116,11 @@ export class OpBasicSingleDatePickerComponent implements ControlValueAccessor, O
readonly cdRef:ChangeDetectorRef,
readonly elementRef:ElementRef,
readonly deviceService:DeviceService,
- ) {}
+ ) {
+ populateInputsFromDataset(this);
+ }
ngOnInit() {
- // The populateInputsFromDataset function is called here and not in the constructor as this way,
- // the inputs are filled in the last possible moment. This prevents the id attribute on the angular element from being
- // used as the input instead of what is set in the dataset.
- populateInputsFromDataset(this);
this.mobile = this.deviceService.isMobile;
}
diff --git a/lib/primer/open_project/forms/date_picker.html.erb b/lib/primer/open_project/forms/date_picker.html.erb
index 8ac47afe44f..147f06d4284 100644
--- a/lib/primer/open_project/forms/date_picker.html.erb
+++ b/lib/primer/open_project/forms/date_picker.html.erb
@@ -40,8 +40,6 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<%= render Primer::ConditionalWrapper.new(condition: @input.auto_check_src, tag: "auto-check", csrf: auto_check_authenticity_token, src: @input.auto_check_src) do %>
<%= angular_component_tag @datepicker_options.fetch(:component),
- id: @datepicker_options.fetch(:component_id) {},
- "data-turbo-permanent": true,
inputs: @datepicker_options.merge(
id: @datepicker_options.fetch(:id) { builder.field_id(@input.name) },
name: @datepicker_options.fetch(:name) { builder.field_name(@input.name) },