Project

General

Profile

Defect #30027 » 0001-Add-wiki-class-also-for-half-width-custom-fields-wit.patch

Marius BĂLTEANU, 2018-11-25 19:32

View differences:

app/helpers/issues_helper.rb
82 82
    s << '<div>'
83 83
    subject = h(issue.subject)
84 84
    if issue.is_private?
85
      subject = subject + ' ' + content_tag('span', l(:field_is_private), :class => 'private') 
85
      subject = subject + ' ' + content_tag('span', l(:field_is_private), :class => 'private')
86 86
    end
87 87
    s << content_tag('h3', subject)
88 88
    s << '</div>' * (ancestors.size + 1)
......
234 234
    issue_fields_rows do |rows|
235 235
      values.each_with_index do |value, i|
236 236
        css = "cf_#{value.custom_field.id}"
237
        attr_value = show_value(value)
238
        if value.custom_field.text_formatting == 'full'
239
          attr_value = content_tag('div', attr_value, class: 'wiki')
240
        end
237 241
        m = (i < half ? :left : :right)
238
        rows.send m, custom_field_name_tag(value.custom_field), show_value(value), :class => css
242
        rows.send m, custom_field_name_tag(value.custom_field), attr_value, :class => css
239 243
      end
240 244
    end
241 245
  end
test/functional/issues_controller_test.rb
2135 2135
    assert_select "div.description ~ div.attribute.cf_#{field.id} div.value", :text => 'This is a long text'
2136 2136
  end
2137 2137

  
2138
  def test_show_custom_fields_with_full_text_formatting_should_be_rendered_using_wiki_class
2139
    half_field = IssueCustomField.create!(:name => 'Half width field', :field_format => 'text', :tracker_ids => [1],
2140
      :is_for_all => true, :text_formatting => 'full')
2141
    full_field = IssueCustomField.create!(:name => 'Full width field', :field_format => 'text', :full_width_layout => '1',
2142
      :tracker_ids => [1], :is_for_all => true, :text_formatting => 'full')
2143

  
2144
    issue = Issue.find(1)
2145
    issue.custom_field_values = {full_field.id => 'This is a long text', half_field.id => 'This is a short text'}
2146
    issue.save!
2147

  
2148
    get :show, :params => {
2149
        :id => 1
2150
      }
2151
    assert_response :success
2152

  
2153
    assert_select "div.attribute.cf_#{half_field.id} div.value div.wiki", 1
2154
    assert_select "div.attribute.cf_#{full_field.id} div.value div.wiki", 1
2155
  end
2156

  
2138 2157
  def test_show_with_multi_user_custom_field
2139 2158
    field = IssueCustomField.create!(:name => 'Multi user', :field_format => 'user', :multiple => true,
2140 2159
      :tracker_ids => [1], :is_for_all => true)
(2-2/2)