WIP. config accepts custom_field property and checks model for custom fields if it's true. not tested at all.

pull/6827/head
Richard 11 years ago
parent 7575a620f8
commit ec399bc4fa
  1. 2
      app/models/export_card_configuration.rb
  2. 12
      lib/open_project/pdf_export/export_card/column_element.rb

@ -37,7 +37,7 @@ class ExportCardConfiguration < ActiveRecord::Base
REQUIRED_COLUMN_KEYS = []
VALID_COLUMN_KEYS = ["has_label", "min_font_size", "max_font_size",
"font_size", "font_style", "text_align", "minimum_lines", "render_if_empty",
"width", "indented"]
"width", "indented", "custom_field"]
def assert_required_keys(hash, valid_keys, required_keys)
hash.assert_valid_keys valid_keys

@ -35,7 +35,17 @@ module OpenProject::PdfExport::ExportCard
def draw
# Get value from model
value = @work_package.send(@property_name) if @work_package.respond_to?(@property_name) else ""
if @config['custom_field']
# Get
vs = work_package.custom_field_values.select {|cf| cf.custom_field.name == property_name}
value = if vs.first && vs.first.value
value vs.first.value
else
""
end
else
value = @work_package.send(@property_name) if @work_package.respond_to?(@property_name) else ""
end
if value.is_a?(Array)
value = value.map{|c| c.to_s }.join("\n")

Loading…
Cancel
Save