diff --git a/app/models/project.rb b/app/models/project.rb index 9856e3e5a..104925380 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,4 +1,7 @@ class Project < ApplicationRecord + ID_PREFIX = 'PR' + + include PrefixedIdModel include ArchivableModel include SearchableModel include SearchableByNameModel diff --git a/app/services/reports/docx/draw_my_module.rb b/app/services/reports/docx/draw_my_module.rb index c377af53c..b5d9b4415 100644 --- a/app/services/reports/docx/draw_my_module.rb +++ b/app/services/reports/docx/draw_my_module.rb @@ -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 ' | ' diff --git a/app/services/reports/docx/draw_my_module_protocol.rb b/app/services/reports/docx/draw_my_module_protocol.rb index a9523373c..f712817c9 100644 --- a/app/services/reports/docx/draw_my_module_protocol.rb +++ b/app/services/reports/docx/draw_my_module_protocol.rb @@ -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, diff --git a/app/services/reports/docx/draw_project_header.rb b/app/services/reports/docx/draw_project_header.rb index e311e1848..12852214c 100644 --- a/app/services/reports/docx/draw_project_header.rb +++ b/app/services/reports/docx/draw_project_header.rb @@ -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 diff --git a/app/views/reports/elements/_my_module_element.html.erb b/app/views/reports/elements/_my_module_element.html.erb index bbd06a841..b7181256d 100644 --- a/app/views/reports/elements/_my_module_element.html.erb +++ b/app/views/reports/elements/_my_module_element.html.erb @@ -10,7 +10,7 @@ <% end %>
- <%= 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)) %>

<% if my_module.started_on.present? %> diff --git a/app/views/reports/elements/_my_module_protocol_element.html.erb b/app/views/reports/elements/_my_module_protocol_element.html.erb index b53628d4b..a3e84d710 100644 --- a/app/views/reports/elements/_my_module_protocol_element.html.erb +++ b/app/views/reports/elements/_my_module_protocol_element.html.erb @@ -10,7 +10,7 @@ <% end %>

- <%= 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)) %>
<% if @settings.dig('task', 'protocol', 'description') && protocol.description.present? %> diff --git a/app/views/reports/elements/_project_header_element.html.erb b/app/views/reports/elements/_project_header_element.html.erb index d4a0012b5..54ad6a629 100644 --- a/app/views/reports/elements/_project_header_element.html.erb +++ b/app/views/reports/elements/_project_header_element.html.erb @@ -8,7 +8,7 @@ <% end %>
- <%= 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)) %>
<% if defined?(children) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b8d5bba76..7ed3fa67a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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"