Project

General

Profile

Defect #25726 » 0001-do-not-display-default-values-that-aren-t-actually-s.patch

patch against trunk (better than the one in #21074) - Jens Krämer, 2017-04-28 17:07

View differences:

app/helpers/issues_helper.rb
242 242
  def render_half_width_custom_fields_rows(issue)
243 243
    values = issue.visible_custom_field_values.reject {|value| value.custom_field.full_width_layout?}
244 244
    return if values.empty?
245

  
246
    existing_custom_field_ids = issue.custom_values.pluck(:custom_field_id)
245 247
    half = (values.size / 2.0).ceil
246 248
    issue_fields_rows do |rows|
247 249
      values.each_with_index do |value, i|
248 250
        css = "cf_#{value.custom_field.id}"
249 251
        m = (i < half ? :left : :right)
250
        rows.send m, custom_field_name_tag(value.custom_field), show_value(value), :class => css
252
        if existing_custom_field_ids.include?(value.custom_field.id)
253
          content = show_value(value)
254
        end
255
        rows.send m, custom_field_name_tag(value.custom_field), content, :class => css
251 256
      end
252 257
    end
253 258
  end
......
256 261
    values = issue.visible_custom_field_values.select {|value| value.custom_field.full_width_layout?}
257 262
    return if values.empty?
258 263

  
264
    existing_custom_field_ids = issue.custom_values.pluck(:custom_field_id)
259 265
    s = ''.html_safe
260 266
    values.each_with_index do |value, i|
261
      attr_value = show_value(value)
267
      if existing_custom_field_ids.include?(value.custom_field.id)
268
        attr_value = show_value(value)
269
      end
262 270
      next if attr_value.blank?
263 271

  
264 272
      if value.custom_field.text_formatting == 'full'
    (1-1/1)