misc: load media on add card popups (#54268)
This commit is contained in:
parent
39aa27a92d
commit
2f958d64f5
|
@ -696,16 +696,23 @@ def test_carddata_add_related(pub):
|
|||
adult = CardDef()
|
||||
adult.name = 'Adult'
|
||||
adult.fields = [
|
||||
fields.ItemField(
|
||||
fields.StringField(
|
||||
id='1',
|
||||
label='First name',
|
||||
type='string',
|
||||
),
|
||||
fields.ItemField(
|
||||
fields.StringField(
|
||||
id='2',
|
||||
label='Last name',
|
||||
type='string',
|
||||
),
|
||||
fields.ItemField(
|
||||
id='3',
|
||||
label='autocompletion test',
|
||||
type='item',
|
||||
display_mode='autocomplete',
|
||||
items=['Foo', 'Bar', 'Three', 'Four', 'Five', 'Six'],
|
||||
),
|
||||
]
|
||||
adult.backoffice_submission_roles = user.roles
|
||||
adult.workflow_roles = {'_editor': user.roles[0]}
|
||||
|
@ -715,12 +722,12 @@ def test_carddata_add_related(pub):
|
|||
child = CardDef()
|
||||
child.name = 'Child'
|
||||
child.fields = [
|
||||
fields.ItemField(
|
||||
fields.StringField(
|
||||
id='1',
|
||||
label='First name',
|
||||
type='string',
|
||||
),
|
||||
fields.ItemField(
|
||||
fields.StringField(
|
||||
id='2',
|
||||
label='Last name',
|
||||
type='string',
|
||||
|
@ -738,6 +745,8 @@ def test_carddata_add_related(pub):
|
|||
assert 'Add another Child' in resp
|
||||
assert resp.text.count('/backoffice/data/adult/add/?_popup=1') == 2
|
||||
assert '/backoffice/data/child/add/?_popup=1' in resp
|
||||
resp_popup = app.get('/backoffice/data/adult/add/?_popup=1')
|
||||
assert 'select2.min.js' in resp_popup.text
|
||||
|
||||
# no autocompletion for RL1
|
||||
family.fields[0].display_mode = []
|
||||
|
|
|
@ -416,9 +416,11 @@ class QommonTemplateResponse:
|
|||
self.is_django_native = is_django_native
|
||||
|
||||
def add_media(self):
|
||||
# run add_media so we get them in the page <head>
|
||||
if 'form' in self.context:
|
||||
# run add_media so we get them in the page <head>
|
||||
self.context['form'].add_media()
|
||||
if 'form_obj' in self.context: # "add card" popup case
|
||||
self.context['form_obj'].add_media()
|
||||
|
||||
|
||||
class TemplateError(Exception):
|
||||
|
|
Loading…
Reference in New Issue