Projet

Général

Profil

0001-backoffice-don-t-use-a-popup-for-form-card-templates.patch

Frédéric Péters, 22 janvier 2021 14:08

Télécharger (2,58 ko)

Voir les différences:

Subject: [PATCH] backoffice: don't use a popup for form/card templates option
 (#50437)

 tests/admin_pages/test_form.py |  1 +
 wcs/admin/forms.py             | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
tests/admin_pages/test_form.py
834 834
    resp = app.get('/backoffice/forms/1/')
835 835

  
836 836
    assert_option_display(resp, 'Templates', 'None')
837
    assert resp.pyquery('[href="options/templates"]').attr.rel == ''  # no popup
837 838
    resp = resp.click('Templates')
838 839
    resp.form['digest_template'] = 'X{{form_var_test}}Y'
839 840
    resp = resp.form.submit()
wcs/admin/forms.py
378 378

  
379 379
        return False
380 380

  
381
    def _q_traverse(self, path):
382
        get_response().breadcrumb.append((path[0] + '/', self.formdef.name))
383
        return super()._q_traverse(path)
384

  
381 385

  
382 386
class WorkflowRoleDirectory(Directory):
383 387
    def __init__(self, formdef):
......
481 485
        r += utils.last_modification_block(obj=self.formdef)
482 486
        r += get_session().display_message()
483 487

  
484
        def add_option_line(link, label, current_value):
488
        def add_option_line(link, label, current_value, popup=True):
485 489
            return htmltext(
486
                    '<li><a rel="popup" href="%(link)s">'
490
                    '<li><a rel="%(popup)s" href="%(link)s">'
487 491
                    '<span class="label">%(label)s</span> '
488 492
                    '<span class="value">%(current_value)s</span>'
489 493
                    '</a></li>' % {
494
                              'popup': 'popup' if popup else '',
490 495
                              'link': link,
491 496
                              'label': label,
492 497
                              'current_value': current_value})
......
621 626
        else:
622 627
            digest_template_status = C_('template|None')
623 628
        r += add_option_line('options/templates',
624
                _('Templates'), digest_template_status)
629
                _('Templates'), digest_template_status, popup=False)
625 630

  
626 631
        online_status = C_('online status|Active')
627 632
        if self.formdef.disabled:
628
-