summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-27 08:49:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-27 08:49:08 +0000
commit335a16e4fd28ce464fb45e79fac456b5d6bf88fa (patch)
tree81859a605c55bc19178e3b667c2a2072f6a99fea /app
parent9439cae70fab58b8cafdd753aa83135d4279345d (diff)
downloadredmine-335a16e4fd28ce464fb45e79fac456b5d6bf88fa.tar.gz
redmine-335a16e4fd28ce464fb45e79fac456b5d6bf88fa.zip
Cusotom field label should not be associated to the first input (#25760).
git-svn-id: http://svn.redmine.org/redmine/trunk@16574 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/custom_fields_helper.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 3f357ab0c..617a6123d 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -96,16 +96,23 @@ module CustomFieldsHelper
# Return custom field label tag
def custom_field_label_tag(name, custom_value, options={})
required = options[:required] || custom_value.custom_field.is_required?
+ for_tag_id = options.fetch(:for_tag_id, "#{name}_custom_field_values_#{custom_value.custom_field.id}")
content = custom_field_name_tag custom_value.custom_field
content_tag "label", content +
(required ? " <span class=\"required\">*</span>".html_safe : ""),
- :for => "#{name}_custom_field_values_#{custom_value.custom_field.id}"
+ :for => for_tag_id
end
# Return custom field tag with its label tag
def custom_field_tag_with_label(name, custom_value, options={})
- custom_field_label_tag(name, custom_value, options) + custom_field_tag(name, custom_value)
+ tag = custom_field_tag(name, custom_value)
+ tag_id = nil
+ ids = tag.scan(/ id="(.+?)"/)
+ if ids.size == 1
+ tag_id = ids.first.first
+ end
+ custom_field_label_tag(name, custom_value, options.merge(:for_tag_id => tag_id)) + tag
end
# Returns the custom field tag for when bulk editing objects