2019-07-01 16:14:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-09-17 16:50:01 +08:00
|
|
|
module Reports::Docx::DrawResultAsset
|
2020-07-21 20:11:42 +08:00
|
|
|
def draw_result_asset(subject, my_module)
|
|
|
|
result = my_module.results.find_by(id: subject['id']['result_id'])
|
2019-07-01 16:14:16 +08:00
|
|
|
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|
|
2020-07-21 20:11:42 +08:00
|
|
|
public_send("draw_#{child['type_of']}", child, result)
|
2019-07-01 16:14:16 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|