refactor(attestation): hide libelle of empty repetitions
This commit is contained in:
parent
9f9720d65b
commit
247bb6f8c6
4 changed files with 33 additions and 5 deletions
|
@ -181,11 +181,17 @@
|
||||||
|
|
||||||
.tdc-repetition li {
|
.tdc-repetition li {
|
||||||
margin-bottom: 5mm;
|
margin-bottom: 5mm;
|
||||||
|
padding-left: 3mm;
|
||||||
|
|
||||||
dl {
|
dl {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr;
|
||||||
gap: 1mm 5mm;
|
gap: 1mm 10mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invisible {
|
||||||
|
visibility: hidden;
|
||||||
|
height: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,14 @@ class ChampPresentations::RepetitionPresentation < ChampPresentations::BasePrese
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: 'descriptionTerm',
|
type: 'descriptionTerm',
|
||||||
|
attrs: champ.blank? ? { class: 'invisible' } : nil, # still render libelle so width & alignment are preserved
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: champ.libelle
|
text: champ.libelle
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}.compact,
|
||||||
{
|
{
|
||||||
type: 'descriptionDetails',
|
type: 'descriptionDetails',
|
||||||
content: [
|
content: [
|
||||||
|
|
|
@ -85,8 +85,8 @@ class TiptapService
|
||||||
"<li>#{children(content, substitutions, level + 1)}</li>"
|
"<li>#{children(content, substitutions, level + 1)}</li>"
|
||||||
in type: 'descriptionList', content:
|
in type: 'descriptionList', content:
|
||||||
"<dl>#{children(content, substitutions, level + 1)}</dl>"
|
"<dl>#{children(content, substitutions, level + 1)}</dl>"
|
||||||
in type: 'descriptionTerm', content:
|
in type: 'descriptionTerm', content:, **rest
|
||||||
"<dt>#{children(content, substitutions, level + 1)}</dt>"
|
"<dt#{class_list(rest[:attrs])}>#{children(content, substitutions, level + 1)}</dt>"
|
||||||
in type: 'descriptionDetails', content:
|
in type: 'descriptionDetails', content:
|
||||||
"<dd>#{children(content, substitutions, level + 1)}</dd>"
|
"<dd>#{children(content, substitutions, level + 1)}</dd>"
|
||||||
in type: 'text', text:, **rest
|
in type: 'text', text:, **rest
|
||||||
|
|
|
@ -21,6 +21,9 @@ describe ChampPresentations::RepetitionPresentation do
|
||||||
nom.update(value: "ruby")
|
nom.update(value: "ruby")
|
||||||
stars.update(value: 5)
|
stars.update(value: 5)
|
||||||
|
|
||||||
|
nom, stars = dossier.champs[0].add_row(dossier.procedure.active_revision)
|
||||||
|
nom.update(value: "js")
|
||||||
|
|
||||||
nom, stars = dossier.champs[0].add_row(dossier.procedure.active_revision)
|
nom, stars = dossier.champs[0].add_row(dossier.procedure.active_revision)
|
||||||
nom.update(value: "rust")
|
nom.update(value: "rust")
|
||||||
stars.update(value: 4)
|
stars.update(value: 4)
|
||||||
|
@ -37,6 +40,9 @@ describe ChampPresentations::RepetitionPresentation do
|
||||||
nom : ruby
|
nom : ruby
|
||||||
stars : 5
|
stars : 5
|
||||||
|
|
||||||
|
nom : js
|
||||||
|
stars :#{' '}
|
||||||
|
|
||||||
nom : rust
|
nom : rust
|
||||||
stars : 4
|
stars : 4
|
||||||
TXT
|
TXT
|
||||||
|
@ -63,7 +69,22 @@ describe ChampPresentations::RepetitionPresentation do
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
type: "listItem",
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "descriptionList",
|
||||||
|
content: [
|
||||||
|
{ content: [{ text: "nom", type: "text" }], type: "descriptionTerm" },
|
||||||
|
{ content: [{ text: "js", type: "text" }], type: "descriptionDetails" },
|
||||||
|
{ content: [{ text: "stars", type: "text" }], type: "descriptionTerm", attrs: { class: "invisible" } },
|
||||||
|
{ content: [{ text: "", type: "text" }], type: "descriptionDetails" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
type: "listItem",
|
type: "listItem",
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue