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

Rename datepicker component id to inputId so it won't interfere with the componen's id.

Dombi Attilad4924d292187
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 178a3c14a92..4d401b6f9d3 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -81,7 +81,7 @@ module CustomFieldsHelper
angular_component_tag "opce-basic-single-date-picker",
inputs: {
required: custom_field.required?,
- id: field_id,
+ inputId: field_id,
name: field_name
}
when "text"
diff --git a/app/views/filters/date/_between_dates.html.erb b/app/views/filters/date/_between_dates.html.erb
index 014f8e6129b..c4475cf9d13 100644
--- a/app/views/filters/date/_between_dates.html.erb
+++ b/app/views/filters/date/_between_dates.html.erb
@@ -3,14 +3,14 @@
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: from_value,
- id: "between-dates-from-value-#{filter.name}",
+ inputId: "between-dates-from-value-#{filter.name}",
name: "from_value"
} %>
<span><%= t(:label_date_to) %>:</span>
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: to_value,
- id: "between-dates-to-value-#{filter.name}",
+ inputId: "between-dates-to-value-#{filter.name}",
name: "to_value"
} %>
</div>
diff --git a/app/views/filters/date/_on_date.html.erb b/app/views/filters/date/_on_date.html.erb
index a6b8706de10..37b069ee8b1 100644
--- a/app/views/filters/date/_on_date.html.erb
+++ b/app/views/filters/date/_on_date.html.erb
@@ -3,7 +3,7 @@
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: value,
- id: "on-date-value-#{filter.name}",
+ inputId: "on-date-value-#{filter.name}",
name: "value"
} %>
</div>
diff --git a/app/views/work_packages/bulk/edit.html.erb b/app/views/work_packages/bulk/edit.html.erb
index 10018db61ea..b6a6d423e8f 100644
--- a/app/views/work_packages/bulk/edit.html.erb
+++ b/app/views/work_packages/bulk/edit.html.erb
@@ -180,7 +180,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field-container -visible-overflow">
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
- id: "work_package_start_date",
+ inputId: "work_package_start_date",
name: "work_package[start_date]"
} %>
</div>
@@ -190,7 +190,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field-container -visible-overflow">
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
- id: "work_package_due_date",
+ inputId: "work_package_due_date",
name: "work_package[due_date]"
} %>
</div>
diff --git a/app/views/work_packages/moves/new.html.erb b/app/views/work_packages/moves/new.html.erb
index 296feb25824..7715abc603d 100644
--- a/app/views/work_packages/moves/new.html.erb
+++ b/app/views/work_packages/moves/new.html.erb
@@ -173,7 +173,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field-container -visible-overflow">
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
- id: "start_date",
+ inputId: "start_date",
name: "start_date"
} %>
</div>
@@ -183,7 +183,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field-container -visible-overflow">
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
- id: "due_date",
+ inputId: "due_date",
name: "due_date"
} %>
</div>
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html
index 97e00c37d36..d77b3326c78 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-time-value/filter-date-time-value.component.html
@@ -1,5 +1,5 @@
<op-basic-single-date-picker
- [id]="'values-' + filter.id"
+ [inputId]="'values-' + filter.id"
[name]="'v[' + filter.id + ']'"
class="advanced-filters--date-field"
required="true"
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html
index b29454ccebc..d33f4a4024f 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html
@@ -3,7 +3,7 @@
[value]="isoDateFormatter(begin)"
[opAutofocus]="shouldFocus"
required="true"
- [id]="'values-' + filter.id + '-begin'"
+ [inputId]="'values-' + filter.id + '-begin'"
[name]="'v[' + filter.id + ']-begin'"
classes="advanced-filters--date-field"
></op-basic-single-date-picker>
@@ -14,7 +14,7 @@
<op-basic-single-date-picker
(valueChange)="parseEnd($event)"
[value]="isoDateFormatter(end)"
- [id]="'values-' + filter.id + '-end'"
+ [inputId]="'values-' + filter.id + '-end'"
[name]="'v[' + filter.id + ']-end'"
classes="advanced-filters--date-field"
></op-basic-single-date-picker>
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html
index 5226c44b67e..cd494d58671 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.html
@@ -1,5 +1,5 @@
<op-basic-single-date-picker
- [id]="'values-' + filter.id"
+ [inputId]="'values-' + filter.id"
[name]="'v[' + filter.id + ']'"
class="advanced-filters--date-field"
[opAutofocus]="shouldFocus"
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html
index 0bae891d1aa..22a95cc8293 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html
@@ -1,5 +1,5 @@
<op-basic-range-date-picker
- [id]="'values-' + filter.id"
+ [inputId]="'values-' + filter.id"
[name]="'v[' + filter.id + ']'"
class="advanced-filters--date-field"
diff --git a/frontend/src/app/features/work-packages/components/wp-custom-actions/date-action/custom-date-action-admin.html b/frontend/src/app/features/work-packages/components/wp-custom-actions/date-action/custom-date-action-admin.html
index 99f15a7d473..37e41636bc5 100644
--- a/frontend/src/app/features/work-packages/components/wp-custom-actions/date-action/custom-date-action-admin.html
+++ b/frontend/src/app/features/work-packages/components/wp-custom-actions/date-action/custom-date-action-admin.html
@@ -12,7 +12,7 @@
</span>
<span class="form--text-field-container -slim" *ngIf="valueVisible">
<op-basic-single-date-picker
- [id]="fieldId + '_visible'"
+ [inputId]="fieldId + '_visible'"
[name]="fieldId + '_input'"
[value]="fieldValue"
(valueChange)="updateField($event)"
diff --git a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.html b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.html
index 05fe101b3ce..e2caee42464 100644
--- a/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.html
+++ b/frontend/src/app/shared/components/datepicker/basic-range-date-picker/basic-range-date-picker.component.html
@@ -8,7 +8,7 @@
[ngClass]="inputClassNames"
[attr.data-value]="value"
[attr.data-action]="dataAction"
- [id]="id"
+ [id]="inputId"
[name]="name"
[attr.name]="name"
[required]="required"
@@ -24,7 +24,7 @@
class="spot-input"
data-test-selector="op-basic-range-date-picker-start"
[ngClass]="inputClassNames"
- id="{{ id }}-start"
+ id="{{ inputId }}-start"
name="{{ name }}-start"
[required]="required"
[disabled]="disabled"
@@ -37,7 +37,7 @@
class="spot-input"
data-test-selector="op-basic-range-date-picker-end"
[ngClass]="inputClassNames"
- id="{{ id }}-end"
+ id="{{ inputId }}-end"
name="{{ name }}-end"
[required]="required"
[disabled]="disabled"
@@ -48,7 +48,7 @@
type="hidden"
data-test-selector="op-basic-range-date-picker--value"
[attr.data-value]="stringValue"
- [id]="id"
+ [id]="inputId"
[name]="name"
[attr.name]="name"
[attr.data-action]="dataAction"
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 26736c813b0..e9e98339a65 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
@@ -117,7 +117,7 @@ export class OpBasicRangeDatePickerComponent implements OnInit, ControlValueAcce
// get an id attribute assigned if provided when declaring the component, but it will not
// programatically overwrite the id accessor from angular.
- id = `flatpickr-input-${+(new Date())}`;
+ @Input() inputId = `flatpickr-input-${+(new Date())}`;
@Input() name = '';
@@ -193,7 +193,7 @@ export class OpBasicRangeDatePickerComponent implements OnInit, ControlValueAcce
private initializeDatePicker() {
this.datePickerInstance = new DatePicker(
this.injector,
- this.id,
+ this.inputId,
this.value || '',
{
allowInput: true,
diff --git a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.html b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.html
index 3e7fe691030..9abfe2379d1 100644
--- a/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.html
+++ b/frontend/src/app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component.html
@@ -9,7 +9,7 @@
[ngModel]="value"
[attr.data-value]="value"
[attr.data-action]="dataAction"
- [id]="id"
+ [id]="inputId"
[name]="name"
[attr.name]="name"
[required]="required"
@@ -28,7 +28,7 @@
[ngClass]="inputClassNames"
[attr.data-value]="value"
[attr.data-action]="dataAction"
- [id]="id"
+ [id]="inputId"
[name]="name"
[attr.name]="name"
[required]="required"
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 17e7ff530a0..e6538c17b03 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
@@ -94,7 +94,7 @@ export class OpBasicSingleDatePickerComponent implements ControlValueAccessor, O
// interfere when calling the html id attribute of the component. The component would still
// get an id attribute assigned if provided when declaring the component, but it will not
// programatically overwrite the id accessor from angular.
- id = `flatpickr-input-${+(new Date())}`;
+ @Input() inputId = `flatpickr-input-${+(new Date())}`;
@Input() name = '';
@@ -168,7 +168,7 @@ export class OpBasicSingleDatePickerComponent implements ControlValueAccessor, O
private initializeDatePicker() {
this.datePickerInstance = new DatePicker(
this.injector,
- this.id,
+ this.inputId,
this.value || '',
{
allowInput: true,
diff --git a/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.html b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.html
index c586528f5d6..f7d56f1d2e9 100644
--- a/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.html
+++ b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.html
@@ -12,7 +12,7 @@
type="text"
class="spot-input"
[attr.data-value]="value"
- [id]="id"
+ [id]="inputId"
[ngModel]="value"
(ngModelChange)="changeValueFromInputDebounced($event)"
(click)="onInputClick($event)"
diff --git a/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.ts
index 01c1653d650..dbf788d2a06 100644
--- a/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.ts
+++ b/frontend/src/app/shared/components/datepicker/modal-single-date-picker/modal-single-date-picker.component.ts
@@ -83,7 +83,7 @@ export class OpModalSingleDatePickerComponent implements ControlValueAccessor, O
return this._value;
}
- @Input() id = `flatpickr-input-${+(new Date())}`;
+ @Input() inputId = `flatpickr-input-${+(new Date())}`;
@Input() name = '';
@@ -229,7 +229,7 @@ export class OpModalSingleDatePickerComponent implements ControlValueAccessor, O
this.datePickerInstance = new DatePicker(
this.injector,
- this.id,
+ this.inputId,
this.workingDate || '',
{
mode: 'single',
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts
index 0bb38e91a2f..746f860d7f3 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component.ts
@@ -40,7 +40,7 @@ import { TimezoneService } from 'core-app/core/datetime/timezone.service';
(keydown.enter)="handler.handleUserSubmit()"
(picked)="handler.handleUserSubmit()"
class="inline-edit--field"
- [id]="handler.htmlId"
+ [inputId]="handler.htmlId"
[required]="required"
[disabled]="inFlight"
[opAutofocus]="autofocus"
diff --git a/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html b/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html
index dcfecb162f6..1c54122b0cc 100644
--- a/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html
+++ b/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.html
@@ -20,7 +20,7 @@
class="op-non-working-days-list--add-button"
>
<op-modal-single-date-picker
- id="test"
+ inputId="test"
name="test"
[showIgnoreNonWorkingDays]="false"
[opened]="datepickerOpened"
diff --git a/lib/primer/open_project/forms/date_picker.html.erb b/lib/primer/open_project/forms/date_picker.html.erb
index 147f06d4284..461527ede4a 100644
--- a/lib/primer/open_project/forms/date_picker.html.erb
+++ b/lib/primer/open_project/forms/date_picker.html.erb
@@ -41,7 +41,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= 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),
inputs: @datepicker_options.merge(
- id: @datepicker_options.fetch(:id) { builder.field_id(@input.name) },
+ inputId: @datepicker_options.fetch(:id) { builder.field_id(@input.name) },
name: @datepicker_options.fetch(:name) { builder.field_name(@input.name) },
value: @datepicker_options.fetch(:value) { @input.input_arguments[:value] || builder.object&.send(@input.name) },
inputClassNames: @datepicker_options.fetch(:class) { @input.input_arguments[:class] },
diff --git a/lib/tabular_form_builder.rb b/lib/tabular_form_builder.rb
index bb6f823c934..c42f8d8d4b9 100644
--- a/lib/tabular_form_builder.rb
+++ b/lib/tabular_form_builder.rb
@@ -101,7 +101,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
inputs = {
value: @object.public_send(field),
- id: field_id(field, index: options[:index]),
+ inputId: field_id(field, index: options[:index]),
name: options[:name] || field_name(field, index: options[:index])
}
diff --git a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb b/modules/backlogs/app/views/rb_sprints/_sprint.html.erb
index af87f44bda9..6bc67f9092e 100644
--- a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb
+++ b/modules/backlogs/app/views/rb_sprints/_sprint.html.erb
@@ -56,14 +56,14 @@ See COPYRIGHT and LICENSE files for more details.
inputs: {
value: sprint.effective_date,
inputClassNames: "effective_date editor",
- id: "effective_date_#{sprint.id}",
+ inputId: "effective_date_#{sprint.id}",
name: :effective_date
} %>
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: sprint.start_date,
inputClassNames: "start_date editor",
- id: "start_date_#{sprint.id}",
+ inputId: "start_date_#{sprint.id}",
name: :start_date
} %>
<%= text_field_tag :name,
diff --git a/modules/costs/app/views/admin/cost_types/index.html.erb b/modules/costs/app/views/admin/cost_types/index.html.erb
index d42a9fae344..86186af349d 100644
--- a/modules/costs/app/views/admin/cost_types/index.html.erb
+++ b/modules/costs/app/views/admin/cost_types/index.html.erb
@@ -65,7 +65,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: @fixed_date,
- id: :start_date,
+ inputId: :start_date,
name: :fixed_date
} %>
</div>
diff --git a/modules/reporting/lib/widget/filters/date.rb b/modules/reporting/lib/widget/filters/date.rb
index 300c23d9ad6..1b283203c42 100644
--- a/modules/reporting/lib/widget/filters/date.rb
+++ b/modules/reporting/lib/widget/filters/date.rb
@@ -44,7 +44,7 @@ class Widget::Filters::Date < Widget::Filters::Base
text1 = angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: filter.values.first.to_s,
- id: "#{id_prefix}arg_1_val",
+ inputId: "#{id_prefix}arg_1_val",
name:
}
label1 + text1
@@ -58,7 +58,7 @@ class Widget::Filters::Date < Widget::Filters::Base
text2 = angular_component_tag "opce-basic-single-date-picker",
inputs: {
value: filter.values.second.to_s,
- id: "#{id_prefix}arg_2_val",
+ inputId: "#{id_prefix}arg_2_val",
name: name.to_s
}
label2 + text2
diff --git a/spec/lib/custom_field_form_builder_spec.rb b/spec/lib/custom_field_form_builder_spec.rb
index 4eac6fc9a78..207552323d5 100644
--- a/spec/lib/custom_field_form_builder_spec.rb
+++ b/spec/lib/custom_field_form_builder_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe CustomFieldFormBuilder do
<opce-basic-single-date-picker
class="custom-class"
data-value="null"
- data-id='"user_custom_field_#{custom_field.id}"'
+ data-input-id='"user_custom_field_#{custom_field.id}"'
data-name='"user[#{custom_field.id}]"'
></opce-basic-single-date-picker>
HTML