backoffice: don't use a popup for card templates option (#50481)

This commit is contained in:
Frédéric Péters 2021-01-24 18:23:55 +01:00
parent e15ef811c6
commit 6b2c80a4e1
2 changed files with 5 additions and 3 deletions

View File

@ -204,6 +204,7 @@ def test_card_templates(pub):
resp = app.get('/backoffice/cards/1/')
assert_option_display(resp, 'Templates', 'None')
assert resp.pyquery('[href="options/templates"]').attr.rel == '' # no popup
resp = resp.click('Templates')
resp.form['digest_template'] = 'X{{form_var_test}}Y'
resp = resp.form.submit()

View File

@ -81,12 +81,13 @@ class CardDefPage(FormDefPage):
r += utils.last_modification_block(obj=self.formdef)
r += get_session().display_message()
def add_option_line(link, label, current_value):
def add_option_line(link, label, current_value, popup=True):
return htmltext(
'<li><a rel="popup" href="%(link)s">'
'<li><a rel="%(popup)s" href="%(link)s">'
'<span class="label">%(label)s</span> '
'<span class="value">%(current_value)s</span>'
'</a></li>' % {
'popup': 'popup' if popup else '',
'link': link,
'label': label,
'current_value': current_value})
@ -170,7 +171,7 @@ class CardDefPage(FormDefPage):
else:
digest_template_status = C_('template|None')
r += add_option_line('options/templates',
_('Templates'), digest_template_status)
_('Templates'), digest_template_status, popup=False)
if self.formdef.user_support == 'optional':
user_support_status = C_('user_support|Optional')
else: