summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-04-25 08:01:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-04-25 08:01:07 +0000
commit1c8527b8c166d375f208115caf764c9694310318 (patch)
treeeb8e85625f44615ff07912bd71a3677b66e9dc45
parent5fced3a7033335f56bba679238261da0054b327a (diff)
downloadredmine-1c8527b8c166d375f208115caf764c9694310318.tar.gz
redmine-1c8527b8c166d375f208115caf764c9694310318.zip
Merged r14215 (#19482).
git-svn-id: http://svn.redmine.org/redmine/branches/3.0-stable@14216 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/field_format.rb10
-rw-r--r--test/functional/projects_controller_test.rb9
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index 8cb3bc45d..05a329dbf 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -300,10 +300,14 @@ module Redmine
def formatted_value(view, custom_field, value, customized=nil, html=false)
if html
- if custom_field.text_formatting == 'full'
- view.textilizable(value, :object => customized)
+ if value.present?
+ if custom_field.text_formatting == 'full'
+ view.textilizable(value, :object => customized)
+ else
+ view.simple_format(html_escape(value))
+ end
else
- view.simple_format(html_escape(value))
+ ''
end
else
value.to_s
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index fa86f1a0f..70c32c5f0 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -363,6 +363,15 @@ class ProjectsControllerTest < ActionController::TestCase
assert_select 'li', :text => /#{f2.name}/
end
+ def test_show_should_not_display_blank_text_custom_fields
+ f1 = ProjectCustomField.generate! :field_format => 'text'
+
+ get :show, :id => 1
+ assert_response :success
+
+ assert_select 'li', :text => /#{f1.name}/, :count => 0
+ end
+
def test_show_should_not_fail_when_custom_values_are_nil
project = Project.find_by_identifier('ecookbook')
project.custom_values.first.update_attribute(:value, nil)