datasources: move json attributes in advanced (#48244)
This commit is contained in:
parent
d754db6ea0
commit
7408d897e5
|
@ -105,36 +105,6 @@ class NamedDataSourceUI(object):
|
|||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'geojson',
|
||||
})
|
||||
form.add(StringWidget, 'data_attribute',
|
||||
value=self.datasource.data_attribute,
|
||||
title=_('Data Attribute'),
|
||||
hint=_('Name of the attribute containing the list of results (default: data)'),
|
||||
required=False,
|
||||
advanced=False,
|
||||
attrs={
|
||||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'json',
|
||||
})
|
||||
form.add(StringWidget, 'id_attribute',
|
||||
value=self.datasource.id_attribute,
|
||||
title=_('Id Attribute'),
|
||||
hint=_('Name of the attribute containing the identifier of an entry (default: id)'),
|
||||
required=False,
|
||||
advanced=False,
|
||||
attrs={
|
||||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'json',
|
||||
})
|
||||
form.add(StringWidget, 'text_attribute',
|
||||
value=self.datasource.text_attribute,
|
||||
title=_('Text Attribute'),
|
||||
hint=_('Name of the attribute containing the label of an entry (default: text)'),
|
||||
required=False,
|
||||
advanced=False,
|
||||
attrs={
|
||||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'json',
|
||||
})
|
||||
form.add(StringWidget, 'label_template_property',
|
||||
value=self.datasource.label_template_property,
|
||||
title=_('Label template'),
|
||||
|
@ -152,6 +122,36 @@ class NamedDataSourceUI(object):
|
|||
title=_('Identifier'),
|
||||
required=True, advanced=True,
|
||||
)
|
||||
form.add(StringWidget, 'data_attribute',
|
||||
value=self.datasource.data_attribute,
|
||||
title=_('Data Attribute'),
|
||||
hint=_('Name of the attribute containing the list of results (default: data)'),
|
||||
required=False,
|
||||
advanced=True,
|
||||
attrs={
|
||||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'json',
|
||||
})
|
||||
form.add(StringWidget, 'id_attribute',
|
||||
value=self.datasource.id_attribute,
|
||||
title=_('Id Attribute'),
|
||||
hint=_('Name of the attribute containing the identifier of an entry (default: id)'),
|
||||
required=False,
|
||||
advanced=True,
|
||||
attrs={
|
||||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'json',
|
||||
})
|
||||
form.add(StringWidget, 'text_attribute',
|
||||
value=self.datasource.text_attribute,
|
||||
title=_('Text Attribute'),
|
||||
hint=_('Name of the attribute containing the label of an entry (default: text)'),
|
||||
required=False,
|
||||
advanced=True,
|
||||
attrs={
|
||||
'data-dynamic-display-child-of': 'data_source$type',
|
||||
'data-dynamic-display-value': 'json',
|
||||
})
|
||||
if not self.datasource.is_readonly():
|
||||
form.add_submit('submit', _('Submit'))
|
||||
form.add_submit('cancel', _('Cancel'))
|
||||
|
|
|
@ -440,11 +440,23 @@ label.activity {
|
|||
padding-right: 30px;
|
||||
}
|
||||
|
||||
form .widget-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
fieldset.form-plus {
|
||||
padding: 1ex 0 0 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
fieldset.form-plus > div {
|
||||
display: block;
|
||||
}
|
||||
|
||||
fieldset.form-plus > .widget-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
fieldset.form-plus.closed > div {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@ $(function() {
|
|||
var sel2 = '[data-dynamic-display-value="' + $(this).val() + '"]';
|
||||
var sel3 = '[data-dynamic-display-invert-value][data-dynamic-display-invert-value!="' + $(this).val() + '"]';
|
||||
var sel4 = '[data-dynamic-display-value-in*="' + $(this).val() + '"]';
|
||||
$(sel1).hide();
|
||||
$(sel1 + sel2).show();
|
||||
$(sel1 + sel3).show();
|
||||
$(sel1 + sel4).show();
|
||||
$(sel1).addClass('widget-hidden');
|
||||
$(sel1 + sel2).removeClass('widget-hidden');
|
||||
$(sel1 + sel3).removeClass('widget-hidden');
|
||||
$(sel1 + sel4).removeClass('widget-hidden');
|
||||
});
|
||||
$('[data-dynamic-display-child-of]').hide();
|
||||
$('[data-dynamic-display-child-of]').addClass('widget-hidden');
|
||||
$('select[data-dynamic-display-parent]').trigger('change');
|
||||
$('[data-dynamic-display-parent]:checked').trigger('change');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue