mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-25 01:04:02 +08:00
Fix CSS for generated pdf/docx reports [SCI-7660] (#4911)
* Fix CSS for generated pdf/docx reports [SCI-7660] * Call correct asset previewable function [SCI-7660]
This commit is contained in:
parent
e2da83ee6e
commit
6fcb9152dc
7 changed files with 15 additions and 9 deletions
|
@ -244,14 +244,16 @@ label {
|
|||
|
||||
/* Project header element style */
|
||||
.report-project-header-element {
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 0;
|
||||
|
||||
.report-element-header {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.report-element-body {
|
||||
.project-name {
|
||||
@include font-h1;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,7 +619,7 @@ label {
|
|||
margin: 3px 2px;
|
||||
|
||||
.activity-prefix {
|
||||
color: $color-emperor;
|
||||
color: $color-silver-chalice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ module Reports::Docx::DrawMyModule
|
|||
@docx.h4 I18n.t('Results') if my_module.results.any?
|
||||
order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result|
|
||||
if result.is_asset && @settings.dig('task', 'file_results')
|
||||
draw_result_asset(result)
|
||||
draw_result_asset(result, @settings)
|
||||
elsif result.is_table && @settings.dig('task', 'table_results')
|
||||
draw_result_table(result)
|
||||
elsif result.is_text && @settings.dig('task', 'text_results')
|
||||
|
|
|
@ -19,8 +19,6 @@ module Reports::Docx::DrawProjectHeader
|
|||
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
|
||||
br
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Reports::Docx::DrawResultAsset
|
||||
def draw_result_asset(result)
|
||||
def draw_result_asset(result, settings)
|
||||
asset = result.asset
|
||||
timestamp = asset.created_at
|
||||
asset_url = Rails.application.routes.url_helpers.asset_download_url(asset)
|
||||
|
@ -27,6 +27,10 @@ module Reports::Docx::DrawResultAsset
|
|||
text ' ' + I18n.t('projects.reports.elements.result_asset.file_name', file: asset.file_name)
|
||||
text ' ' + I18n.t('projects.reports.elements.result_asset.user_time',
|
||||
user: result.user.full_name, timestamp: I18n.l(timestamp, format: :full)), color: color[:gray]
|
||||
|
||||
if settings.dig(:task, :file_results_previews) && ActiveStorageFileUtil.previewable_document?(asset&.file&.blob)
|
||||
text " #{I18n.t('projects.reports.elements.result_asset.full_preview_attached')}", color: color[:gray]
|
||||
end
|
||||
end
|
||||
|
||||
draw_result_comments(result) if @settings.dig('task', 'result_comments')
|
||||
|
|
|
@ -20,4 +20,6 @@ module ActiveStorageFileUtil
|
|||
|
||||
previewable
|
||||
end
|
||||
|
||||
module_function :previewable_document?
|
||||
end
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<% export_all = defined?(export_all) && export_all %>
|
||||
<div class="report-element report-module-protocol-element">
|
||||
<div class="report-element-body">
|
||||
<div class="protocol-name">
|
||||
<h4 class="protocol-name">
|
||||
<% if protocol.name.present? %>
|
||||
<%= protocol.name %>
|
||||
<% else %>
|
||||
<%= t('projects.reports.elements.module.protocol.name') %>
|
||||
<% end %>
|
||||
</div>
|
||||
</h4>
|
||||
<div class="user-time">
|
||||
<%= t('projects.reports.elements.module.protocol.user_time', code: protocol.code, timestamp: l(protocol.created_at, format: :full)) %>
|
||||
</div>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
<div class="user-time">
|
||||
<%= t("projects.reports.elements.result_asset.user_time", user: result.user.full_name, timestamp: l(timestamp, format: :full)) %>
|
||||
<% if report.settings.dig(:task, :file_results_previews) %>
|
||||
<% if report.settings.dig(:task, :file_results_previews) && ActiveStorageFileUtil.previewable_document?(asset&.file&.blob) %>
|
||||
<%= t('projects.reports.elements.result_asset.full_preview_attached') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue