]> source.dussan.org Git - redmine.git/commitdiff
Add wiki class also for half width custom fields with text formatting enabled (#30027).
authorGo MAEDA <maeda@farend.jp>
Mon, 26 Nov 2018 00:23:08 +0000 (00:23 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 26 Nov 2018 00:23:08 +0000 (00:23 +0000)
Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@17634 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb
test/functional/issues_controller_test.rb

index da2b8ec1300eb88a8b2d696986ecfc0195909fa9..654f18e01eba18bfd64291bcea7a8fd091720558 100644 (file)
@@ -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
index 62d96bd10b1df2e114a9696c155ac650f1d7a714..901907347c9663419267dbb00d5421e2b5935a01 100644 (file)
@@ -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)