backoffice: note a page has post conditions in fields listing (#69522) #468

Merged
fpeters merged 1 commits from wip/69522-post-condition-display into main 2023-07-14 09:05:55 +02:00
2 changed files with 4 additions and 0 deletions

View File

@ -2712,6 +2712,7 @@ def test_form_edit_page_field(pub):
assert 'Page #1' in resp.text
assert 'foobar' in resp.text
assert 'Use drag and drop' in resp.text
assert 'with post-conditions' not in resp.text
formdef.refresh_from_storage()
assert len(formdef.fields) == 1
@ -2731,6 +2732,7 @@ def test_form_edit_page_field(pub):
assert 'Both condition and error message are required.' in resp.text
resp.form['post_conditions$element1$error_message'] = 'bar2'
resp = resp.form.submit('submit').follow()
assert 'with post-conditions' in resp.text
formdef.refresh_from_storage()
assert formdef.fields[0].post_conditions == [

View File

@ -452,6 +452,8 @@ class FieldsDirectory(Directory):
r += htmltext('<span class="optional">%s</span>') % required
if getattr(field, 'condition', None):
r += htmltext(' - <span class="condition">%s</span>') % _('depending on condition')
if field.key == 'page' and field.post_conditions:
r += htmltext(' - <span>%s</span>') % _('with post-conditions')
if (
field.key != 'page'
and getattr(field, 'varname', None)