mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 04:03:25 +00:00
Form for all attributes except relation
This commit is contained in:
parent
c76b112367
commit
82739fb606
@ -24,7 +24,7 @@ class AttributeRow extends React.Component { // eslint-disable-line react/prefer
|
||||
this.asset = {
|
||||
'boolean': IcoBoolean,
|
||||
'date': IcoDate,
|
||||
'image': IcoImage,
|
||||
'media': IcoImage,
|
||||
'json': IcoJson,
|
||||
'relation': IcoRelation,
|
||||
'string': IcoString,
|
||||
|
||||
@ -220,20 +220,148 @@
|
||||
}
|
||||
},
|
||||
"date": {
|
||||
"baseSettings": {},
|
||||
"advancedSettings": {}
|
||||
"baseSettings": {
|
||||
"items": [
|
||||
{
|
||||
"name": "form.attribute.item.date.name",
|
||||
"target": "name",
|
||||
"type": "string",
|
||||
"value": "",
|
||||
"validations": {
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"advancedSettings": {
|
||||
"items": [
|
||||
{
|
||||
"title": "form.attribute.item.settings.name",
|
||||
"name": "form.attribute.item.requiredField",
|
||||
"target": "params.required",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.requiredField.description"
|
||||
},
|
||||
{
|
||||
"name": "form.attribute.item.uniqueField",
|
||||
"target": "params.unique",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.uniqueField.description"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"boolean": {
|
||||
"baseSettings": {},
|
||||
"advancedSettings": {}
|
||||
"baseSettings": {
|
||||
"items": [
|
||||
{
|
||||
"name": "form.attribute.item.boolean.name",
|
||||
"target": "name",
|
||||
"type": "string",
|
||||
"value": "",
|
||||
"validations": {
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"advancedSettings": {
|
||||
"items": [
|
||||
{
|
||||
"title": "form.attribute.item.settings.name",
|
||||
"name": "form.attribute.item.requiredField",
|
||||
"target": "params.required",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.requiredField.description"
|
||||
},
|
||||
{
|
||||
"name": "form.attribute.item.uniqueField",
|
||||
"target": "params.unique",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.uniqueField.description"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"baseSettings": {},
|
||||
"advancedSettings": {}
|
||||
"baseSettings": {
|
||||
"items": [
|
||||
{
|
||||
"name": "form.attribute.item.json.name",
|
||||
"target": "name",
|
||||
"type": "string",
|
||||
"value": "",
|
||||
"validations": {
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"advancedSettings": {
|
||||
"items": [
|
||||
{
|
||||
"title": "form.attribute.item.settings.name",
|
||||
"name": "form.attribute.item.requiredField",
|
||||
"target": "params.required",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.requiredField.description"
|
||||
},
|
||||
{
|
||||
"name": "form.attribute.item.uniqueField",
|
||||
"target": "params.unique",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.uniqueField.description"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
"baseSettings": {},
|
||||
"advancedSettings": {}
|
||||
"baseSettings": {
|
||||
"items": [
|
||||
{
|
||||
"name": "form.attribute.item.media.name",
|
||||
"target": "name",
|
||||
"type": "string",
|
||||
"value": "",
|
||||
"validations": {
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"advancedSettings": {
|
||||
"items": [
|
||||
{
|
||||
"title": "form.attribute.item.settings.name",
|
||||
"name": "form.attribute.item.requiredField",
|
||||
"target": "params.required",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.requiredField.description"
|
||||
},
|
||||
{
|
||||
"name": "form.attribute.item.uniqueField",
|
||||
"target": "params.unique",
|
||||
"type": "checkbox",
|
||||
"value": false,
|
||||
"validations": {},
|
||||
"inputDescription": "form.attribute.item.uniqueField.description"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
|
||||
super(props);
|
||||
this.state = {
|
||||
showModal: false,
|
||||
popUpTitleEdit: '',
|
||||
};
|
||||
}
|
||||
|
||||
@ -297,6 +298,8 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
|
||||
}
|
||||
|
||||
if (get(props.contentTypeData, 'name') && includes(props.hash, '#edit') && includes(props.hash, 'attribute')) {
|
||||
|
||||
this.setState({ popUpTitleEdit: get(props.contentTypeData, ['attributes', split(props.hash, '::')[3], 'name']) });
|
||||
this.props.setAttributeFormEdit(props.hash, props.contentTypeData);
|
||||
}
|
||||
} else {
|
||||
@ -348,12 +351,17 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
|
||||
)
|
||||
|
||||
renderCustomPopUpHeader = (startTitle) => {
|
||||
const italicText = replace(split(this.props.hash, ('::'))[1], 'attribute', '');
|
||||
const italicText = !includes(this.props.hash, '#edit') ?
|
||||
<FormattedMessage id={replace(split(this.props.hash, ('::'))[1], 'attribute', '')}>
|
||||
{(message) => <span style={{ fontStyle: 'italic', textTransform: 'capitalize' }}>{message}</span>}
|
||||
</FormattedMessage>
|
||||
: <span style={{ fontStyle: 'italic', textTransform: 'capitalize' }}>{this.state.popUpTitleEdit}</span>;
|
||||
return (
|
||||
<div>
|
||||
<FormattedMessage id={startTitle} /> <FormattedMessage id={italicText}>
|
||||
{(message) => <span style={{ fontStyle: 'italic', textTransform: 'capitalize' }}>{message}</span>}
|
||||
</FormattedMessage>
|
||||
<FormattedMessage id={startTitle} />
|
||||
|
||||
{italicText}
|
||||
|
||||
<FormattedMessage id="popUpForm.field" />
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -14,6 +14,10 @@
|
||||
"button.attributes.add": "Add New Field",
|
||||
|
||||
"form.attribute.item.textarea.name": "Name",
|
||||
"form.attribute.item.date.name": "Name",
|
||||
"form.attribute.item.media.name": "Name",
|
||||
"form.attribute.item.json.name": "Name",
|
||||
"form.attribute.item.boolean.name": "Name",
|
||||
"form.attribute.item.string.name": "Name",
|
||||
"form.attribute.item.settings.name": "Settings",
|
||||
"form.attribute.item.requiredField": "Required field",
|
||||
|
||||
@ -13,6 +13,10 @@
|
||||
"button.attributes.add": "Ajouter un champs",
|
||||
|
||||
"form.attribute.item.textarea.name": "Nom",
|
||||
"form.attribute.item.date.name": "Nom",
|
||||
"form.attribute.item.boolean.name": "Nom",
|
||||
"form.attribute.item.json.name": "Nom",
|
||||
"form.attribute.item.media.name": "Nom",
|
||||
"form.attribute.item.string.name": "Nom",
|
||||
"form.attribute.item.settings.name": "Paramètres",
|
||||
"form.attribute.item.requiredField": "Champ obligatoire",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user