2019-07-01 16:14:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-09-17 16:50:01 +08:00
|
|
|
module Reports::Docx::DrawResultText
|
2023-09-14 10:25:38 +08:00
|
|
|
def draw_result_text(element)
|
|
|
|
result = element.result
|
2023-09-18 21:01:13 +08:00
|
|
|
result_text = element.orderable
|
2019-07-01 16:14:16 +08:00
|
|
|
timestamp = result.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
|
2023-09-29 18:18:45 +08:00
|
|
|
text result.name.presence || I18n.t('projects.reports.unnamed'), italic: true
|
2022-08-02 16:06:00 +08:00
|
|
|
text " #{I18n.t('search.index.archived')} ", bold: true if result.archived?
|
2019-07-01 16:14:16 +08:00
|
|
|
text ' '
|
|
|
|
text I18n.t('projects.reports.elements.result_table.user_time',
|
2019-07-08 18:51:26 +08:00
|
|
|
timestamp: I18n.l(timestamp, format: :full), user: result.user.full_name), color: color[:gray]
|
2019-07-01 16:14:16 +08:00
|
|
|
end
|
|
|
|
html = custom_auto_link(result_text.text, team: @report_team)
|
2020-10-14 22:09:49 +08:00
|
|
|
Reports::HtmlToWordConverter.new(@docx, { scinote_url: @scinote_url,
|
|
|
|
link_style: @link_style }).html_to_word_converter(html)
|
2019-07-01 16:14:16 +08:00
|
|
|
|
2021-05-21 22:35:23 +08:00
|
|
|
draw_result_comments(result) if @settings.dig('task', 'result_comments')
|
2019-07-01 16:14:16 +08:00
|
|
|
end
|
|
|
|
end
|