mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-13 08:34:49 +08:00
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:
commit
57c90a60c4
8 changed files with 53 additions and 82 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
15
app/views/reports/templates/scinote_template/footer.html.erb
Normal file
15
app/views/reports/templates/scinote_template/footer.html.erb
Normal 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>
|
29
app/views/reports/templates/scinote_template/header.html.erb
Normal file
29
app/views/reports/templates/scinote_template/header.html.erb
Normal 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>
|
1
app/views/reports/templates/scinote_template/name.txt
Normal file
1
app/views/reports/templates/scinote_template/name.txt
Normal file
|
@ -0,0 +1 @@
|
|||
SciNote Template
|
|
@ -421,6 +421,7 @@ class Extends
|
|||
]
|
||||
|
||||
REPORT_TEMPLATES = {
|
||||
scinote_template: 'scinote_template',
|
||||
template_1: 'template_1',
|
||||
template_2: 'template_2',
|
||||
template_3: 'template_3'
|
||||
|
|
Loading…
Add table
Reference in a new issue