mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 19:36:00 +01:00
Custom field (long text format) displayed even if empty (#19482).
git-svn-id: http://svn.redmine.org/redmine/trunk@14215 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -300,10 +300,14 @@ module Redmine
|
|||||||
|
|
||||||
def formatted_value(view, custom_field, value, customized=nil, html=false)
|
def formatted_value(view, custom_field, value, customized=nil, html=false)
|
||||||
if html
|
if html
|
||||||
if custom_field.text_formatting == 'full'
|
if value.present?
|
||||||
view.textilizable(value, :object => customized)
|
if custom_field.text_formatting == 'full'
|
||||||
|
view.textilizable(value, :object => customized)
|
||||||
|
else
|
||||||
|
view.simple_format(html_escape(value))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
view.simple_format(html_escape(value))
|
''
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
value.to_s
|
value.to_s
|
||||||
|
|||||||
@@ -363,6 +363,15 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||||||
assert_select 'li', :text => /#{f2.name}/
|
assert_select 'li', :text => /#{f2.name}/
|
||||||
end
|
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
|
def test_show_should_not_fail_when_custom_values_are_nil
|
||||||
project = Project.find_by_identifier('ecookbook')
|
project = Project.find_by_identifier('ecookbook')
|
||||||
project.custom_values.first.update_attribute(:value, nil)
|
project.custom_values.first.update_attribute(:value, nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user