Merge pull request #3287 from aignatov-bio/ai-sci-5686-add-default-scinote-report-template

Add Scinote Report Template [SCI-5686]
This commit is contained in:
Alex Kriuchykhin 2021-05-06 10:59:33 +02:00 committed by GitHub
commit 57c90a60c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 82 deletions

View file

@ -22,33 +22,3 @@ thead {
display: table-row-group;
}
.print-header-body {
.print-header {
line-height: 50px;
.logo-img {
display: inline-block;
margin: 0 0 0 30px;
img {
width: 100px;
}
}
.page-numbers {
display: inline-block;
float: right;
margin: 0 30px 0 0;
white-space: nowrap;
}
}
}
.print-footer-body {
.print-footer {
line-height: 50px;
margin-right: 30px;
text-align: right;
}
}

View file

@ -31,10 +31,10 @@ module Reports
file << renderer.render(
pdf: 'report', header: { html: { template: "reports/templates/#{template_name}/header",
locals: { report: report },
locals: { report: report, user: user },
layout: 'reports/footer_header.html.erb' } },
footer: { html: { template: "reports/templates/#{template_name}/footer",
locals: { report: report },
locals: { report: report, user: user },
layout: 'reports/footer_header.html.erb' } },
assigns: { settings: report.settings },
locals: { report: report },
@ -104,6 +104,11 @@ module Reports
end
def prepend_title_page(file, template_name, report, renderer)
unless File.exists?(Rails.root.join('app', 'views', 'reports', 'templates', template_name, 'cover.html.erb'))
return file
end
total_pages = 0
IO.popen(['pdfinfo', file.path], 'r+') do |f|

View file

@ -1,17 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset='utf-8' />
<%= wicked_pdf_stylesheet_link_tag "application" %>
<%= wicked_pdf_stylesheet_link_tag "reports_pdf" %>
<%= bootstrap_cdn_link_tag %>
<%= font_awesome_cdn_link_tag %>
</head>
<body class="print-footer-body" style="height: 50px">
<div class="print-footer">
<p>
<%= t('projects.reports.new.generate_PDF.generated_on', timestamp: current_time) %>
</p>
</div>
</body>
</html>

View file

@ -1,33 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset='utf-8' />
<%= wicked_pdf_stylesheet_link_tag "application" %>
<%= wicked_pdf_stylesheet_link_tag "reports_pdf" %>
<%= bootstrap_cdn_link_tag %>
<%= font_awesome_cdn_link_tag %>
<script>
function number_pages() {
var vars={};
var x=document.location.search.substring(1).split('&');
for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = decodeURIComponent(z[1]);}
var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
for(var i in x) {
var y = document.getElementsByClassName(x[i]);
for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
}
}
</script>
</head>
<body class="print-header-body" onload="number_pages()" style="height: 50px;">
<div class="print-header">
<div class="logo-img">
<%= image_tag wicked_pdf_asset_base64('logo.png') %>
</div>
<div class="page-numbers">
Page <span class="page"></span> of <span class="topage"></span>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,15 @@
<style>
.print-footer {
line-height: 50px;
margin-right: 30px;
text-align: right;
}
</style>
<div class="print-footer">
<p>
<% Time.zone = user.settings.dig(:time_zone) || 'UTC' %>
<%= t('projects.reports.new.generate_PDF.generated_on', timestamp: I18n.l(Time.zone.now, format: :full)) %>
</p>
</div>

View file

@ -0,0 +1,29 @@
<style>
.print-header {
line-height: 50px;
}
.logo-img {
display: inline-block;
margin: 0 0 0 30px;
}
img {
width: 100px;
}
.page-numbers {
display: inline-block;
float: right;
margin: 0 30px 0 0;
white-space: nowrap;
}
</style>
<div class="print-header">
<div class="logo-img">
<%= image_tag wicked_pdf_asset_base64('logo.png') %>
</div>
<div class="page-numbers pagination" data-page-offset="0">
Page <span class="page"></span> of <span class="topage"></span>
</div>
</div>

View file

@ -0,0 +1 @@
SciNote Template

View file

@ -421,6 +421,7 @@ class Extends
]
REPORT_TEMPLATES = {
scinote_template: 'scinote_template',
template_1: 'template_1',
template_2: 'template_2',
template_3: 'template_3'