Add IDs to pdf and docx reports [SCI-7200]

This commit is contained in:
Giga Chubinidze 2022-11-29 11:38:08 +04:00
parent fdc8d8ef24
commit 8d97641110
8 changed files with 12 additions and 9 deletions

View file

@ -1,4 +1,7 @@
class Project < ApplicationRecord
ID_PREFIX = 'PR'
include PrefixedIdModel
include ArchivableModel
include SearchableModel
include SearchableByNameModel

View file

@ -16,7 +16,7 @@ module Reports::Docx::DrawMyModule
end
@docx.p do
text I18n.t('projects.reports.elements.module.user_time',
text I18n.t('projects.reports.elements.module.user_time', code: my_module.code,
timestamp: I18n.l(my_module.created_at, format: :full)), color: color[:gray]
if my_module.archived?
text ' | '

View file

@ -12,7 +12,7 @@ module Reports::Docx::DrawMyModuleProtocol
end
if @settings.dig('task', 'protocol', 'description') && protocol.description.present?
@docx.p I18n.t('projects.reports.elements.module.protocol.user_time',
@docx.p I18n.t('projects.reports.elements.module.protocol.user_time', code: protocol.code,
timestamp: I18n.l(protocol.created_at, format: :full)), color: @color[:gray]
html = custom_auto_link(protocol.description, team: @report_team)
Reports::HtmlToWordConverter.new(@docx, { scinote_url: @scinote_url,

View file

@ -16,7 +16,7 @@ module Reports::Docx::DrawProjectHeader
end
@docx.p do
text I18n.t('projects.reports.elements.project_header.user_time',
text I18n.t('projects.reports.elements.project_header.user_time', code: project.code,
timestamp: I18n.l(project.created_at, format: :full)), color: color[:gray]
br
br

View file

@ -10,7 +10,7 @@
<% end %>
</h4>
<div class="user-time">
<%= t('projects.reports.elements.module.user_time', timestamp: l(timestamp, format: :full)) %>
<%= t('projects.reports.elements.module.user_time', code: my_module.code, timestamp: l(timestamp, format: :full)) %>
</div>
<p class="module-start-date">
<% if my_module.started_on.present? %>

View file

@ -10,7 +10,7 @@
<% end %>
</div>
<div class="user-time">
<%= t('projects.reports.elements.module.protocol.user_time', timestamp: l(protocol.created_at, format: :full)) %>
<%= t('projects.reports.elements.module.protocol.user_time', code: protocol.code, timestamp: l(protocol.created_at, format: :full)) %>
</div>
<div class="row module-protocol-description">
<% if @settings.dig('task', 'protocol', 'description') && protocol.description.present? %>

View file

@ -8,7 +8,7 @@
<% end %>
</h2>
<div class="user-time">
<%= t('projects.reports.elements.project_header.user_time', timestamp: l(project.created_at, format: :full)) %>
<%= t('projects.reports.elements.project_header.user_time', code: project.code, timestamp: l(project.created_at, format: :full)) %>
</div>
</div>
<% if defined?(children) %>

View file

@ -721,10 +721,10 @@ en:
remove: "Remove report element from the report"
scinote_link: "SciNote link"
project_header:
user_time: "Project created on %{timestamp}."
user_time: "Project %{code} created on %{timestamp}."
title: "Report for project %{project}"
module:
user_time: "Task created on %{timestamp}."
user_time: "Task %{code} created on %{timestamp}."
started_on: "Start date: %{started_on}"
status: "Status:"
no_start_date: "No start date"
@ -736,7 +736,7 @@ en:
results: "Results"
protocol:
name: 'Protocol'
user_time: "Protocol created on %{timestamp}."
user_time: "Protocol %{code} created on %{timestamp}."
experiment:
user_time: "Experiment %{code} created on %{timestamp}."
no_description: "No description"