Projet

Général

Profil

0001-workflows-fullscreen-for-svg-on-status-page-7520.patch

Lauréline Guérin, 06 juillet 2020 15:46

Télécharger (3,78 ko)

Voir les différences:

Subject: [PATCH] workflows - fullscreen for svg on status page (#7520)

 tests/test_admin_pages.py |  6 +++++-
 wcs/admin/workflows.py    | 19 ++++++++++++++-----
 2 files changed, 19 insertions(+), 6 deletions(-)
tests/test_admin_pages.py
2395 2395

  
2396 2396

  
2397 2397
def test_workflows_svg(pub):
2398
    user = create_superuser(pub)
2398
    create_superuser(pub)
2399 2399
    role = create_role()
2400 2400
    Workflow.wipe()
2401 2401

  
......
2414 2414
    assert resp.content_type == 'image/svg+xml'
2415 2415
    assert '/static/css/dc2/admin.css' in resp.text
2416 2416

  
2417
    resp = app.get('/backoffice/workflows/%s/status/%s/svg' % (workflow.id, st1.id))
2418
    assert resp.content_type == 'image/svg+xml'
2419
    assert '/static/css/dc2/admin.css' in resp.text
2420

  
2417 2421

  
2418 2422
def test_workflows_edit(pub):
2419 2423
    Workflow.wipe()
wcs/admin/workflows.py
410 410
    _q_exports = ['', 'delete', 'newitem', ('items', 'items_dir'),
411 411
                  'update_order', 'edit', 'reassign',
412 412
                  'endpoint', 'display',
413
                  ('backoffice-info-text', 'backoffice_info_text'),]
413
                  ('backoffice-info-text', 'backoffice_info_text'),
414
                  ('schema.svg', 'svg'), 'svg']
414 415

  
415 416
    def __init__(self, workflow, status_id, html_top):
416 417
        self.html_top = html_top
......
489 490
        r += htmltext('<p><a href="../../">%s</a></p>') % _('Back to workflow main page')
490 491

  
491 492
        r += htmltext('<div class="bo-block">')
492
        r += htmltext(graphviz(self.workflow, url_prefix='../../', include=True,
493
            select='%s' % self.status.id))
493
        r += htmltext(graphviz(self.workflow, url_prefix='../../', include=True, select='%s' % self.status.id))
494
        r += htmltext('<div class="full-screen-link"><a href="schema.svg">%s</a></div>') % _('Full Screen')
494 495
        r += htmltext('</div>')
495 496

  
496 497
        get_response().filter['sidebar'] = self.get_sidebar()
497 498

  
498 499
        return r.getvalue()
499 500

  
501
    def svg(self):
502
        response = get_response()
503
        response.set_content_type('image/svg+xml')
504
        root_url = get_publisher().get_application_static_files_root_url()
505
        css = root_url + get_publisher().qommon_static_dir + get_publisher().qommon_admin_css
506
        return graphviz(self.workflow, url_prefix='../../', include=False, select='%s' % self.status.id).replace(
507
            '?>', '?>\n<?xml-stylesheet href="%s" type="text/css"?>\n' % css)
508

  
500 509
    def get_sidebar(self):
501 510
        get_response().add_javascript(['popup.js', 'jquery.colourpicker.js'])
502 511
        r = TemplateIO(html=True)
......
1524 1533
                r += htmltext('</ul>')
1525 1534
            r += htmltext('</div>')
1526 1535

  
1527
        r += htmltext('</div>') # .splitcontent-right
1536
        r += htmltext('</div>')  # .splitcontent-right
1528 1537

  
1529 1538
        r += htmltext('<br style="clear:both;"/>')
1530 1539

  
......
1532 1541
            r += htmltext('<div class="bo-block">')
1533 1542
            r += htmltext(graphviz(self.workflow, include=True))
1534 1543
            r += htmltext('<div class="full-screen-link"><a href="schema.svg">%s</a></div>') % _('Full Screen')
1535
            r += htmltext('</div>') # bo-block
1544
            r += htmltext('</div>')  # bo-block
1536 1545

  
1537 1546
        formdefs = self.workflow.formdefs()
1538 1547
        if formdefs:
1539
-