From f03de8c1a4237c629f074ce05e7692c22fc28e45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= <zebuline@entrouvert.com>
Date: Fri, 10 Jun 2022 16:24:00 +0200
Subject: [PATCH] backoffice: fix related objects display in formdata inspect
 (#65720)

---
 tests/backoffice_pages/test_form_inspect.py | 28 ++++++++++-----------
 wcs/backoffice/management.py                |  4 +--
 wcs/qommon/static/css/dc2/admin.scss        |  6 +++++
 3 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/tests/backoffice_pages/test_form_inspect.py b/tests/backoffice_pages/test_form_inspect.py
index fade85921..bc73bf9b4 100644
--- a/tests/backoffice_pages/test_form_inspect.py
+++ b/tests/backoffice_pages/test_form_inspect.py
@@ -456,11 +456,11 @@ def test_inspect_page_with_related_objects(pub):
     assert 'Related Forms/Cards' in resp.text
     # related form and card
     assert (
-        '<li><a href="http://example.net/backoffice/management/external-form/1/">External Form #1-1 (Evolution)</a></li>'
+        '<a href="http://example.net/backoffice/management/external-form/1/">External Form #1-1 (Evolution)</a>'
         in resp.text
     )
     assert (
-        '<li><a href="http://example.net/backoffice/data/external-card/1/">External Card #1-1 (Evolution)</a></li>'
+        '<a href="http://example.net/backoffice/data/external-card/1/">External Card #1-1 (Evolution)</a>'
         in resp.text
     )
     # check related form
@@ -472,7 +472,7 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/management/external-form/1/inspect')
     # parent
     assert (
-        '<li><a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a></li>'
+        '<a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a>'
         in resp.text
     )
     # check related card
@@ -484,7 +484,7 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/data/external-card/1/inspect')
     # parent
     assert (
-        '<li><a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a></li>'
+        '<a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a>'
         in resp.text
     )
 
@@ -495,12 +495,10 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/management/external-action-form/1/inspect')
     assert 'Related Forms/Cards' in resp.text
     assert (
-        '<li><a href="">Linked &quot;External Form&quot; object by id 1 (Evolution - not found)</a></li>'
-        in resp.text
+        '<a href="">Linked &quot;External Form&quot; object by id 1 (Evolution - not found)</a>' in resp.text
     )
     assert (
-        '<li><a href="">Linked &quot;External Card&quot; object by id 1 (Evolution - not found)</a></li>'
-        in resp.text
+        '<a href="">Linked &quot;External Card&quot; object by id 1 (Evolution - not found)</a>' in resp.text
     )
 
     formdef.data_class().wipe()
@@ -523,11 +521,11 @@ def test_inspect_page_with_related_objects(pub):
     assert 'Related Forms/Cards' in resp.text
     # related form and card
     assert (
-        '<li><a href="http://example.net/backoffice/management/external-form/2/">External Form #1-2 (Evolution)</a></li>'
+        '<a href="http://example.net/backoffice/management/external-form/2/">External Form #1-2 (Evolution)</a>'
         in resp.text
     )
     assert (
-        '<li><a href="http://example.net/backoffice/data/external-card/2/">External Card #1-2 (Evolution)</a></li>'
+        '<a href="http://example.net/backoffice/data/external-card/2/">External Card #1-2 (Evolution)</a>'
         in resp.text
     )
     # check related form
@@ -539,7 +537,7 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/management/external-form/2/inspect')
     # parent
     assert (
-        '<li><a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a></li>'
+        '<a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a>'
         in resp.text
     )
     # check related card
@@ -551,7 +549,7 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/data/external-card/2/inspect')
     # parent
     assert (
-        '<li><a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a></li>'
+        '<a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a>'
         in resp.text
     )
 
@@ -602,7 +600,7 @@ def test_inspect_page_with_related_objects(pub):
     assert 'Related Forms/Cards' in resp.text
     # related card
     assert (
-        '<li><a href="http://example.net/backoffice/data/card-a/1/">CARD A #1-1 (Data Source - varname &quot;card&quot;)</a></li>'
+        '<a href="http://example.net/backoffice/data/card-a/1/">CARD A #1-1 (Data Source - varname &quot;card&quot;)</a>'
         in resp.text
     )
 
@@ -611,7 +609,7 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/management/form-a/1/inspect')
     assert 'Related Forms/Cards' in resp.text
     assert (
-        '<li><a href="">Linked &quot;CARD A&quot; object by id 1 (Data Source - varname &quot;card&quot; - not found)</a></li>'
+        '<a href="">Linked &quot;CARD A&quot; object by id 1 (Data Source - varname &quot;card&quot; - not found)</a>'
         in resp.text
     )
 
@@ -620,7 +618,7 @@ def test_inspect_page_with_related_objects(pub):
     resp = app.get('/backoffice/management/form-a/1/inspect')
     assert 'Related Forms/Cards' in resp.text
     assert (
-        '<li><a href="">Linked object def by id card-a (Data Source - varname &quot;card&quot; - not found)</a></li>'
+        '<a href="">Linked object def by id card-a (Data Source - varname &quot;card&quot; - not found)</a>'
         in resp.text
     )
 
diff --git a/wcs/backoffice/management.py b/wcs/backoffice/management.py
index 294168859..97d43e035 100644
--- a/wcs/backoffice/management.py
+++ b/wcs/backoffice/management.py
@@ -3785,9 +3785,9 @@ class FormBackOfficeStatusPage(FormStatusPage):
 
         for child, origin in children:
             if isinstance(child, str):
-                r += htmltext('<li><a href="">%s (%s)</a></li>') % (child, origin)
+                r += htmltext('<li class="biglistitem"><a href="">%s (%s)</a></li>') % (child, origin)
             else:
-                r += htmltext('<li><a href="%s">%s (%s)</a></li>') % (
+                r += htmltext('<li class="biglistitem"><a href="%s">%s (%s)</a></li>') % (
                     child.get_url(backoffice=True),
                     child.get_display_name(),
                     origin,
diff --git a/wcs/qommon/static/css/dc2/admin.scss b/wcs/qommon/static/css/dc2/admin.scss
index bf1fd28f7..6359084a5 100644
--- a/wcs/qommon/static/css/dc2/admin.scss
+++ b/wcs/qommon/static/css/dc2/admin.scss
@@ -1750,6 +1750,12 @@ ul.form-inspector li {
 	line-height: 1.2rem;
 	min-height: 0;
 
+	&.biglistitem {
+		display: block;
+		padding: 0;
+		line-height: 2.5em;
+	}
+
 	span.label,
 	code {
 		padding: 0 1ex;
-- 
2.35.1

