2019-07-01 16:14:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-09-17 16:50:01 +08:00
|
|
|
module Reports::Docx::DrawMyModuleActivity
|
2020-07-21 20:11:42 +08:00
|
|
|
def draw_my_module_activity(subject, my_module)
|
2019-07-01 16:14:16 +08:00
|
|
|
return unless my_module
|
|
|
|
|
|
|
|
activities = ActivitiesService.my_module_activities(my_module).order(created_at: subject['sort_order'])
|
|
|
|
|
|
|
|
return false unless activities.any?
|
|
|
|
|
2019-07-08 18:51:26 +08:00
|
|
|
color = @color
|
2019-07-01 16:14:16 +08:00
|
|
|
@docx.p
|
2019-07-12 19:48:14 +08:00
|
|
|
@docx.p I18n.t('projects.reports.elements.module_activity.name', my_module: my_module.name),
|
|
|
|
bold: true, size: Constants::REPORT_DOCX_STEP_ELEMENTS_TITLE_SIZE
|
2019-07-01 16:14:16 +08:00
|
|
|
activities.each do |activity|
|
|
|
|
activity_ts = activity.created_at
|
|
|
|
activity_text = if activity.old_activity?
|
|
|
|
sanitize_input(activity.message)
|
|
|
|
else
|
|
|
|
sanitize_input(generate_activity_content(activity, true))
|
|
|
|
end
|
2019-07-08 18:51:26 +08:00
|
|
|
@docx.p I18n.l(activity_ts, format: :full), color: color[:gray]
|
2020-10-13 19:54:16 +08:00
|
|
|
Reports::HtmlToWordConverter.new(@docx).html_to_word_converter(activity_text)
|
2019-07-01 16:14:16 +08:00
|
|
|
@docx.p
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|