Vote #79225
未完了fields_for produces a broken <label for=“”> value
ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
UI_10
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:
0%
予定工数:
Redmineorg_URL:
category_id:
10
version_id:
0
issue_org_id:
28447
author_id:
344207
assigned_to_id:
0
comments:
0
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
132
説明
Here's some code from the @redmine_people@ plugin illustrating the problem:
<%= f.fields_for :information do |information| %> <p><%= information.text_field :middlename, :label => l(:label_people_middlename) %></p> <p><%= f.text_field :lastname, :required => true %></p>
Then one of the fields declares a label:
<p><%= information.select :gender, Person.get_genders, :label => l(:label_people_gender)%></p>
That generates this HTML:
<p><label for="person[information_attributes]_gender">Gender</label> <select name="person[information_attributes][gender]" id="person_information_attributes_gender"> <option selected="selected" value="0">Male</option> <option value="1">Female</option> </select></p>
The @
The bug comes from this statement in LabelledFormBuilder:
@template.content_tag("label", text.html_safe,
:class => (@object && @object.errors[field].present? ? "error" : nil),
:for => (@object_name.to_s + "_" + field.to_s))
The @object_name@ has @[]@ in it, so something should replace them with "_".
いいね!0