|
|
@ -36,8 +36,28 @@ module OpenProject::PdfExport::ExportCard |
|
|
|
def draw |
|
|
|
def draw |
|
|
|
# Get value from model |
|
|
|
# Get value from model |
|
|
|
if @work_package.respond_to?(@property_name) |
|
|
|
if @work_package.respond_to?(@property_name) |
|
|
|
value = @work_package.send(@property_name) |
|
|
|
value = extract_property |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
value = extract_custom_field |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_value(value) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def extract_property |
|
|
|
|
|
|
|
value = @work_package.send(@property_name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case @property_name.to_s |
|
|
|
|
|
|
|
when 'children' |
|
|
|
|
|
|
|
return value.to_a |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
value |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def extract_custom_field |
|
|
|
# Look in Custom Fields |
|
|
|
# Look in Custom Fields |
|
|
|
value = "" |
|
|
|
value = "" |
|
|
|
available_languages.each do |locale| |
|
|
|
available_languages.each do |locale| |
|
|
@ -49,14 +69,10 @@ module OpenProject::PdfExport::ExportCard |
|
|
|
end |
|
|
|
end |
|
|
|
@localised_custom_field_name = @custom_field.name if !!@custom_field |
|
|
|
@localised_custom_field_name = @custom_field.name if !!@custom_field |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_value(value) |
|
|
|
value |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def available_languages |
|
|
|
def available_languages |
|
|
|
Setting.available_languages |
|
|
|
Setting.available_languages |
|
|
|
end |
|
|
|
end |
|
|
|