mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 04:42:58 +00:00
Handle relations
This commit is contained in:
parent
ebbc22ba75
commit
d347612dcf
@ -7,7 +7,8 @@
|
|||||||
"collectionName": "components_dishes",
|
"collectionName": "components_dishes",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"required": true
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "text"
|
"type": "text"
|
||||||
|
@ -7,6 +7,7 @@ import { Inputs as InputsIndex } from '@buffetjs/custom';
|
|||||||
|
|
||||||
import useDataManager from '../../hooks/useDataManager';
|
import useDataManager from '../../hooks/useDataManager';
|
||||||
import InputJSONWithErrors from '../InputJSONWithErrors';
|
import InputJSONWithErrors from '../InputJSONWithErrors';
|
||||||
|
import SelectWrapper from '../SelectWrapper';
|
||||||
import WysiwygWithErrors from '../WysiwygWithErrors';
|
import WysiwygWithErrors from '../WysiwygWithErrors';
|
||||||
|
|
||||||
const getInputType = (type = '') => {
|
const getInputType = (type = '') => {
|
||||||
@ -99,6 +100,21 @@ function Inputs({ autoFocus, keys, layout, name, onBlur }) {
|
|||||||
// TODO format error for the JSON, the WYSIWYG and also the file inputs
|
// TODO format error for the JSON, the WYSIWYG and also the file inputs
|
||||||
// TODO check if the height for the textarea is 196px (not mandatory)
|
// TODO check if the height for the textarea is 196px (not mandatory)
|
||||||
|
|
||||||
|
if (type === 'relation') {
|
||||||
|
return (
|
||||||
|
<div className="col-6" key={keys}>
|
||||||
|
<SelectWrapper
|
||||||
|
{...metadatas}
|
||||||
|
name={keys}
|
||||||
|
plugin={attribute.plugin}
|
||||||
|
relationType={attribute.relationType}
|
||||||
|
targetModel={attribute.targetModel}
|
||||||
|
value={get(modifiedData, keys)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormattedMessage id={errorId}>
|
<FormattedMessage id={errorId}>
|
||||||
{error => {
|
{error => {
|
||||||
|
@ -210,7 +210,7 @@ WysiwygWithErrors.propTypes = {
|
|||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
tabIndex: PropTypes.string,
|
tabIndex: PropTypes.string,
|
||||||
validations: PropTypes.object,
|
validations: PropTypes.object,
|
||||||
value: PropTypes.string.isRequired,
|
value: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default WysiwygWithErrors;
|
export default WysiwygWithErrors;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user