misc: use uniform label for block of fields (#89241)
This commit is contained in:
parent
86301756f1
commit
4869b1badb
|
@ -495,7 +495,7 @@ def test_removed_block_in_form_fields_list(pub):
|
|||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/forms/%s/fields/' % formdef.id)
|
||||
assert 'Field Block (removed, missing)' in resp.text
|
||||
assert 'Block of fields (removed, missing)' in resp.text
|
||||
|
||||
|
||||
def test_block_edit_field_warnings(pub):
|
||||
|
|
|
@ -2349,7 +2349,7 @@ def test_workflows_backoffice_fields(pub):
|
|||
'foobar Text (line)',
|
||||
'foobar2 Text (line)',
|
||||
'foobar3 Title',
|
||||
'foobar4 Field Block (Test Block)',
|
||||
'foobar4 Block of fields (Test Block)',
|
||||
]
|
||||
|
||||
workflow.refresh_from_storage()
|
||||
|
@ -3262,11 +3262,11 @@ def test_workflows_create_formdata_fields_with_same_label(pub):
|
|||
('', False, '---'),
|
||||
('0', False, 'string1 - Text (line) (foo)'),
|
||||
('1', True, 'string1 - Text (line) (bar)'),
|
||||
('2', False, 'block1 - Field Block (Test Block) (foo2)'),
|
||||
('2', False, 'block1 - Block of fields (Test Block) (foo2)'),
|
||||
('2$123', False, 'block1 (foo2) - Test - Text (line)'),
|
||||
('3', False, 'block1 - Field Block (Test Block) (bar2)'),
|
||||
('3', False, 'block1 - Block of fields (Test Block) (bar2)'),
|
||||
('3$123', False, 'block1 (bar2) - Test - Text (line)'),
|
||||
('4', False, 'block2 - Field Block (Test Block)'),
|
||||
('4', False, 'block2 - Block of fields (Test Block)'),
|
||||
('4$123', False, 'block2 - Test - Text (line)'),
|
||||
]
|
||||
|
||||
|
|
|
@ -734,7 +734,7 @@ def test_blockdefs(pub, application_with_icon, application_without_icon, icon):
|
|||
)
|
||||
else:
|
||||
assert len(resp.pyquery('h3:contains("Applications") + .button-paragraph img')) == 0
|
||||
assert 'Field blocks outside applications' in resp
|
||||
assert 'Blocks of fields outside applications' in resp
|
||||
|
||||
# check application view
|
||||
resp = resp.click(href='application/%s/' % application.slug)
|
||||
|
@ -751,7 +751,7 @@ def test_blockdefs(pub, application_with_icon, application_without_icon, icon):
|
|||
|
||||
# check elements outside applications
|
||||
resp = resp.click(href='application/')
|
||||
assert resp.pyquery('h2').text() == 'Field blocks outside applications'
|
||||
assert resp.pyquery('h2').text() == 'Blocks of fields outside applications'
|
||||
assert len(resp.pyquery('ul.objects-list li')) == 1
|
||||
assert resp.pyquery('ul.objects-list li:nth-child(1)').text() == 'block1'
|
||||
|
||||
|
|
|
@ -814,7 +814,7 @@ def test_backoffice_cards_import_data_csv_blockfield(pub):
|
|||
assert sample_resp.text.splitlines()[0] == '"String","Block"'
|
||||
assert (
|
||||
sample_resp.text.splitlines()[1]
|
||||
== '"value","will be ignored - type Field Block (foobar) not supported"'
|
||||
== '"value","will be ignored - type Block of fields (foobar) not supported"'
|
||||
)
|
||||
|
||||
# block is required, error
|
||||
|
|
|
@ -1468,7 +1468,7 @@ def test_set_backoffice_field_invalid_block_value(pub):
|
|||
logged_error = pub.loggederror_class.select()[0]
|
||||
assert (
|
||||
logged_error.summary
|
||||
== 'Failed to set Field Block (foobar) field (bo1), error: invalid value for block (field id: bo1)'
|
||||
== 'Failed to set Block of fields (foobar) field (bo1), error: invalid value for block (field id: bo1)'
|
||||
)
|
||||
|
||||
formdata = formdef.data_class().get(formdata.id)
|
||||
|
|
|
@ -1374,7 +1374,7 @@ def test_edit_carddata_partial_block_field(pub, admin_user):
|
|||
assert resp.form['mappings$element1$field_id'].options == [
|
||||
('', False, '---'),
|
||||
('0', False, 'foo - Text (line)'),
|
||||
('1', False, 'block field - Field Block (foobar)'),
|
||||
('1', False, 'block field - Block of fields (foobar)'),
|
||||
('1$123', True, 'block field - Test - Text (line)'),
|
||||
('1$234', False, 'block field - Test2 - Text (line)'),
|
||||
]
|
||||
|
|
|
@ -98,7 +98,7 @@ class StudioDirectory(Directory):
|
|||
backoffice_root = get_publisher().get_backoffice_root()
|
||||
object_types = []
|
||||
if backoffice_root.is_accessible('forms'):
|
||||
extra_links.append(('../forms/blocks/', pgettext('studio', 'Field blocks')))
|
||||
extra_links.append(('../forms/blocks/', pgettext('studio', 'Blocks of fields')))
|
||||
if backoffice_root.is_accessible('workflows'):
|
||||
extra_links.append(('../workflows/mail-templates/', pgettext('studio', 'Mail templates')))
|
||||
extra_links.append(('../workflows/comment-templates/', pgettext('studio', 'Comment templates')))
|
||||
|
|
|
@ -51,8 +51,8 @@ class BlockDef(StorableObject):
|
|||
_indexes = ['slug']
|
||||
backoffice_class = 'wcs.admin.blocks.BlockDirectory'
|
||||
xml_root_node = 'block'
|
||||
verbose_name = _('Field block')
|
||||
verbose_name_plural = _('Field blocks')
|
||||
verbose_name = _('Block of fields')
|
||||
verbose_name_plural = _('Blocks of fields')
|
||||
var_prefixes = ['block']
|
||||
|
||||
name = None
|
||||
|
|
|
@ -136,9 +136,9 @@ class BlockField(WidgetField):
|
|||
|
||||
def get_type_label(self):
|
||||
try:
|
||||
return _('Field Block (%s)') % self.block.name
|
||||
return _('Block of fields (%s)') % self.block.name
|
||||
except KeyError:
|
||||
return _('Field Block (%s, missing)') % self.block_slug
|
||||
return _('Block of fields (%s, missing)') % self.block_slug
|
||||
|
||||
def get_dependencies(self):
|
||||
yield from super().get_dependencies()
|
||||
|
|
Loading…
Reference in New Issue