2019-07-01 16:14:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-09-17 16:50:01 +08:00
|
|
|
module Reports::Docx::DrawProjectHeader
|
2019-07-01 16:14:16 +08:00
|
|
|
def draw_project_header(subject)
|
2021-05-21 22:35:23 +08:00
|
|
|
project = subject.project
|
2022-07-13 18:52:56 +08:00
|
|
|
link_style = @link_style
|
|
|
|
scinote_url = @scinote_url
|
2022-07-20 16:12:38 +08:00
|
|
|
color = @color
|
2022-07-13 18:52:56 +08:00
|
|
|
|
2020-07-21 20:11:42 +08:00
|
|
|
return unless project && can_read_project?(@user, project)
|
2019-07-01 16:14:16 +08:00
|
|
|
|
2022-07-13 18:52:56 +08:00
|
|
|
@docx.h1 do
|
|
|
|
link I18n.t('projects.reports.elements.project_header.title', project: project.name),
|
|
|
|
scinote_url + Rails.application.routes.url_helpers.project_path(project),
|
|
|
|
link_style
|
|
|
|
end
|
|
|
|
|
|
|
|
@docx.p do
|
|
|
|
text I18n.t('projects.reports.elements.project_header.user_time',
|
2022-07-20 16:12:38 +08:00
|
|
|
timestamp: I18n.l(project.created_at, format: :full)), color: color[:gray]
|
2022-07-13 18:52:56 +08:00
|
|
|
br
|
|
|
|
br
|
|
|
|
br
|
2019-07-01 16:14:16 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|