mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-12 18:05:18 +08:00
2793777463
* Initial setup for docx report * Add render for project, experiment, my_module * Implement converter for RTE fields * Add all report elements * fix markup * Change headers, remove empty blocks, refactored repository draw * Add smart annotations support * Fix justify fields * Prepare for addons integration * Fix markup * Add comments to GemFile * Fix TinyMCE error * Change UI for new report download selector * Fix file error in inventory cell for docx * Fix i18n object for header
27 lines
875 B
Ruby
27 lines
875 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DrawExperiment
|
|
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
|
|
|
|
@docx.h2 experiment.name
|
|
@docx.p do
|
|
text I18n.t('projects.reports.elements.experiment.user_time',
|
|
timestamp: I18n.l(experiment.created_at, format: :full)), color: color[:gray]
|
|
text ' | '
|
|
link 'SciNote Link',
|
|
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
|