mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
the visibility attribute with the hidden option hides the element but don't free the space. A common use case is to have a specific header for the first page and another for the other pages. With visibility: hidden the second header cannot take the first one place and will keep a huge margin. One solution is to use the display:none instead.
64 lines
3.1 KiB
XML
64 lines
3.1 KiB
XML
<odoo>
|
|
<template id="minimal_layout" inherit_id="web.minimal_layout" priority="100">
|
|
<script t-if="subst" position="replace">
|
|
<script t-if="subst">
|
|
function subst() {
|
|
var vars = {};
|
|
var x = document.location.search.substring(1).split('&');
|
|
for (var i in x) {
|
|
var z = x[i].split('=', 2);
|
|
vars[z[0]] = unescape(z[1]);
|
|
}
|
|
var x = ['sitepage', 'sitepages', 'section', 'subsection', 'subsubsection'];
|
|
var z = {'sitepage': 'page', 'sitepages': 'topage'};
|
|
for (var i in x) {
|
|
var y = document.getElementsByClassName(z[x[i]] || x[i])
|
|
for (var j=0; j<y.length; ++j)
|
|
y[j].textContent = vars[x[i]];
|
|
}
|
|
|
|
var index = vars['webpage'].split('.', 4)[3];
|
|
var header = document.getElementById('minimal_layout_report_headers');
|
|
if(header){
|
|
var companyHeader = header.children[index];
|
|
header.textContent = '';
|
|
header.appendChild(companyHeader);
|
|
}
|
|
var footer = document.getElementById('minimal_layout_report_footers');
|
|
if(footer){
|
|
var companyFooter = footer.children[index];
|
|
footer.textContent = '';
|
|
footer.appendChild(companyFooter);
|
|
}
|
|
|
|
var operations = {
|
|
'not-first-page': function (elt) {
|
|
elt.style.display = (vars.sitepage === vars.frompage) ? "none" : "inherit";
|
|
},
|
|
'not-last-page': function (elt) {
|
|
elt.style.display = (vars.sitepage === vars.sitepages) ? "none" : "inherit";
|
|
},
|
|
'first-page': function (elt) {
|
|
elt.style.display = (vars.sitepage === vars.frompage) ? "inherit" : "none";
|
|
},
|
|
'last-page': function (elt) {
|
|
elt.style.display = (vars.sitepage === vars.sitepages) ? "inherit" : "none";
|
|
},
|
|
'single-page': function (elt) {
|
|
elt.style.display = (vars.sitepages === 1) ? "inherit" : "none";
|
|
},
|
|
'multi-page': function (elt) {
|
|
elt.style.display = (vars.sitepages > 1) ? "inherit" : "none";
|
|
},
|
|
};
|
|
for (var klass in operations) {
|
|
var y = document.getElementsByClassName(klass);
|
|
for (var j=0; j<y.length; ++j)
|
|
operations[klass](y[j]);
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
</template>
|
|
</odoo>
|