2019-07-01 16:14:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-09-17 16:50:01 +08:00
|
|
|
module Reports::Docx::DrawExperiment
|
2019-07-01 16:14:16 +08:00
|
|
|
def draw_experiment(subject)
|
|
|
|
color = @color
|
|
|
|
link_style = @link_style
|
|
|
|
scinote_url = @scinote_url
|
|
|
|
experiment = Experiment.find_by_id(subject['id']['experiment_id'])
|
|
|
|
return unless experiment
|
|
|
|
|
2019-07-12 19:48:14 +08:00
|
|
|
@docx.h2 experiment.name, size: Constants::REPORT_DOCX_EXPERIMENT_TITLE_SIZE
|
2019-07-01 16:14:16 +08:00
|
|
|
@docx.p do
|
|
|
|
text I18n.t('projects.reports.elements.experiment.user_time',
|
|
|
|
timestamp: I18n.l(experiment.created_at, format: :full)), color: color[:gray]
|
2019-07-12 17:38:48 +08:00
|
|
|
if experiment.archived?
|
|
|
|
text ' | '
|
|
|
|
text I18n.t('search.index.archived'), color: color[:gray]
|
|
|
|
end
|
2019-07-01 16:14:16 +08:00
|
|
|
text ' | '
|
2019-07-08 18:51:26 +08:00
|
|
|
link I18n.t('projects.reports.elements.all.scinote_link'),
|
2019-07-01 16:14:16 +08:00
|
|
|
scinote_url + Rails.application.routes.url_helpers.canvas_experiment_path(experiment),
|
|
|
|
link_style
|
|
|
|
end
|
|
|
|
html = custom_auto_link(experiment.description, team: @report_team)
|
|
|
|
html_to_word_converter(html)
|
|
|
|
@docx.p
|
|
|
|
subject['children'].each do |child|
|
|
|
|
public_send("draw_#{child['type_of']}", child)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|