2019-07-01 16:14:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DrawResultAsset
|
|
|
|
def draw_result_asset(subject)
|
|
|
|
result = Result.find_by_id(subject['id']['result_id'])
|
|
|
|
return unless result
|
|
|
|
|
|
|
|
asset = result.asset
|
|
|
|
timestamp = asset.created_at
|
2019-07-08 18:51:26 +08:00
|
|
|
color = @color
|
2019-07-01 16:14:16 +08:00
|
|
|
@docx.p
|
|
|
|
@docx.p do
|
2019-07-12 19:48:14 +08:00
|
|
|
text result.name, italic: true
|
2019-07-08 18:51:26 +08:00
|
|
|
text ' ' + I18n.t('search.index.archived'), color: color[:gray] if result.archived?
|
2019-08-09 20:56:00 +08:00
|
|
|
text ' ' + I18n.t('projects.reports.elements.result_asset.file_name', file: asset.file_name)
|
2019-07-12 19:48:14 +08:00
|
|
|
text ' ' + I18n.t('projects.reports.elements.result_asset.user_time',
|
2019-09-12 15:02:45 +08:00
|
|
|
user: result.user.full_name, timestamp: I18n.l(timestamp, format: :full)), color: color[:gray]
|
2019-07-01 16:14:16 +08:00
|
|
|
end
|
|
|
|
|
2019-09-12 15:02:45 +08:00
|
|
|
asset_image_preparing(asset) if asset.image?
|
2019-07-01 16:14:16 +08:00
|
|
|
|
|
|
|
subject['children'].each do |child|
|
|
|
|
public_send("draw_#{child['type_of']}", child)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|