diff --git a/app/assets/stylesheets/attestation.scss b/app/assets/stylesheets/attestation.scss
index 33cb38c48..7af3840f3 100644
--- a/app/assets/stylesheets/attestation.scss
+++ b/app/assets/stylesheets/attestation.scss
@@ -181,11 +181,17 @@
.tdc-repetition li {
margin-bottom: 5mm;
+ padding-left: 3mm;
dl {
display: grid;
grid-template-columns: auto 1fr;
- gap: 1mm 5mm;
+ gap: 1mm 10mm;
+ }
+
+ .invisible {
+ visibility: hidden;
+ height: 0;
}
}
}
diff --git a/app/models/champ_presentations/repetition_presentation.rb b/app/models/champ_presentations/repetition_presentation.rb
index 41bf2c2ad..000f74430 100644
--- a/app/models/champ_presentations/repetition_presentation.rb
+++ b/app/models/champ_presentations/repetition_presentation.rb
@@ -31,13 +31,14 @@ class ChampPresentations::RepetitionPresentation < ChampPresentations::BasePrese
[
{
type: 'descriptionTerm',
+ attrs: champ.blank? ? { class: 'invisible' } : nil, # still render libelle so width & alignment are preserved
content: [
{
type: 'text',
text: champ.libelle
}
]
- },
+ }.compact,
{
type: 'descriptionDetails',
content: [
diff --git a/app/services/tiptap_service.rb b/app/services/tiptap_service.rb
index ee50bb458..c63ee7f0a 100644
--- a/app/services/tiptap_service.rb
+++ b/app/services/tiptap_service.rb
@@ -85,8 +85,8 @@ class TiptapService
"
#{children(content, substitutions, level + 1)}"
in type: 'descriptionList', content:
"#{children(content, substitutions, level + 1)}
"
- in type: 'descriptionTerm', content:
- "#{children(content, substitutions, level + 1)}"
+ in type: 'descriptionTerm', content:, **rest
+ "#{children(content, substitutions, level + 1)}"
in type: 'descriptionDetails', content:
"#{children(content, substitutions, level + 1)}"
in type: 'text', text:, **rest
diff --git a/spec/models/champ_presentations/repetition_presentation_spec.rb b/spec/models/champ_presentations/repetition_presentation_spec.rb
index de815b327..37c7fec5a 100644
--- a/spec/models/champ_presentations/repetition_presentation_spec.rb
+++ b/spec/models/champ_presentations/repetition_presentation_spec.rb
@@ -21,6 +21,9 @@ describe ChampPresentations::RepetitionPresentation do
nom.update(value: "ruby")
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.update(value: "rust")
stars.update(value: 4)
@@ -37,6 +40,9 @@ describe ChampPresentations::RepetitionPresentation do
nom : ruby
stars : 5
+ nom : js
+ stars :#{' '}
+
nom : rust
stars : 4
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",
content: [
{