style(attestation): improve rendering with almost all nodes

This commit is contained in:
Colin Darie 2023-12-20 22:11:43 +01:00
parent 16cdff8425
commit 277b4f4ec8
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
3 changed files with 81 additions and 44 deletions

View file

@ -36,22 +36,40 @@
#attestation {
@media screen {
max-width: 21cm;
padding: 17mm;
margin: 0 auto;
.a4-container {
display: flex;
flex-direction: column;
justify-content: space-between; // This will push the footer down
max-width: 21cm;
height: 29.7cm;
padding: 17mm;
margin: 0 auto;
background: #FFFFFF;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); // Optional: for better visualization
}
}
font-family: Marianne;
.header {
header {
display: flex;
justify-content: space-between;
p {
margin: 0;
}
}
.right {
text-align: right;
}
.french-state-layout & {
.right {
margin-top: 5.25mm;
}
}
.bloc-marque {
margin-bottom: 14mm;
}
@ -65,6 +83,7 @@
font-size: 12pt;
font-weight: bold;
margin: 0 0 1mm;
line-height: 12pt;
}
.devise {
@ -72,36 +91,54 @@
margin: 0;
}
.issuer {
font-size: 10pt;
margin: 0 0 14mm; // pas sur, pour mettre une marge si issuer plus bas que date
}
.direction {
font-size: 12pt;
margin: 5.25mm 0 23.3mm;
line-height: 14pt;
font-weight: bold;
margin: 0 0 23.3mm;
}
.date {
font-size: 8pt;
margin: 0 0 14mm;
}
.title {
font-size: 12pt;
font-weight: bold;
text-align: center;
margin: 0 0 12.6mm;
.body-start {
margin-top: 30mm;
}
.main {
font-size: 10pt;
.header {
&:first-of-type {
font-size: 10pt;
}
&:last-of-type {
font-size: 8pt;
}
}
}
.notice {
font-size: 10pt;
font-style: italic;
h1,
h2 {
// both titles have the same size
font-size: 12pt;
font-weight: bold;
}
h1 {
margin: 14mm 0 8mm;
}
h2 {
margin: 0;
line-height: 6pt;
}
h3 {
font-size: 8pt;
font-weight: normal;
line-height: 3pt;
}
li p {
margin: 0.25rem 0;
}
.footer {

View file

@ -107,6 +107,10 @@ class AttestationTemplate < ApplicationRecord
self.json_body = JSON.parse(json)
end
def french_state_layout?
label_logo.present?
end
private
def signature_to_render(groupe_instructeur)

View file

@ -1,23 +1,19 @@
= image_tag('centered_marianne.svg', alt: '', class: 'marianne')
.header
.left
- if @attestation_template.label_logo.present?
.bloc-marque
= simple_format @attestation_template.label_logo, class: "intitule"
= image_tag('liberte2.svg', alt: '', class: 'devise')
.a4-container{ class: class_names("french-state-layout": @attestation_template.french_state_layout?) }
.content
%header.first-header
.left
- if @attestation_template.label_logo.present?
= image_tag('centered_marianne.svg', alt: '', class: 'marianne')
.bloc-marque
= simple_format @attestation_template.label_logo, class: "intitule"
= image_tag('liberte2.svg', alt: '', class: 'devise')
%p.issuer
Service Hébergement et Accès au Logement<br />
Bureau de l'Accès au Logement
.right
- if @attestation_template.label_direction.present?
= simple_format @attestation_template.label_direction, class: "direction"
.right
- if @attestation_template.label_direction.present?
= simple_format @attestation_template.label_direction, class: "direction"
.main
= sanitize(@body, attributes: %w[class style], tags: Rails.configuration.action_view.sanitized_allowed_tags + %w[header])
%p.date Créteil, le 20 mars 2023
.main
= sanitize(@body)
- if @attestation_template.footer.present?
= simple_format @attestation_template.footer, class: "footer"
- if @attestation_template.footer.present?
= simple_format @attestation_template.footer, class: "footer"