summaryrefslogtreecommitdiffstats
path: root/app/helpers/custom_fields_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-06 21:17:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-06 21:17:16 +0000
commit3bb7524c1f282827331a31db3731fc2459d05186 (patch)
tree481597fd97dbd82c931ec4ef6e0c0a3fad5860bf /app/helpers/custom_fields_helper.rb
parentba4744d4c48e21f3f640fca860993e36998e943d (diff)
downloadredmine-3bb7524c1f282827331a31db3731fc2459d05186.tar.gz
redmine-3bb7524c1f282827331a31db3731fc2459d05186.zip
Merged r16574 (#25760).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16621 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/custom_fields_helper.rb')
-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