Projet

Général

Profil

0001-backoffice-fix-related-objects-display-in-formdata-i.patch

Lauréline Guérin, 10 juin 2022 17:38

Télécharger (7,23 ko)

Voir les différences:

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(-)
tests/backoffice_pages/test_form_inspect.py
456 456
    assert 'Related Forms/Cards' in resp.text
457 457
    # related form and card
458 458
    assert (
459
        '<li><a href="http://example.net/backoffice/management/external-form/1/">External Form #1-1 (Evolution)</a></li>'
459
        '<a href="http://example.net/backoffice/management/external-form/1/">External Form #1-1 (Evolution)</a>'
460 460
        in resp.text
461 461
    )
462 462
    assert (
463
        '<li><a href="http://example.net/backoffice/data/external-card/1/">External Card #1-1 (Evolution)</a></li>'
463
        '<a href="http://example.net/backoffice/data/external-card/1/">External Card #1-1 (Evolution)</a>'
464 464
        in resp.text
465 465
    )
466 466
    # check related form
......
472 472
    resp = app.get('/backoffice/management/external-form/1/inspect')
473 473
    # parent
474 474
    assert (
475
        '<li><a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a></li>'
475
        '<a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a>'
476 476
        in resp.text
477 477
    )
478 478
    # check related card
......
484 484
    resp = app.get('/backoffice/data/external-card/1/inspect')
485 485
    # parent
486 486
    assert (
487
        '<li><a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a></li>'
487
        '<a href="http://example.net/backoffice/management/external-action-form/1/">External action form #2-1 (Parent)</a>'
488 488
        in resp.text
489 489
    )
490 490

  
......
495 495
    resp = app.get('/backoffice/management/external-action-form/1/inspect')
496 496
    assert 'Related Forms/Cards' in resp.text
497 497
    assert (
498
        '<li><a href="">Linked &quot;External Form&quot; object by id 1 (Evolution - not found)</a></li>'
499
        in resp.text
498
        '<a href="">Linked &quot;External Form&quot; object by id 1 (Evolution - not found)</a>' in resp.text
500 499
    )
501 500
    assert (
502
        '<li><a href="">Linked &quot;External Card&quot; object by id 1 (Evolution - not found)</a></li>'
503
        in resp.text
501
        '<a href="">Linked &quot;External Card&quot; object by id 1 (Evolution - not found)</a>' in resp.text
504 502
    )
505 503

  
506 504
    formdef.data_class().wipe()
......
523 521
    assert 'Related Forms/Cards' in resp.text
524 522
    # related form and card
525 523
    assert (
526
        '<li><a href="http://example.net/backoffice/management/external-form/2/">External Form #1-2 (Evolution)</a></li>'
524
        '<a href="http://example.net/backoffice/management/external-form/2/">External Form #1-2 (Evolution)</a>'
527 525
        in resp.text
528 526
    )
529 527
    assert (
530
        '<li><a href="http://example.net/backoffice/data/external-card/2/">External Card #1-2 (Evolution)</a></li>'
528
        '<a href="http://example.net/backoffice/data/external-card/2/">External Card #1-2 (Evolution)</a>'
531 529
        in resp.text
532 530
    )
533 531
    # check related form
......
539 537
    resp = app.get('/backoffice/management/external-form/2/inspect')
540 538
    # parent
541 539
    assert (
542
        '<li><a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a></li>'
540
        '<a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a>'
543 541
        in resp.text
544 542
    )
545 543
    # check related card
......
551 549
    resp = app.get('/backoffice/data/external-card/2/inspect')
552 550
    # parent
553 551
    assert (
554
        '<li><a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a></li>'
552
        '<a href="http://example.net/backoffice/data/external-action-card/1/">External action card #2-1 (Parent)</a>'
555 553
        in resp.text
556 554
    )
557 555

  
......
602 600
    assert 'Related Forms/Cards' in resp.text
603 601
    # related card
604 602
    assert (
605
        '<li><a href="http://example.net/backoffice/data/card-a/1/">CARD A #1-1 (Data Source - varname &quot;card&quot;)</a></li>'
603
        '<a href="http://example.net/backoffice/data/card-a/1/">CARD A #1-1 (Data Source - varname &quot;card&quot;)</a>'
606 604
        in resp.text
607 605
    )
608 606

  
......
611 609
    resp = app.get('/backoffice/management/form-a/1/inspect')
612 610
    assert 'Related Forms/Cards' in resp.text
613 611
    assert (
614
        '<li><a href="">Linked &quot;CARD A&quot; object by id 1 (Data Source - varname &quot;card&quot; - not found)</a></li>'
612
        '<a href="">Linked &quot;CARD A&quot; object by id 1 (Data Source - varname &quot;card&quot; - not found)</a>'
615 613
        in resp.text
616 614
    )
617 615

  
......
620 618
    resp = app.get('/backoffice/management/form-a/1/inspect')
621 619
    assert 'Related Forms/Cards' in resp.text
622 620
    assert (
623
        '<li><a href="">Linked object def by id card-a (Data Source - varname &quot;card&quot; - not found)</a></li>'
621
        '<a href="">Linked object def by id card-a (Data Source - varname &quot;card&quot; - not found)</a>'
624 622
        in resp.text
625 623
    )
626 624

  
wcs/backoffice/management.py
3785 3785

  
3786 3786
        for child, origin in children:
3787 3787
            if isinstance(child, str):
3788
                r += htmltext('<li><a href="">%s (%s)</a></li>') % (child, origin)
3788
                r += htmltext('<li class="biglistitem"><a href="">%s (%s)</a></li>') % (child, origin)
3789 3789
            else:
3790
                r += htmltext('<li><a href="%s">%s (%s)</a></li>') % (
3790
                r += htmltext('<li class="biglistitem"><a href="%s">%s (%s)</a></li>') % (
3791 3791
                    child.get_url(backoffice=True),
3792 3792
                    child.get_display_name(),
3793 3793
                    origin,
wcs/qommon/static/css/dc2/admin.scss
1750 1750
	line-height: 1.2rem;
1751 1751
	min-height: 0;
1752 1752

  
1753
	&.biglistitem {
1754
		display: block;
1755
		padding: 0;
1756
		line-height: 2.5em;
1757
	}
1758

  
1753 1759
	span.label,
1754 1760
	code {
1755 1761
		padding: 0 1ex;
1756
-