From 31b084d1f5c44b97fe0d24b720f9269e863bede0 Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Sun, 25 Nov 2018 18:27:37 +0000 Subject: [PATCH] Add wiki class also for half width custom fields with text formatting enabled --- app/helpers/issues_helper.rb | 8 ++++++-- test/functional/issues_controller_test.rb | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index e1e0fc5..654f18e 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -82,7 +82,7 @@ module IssuesHelper s << '
' subject = h(issue.subject) if issue.is_private? - subject = subject + ' ' + content_tag('span', l(:field_is_private), :class => 'private') + subject = subject + ' ' + content_tag('span', l(:field_is_private), :class => 'private') end s << content_tag('h3', subject) s << '
' * (ancestors.size + 1) @@ -234,8 +234,12 @@ module IssuesHelper issue_fields_rows do |rows| values.each_with_index do |value, i| css = "cf_#{value.custom_field.id}" + attr_value = show_value(value) + if value.custom_field.text_formatting == 'full' + attr_value = content_tag('div', attr_value, class: 'wiki') + end m = (i < half ? :left : :right) - rows.send m, custom_field_name_tag(value.custom_field), show_value(value), :class => css + rows.send m, custom_field_name_tag(value.custom_field), attr_value, :class => css end end end diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 62d96bd..9019073 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2135,6 +2135,25 @@ class IssuesControllerTest < Redmine::ControllerTest assert_select "div.description ~ div.attribute.cf_#{field.id} div.value", :text => 'This is a long text' end + def test_show_custom_fields_with_full_text_formatting_should_be_rendered_using_wiki_class + half_field = IssueCustomField.create!(:name => 'Half width field', :field_format => 'text', :tracker_ids => [1], + :is_for_all => true, :text_formatting => 'full') + full_field = IssueCustomField.create!(:name => 'Full width field', :field_format => 'text', :full_width_layout => '1', + :tracker_ids => [1], :is_for_all => true, :text_formatting => 'full') + + issue = Issue.find(1) + issue.custom_field_values = {full_field.id => 'This is a long text', half_field.id => 'This is a short text'} + issue.save! + + get :show, :params => { + :id => 1 + } + assert_response :success + + assert_select "div.attribute.cf_#{half_field.id} div.value div.wiki", 1 + assert_select "div.attribute.cf_#{full_field.id} div.value div.wiki", 1 + end + def test_show_with_multi_user_custom_field field = IssueCustomField.create!(:name => 'Multi user', :field_format => 'user', :multiple => true, :tracker_ids => [1], :is_for_all => true) -- 2.1.4