mirror of
https://github.com/strapi/strapi.git
synced 2025-08-31 20:33:03 +00:00
Handle relations
This commit is contained in:
parent
ebbc22ba75
commit
d347612dcf
@ -7,7 +7,8 @@
|
||||
"collectionName": "components_dishes",
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
|
@ -7,6 +7,7 @@ import { Inputs as InputsIndex } from '@buffetjs/custom';
|
||||
|
||||
import useDataManager from '../../hooks/useDataManager';
|
||||
import InputJSONWithErrors from '../InputJSONWithErrors';
|
||||
import SelectWrapper from '../SelectWrapper';
|
||||
import WysiwygWithErrors from '../WysiwygWithErrors';
|
||||
|
||||
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 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 (
|
||||
<FormattedMessage id={errorId}>
|
||||
{error => {
|
||||
|
@ -210,7 +210,7 @@ WysiwygWithErrors.propTypes = {
|
||||
style: PropTypes.object,
|
||||
tabIndex: PropTypes.string,
|
||||
validations: PropTypes.object,
|
||||
value: PropTypes.string.isRequired,
|
||||
value: PropTypes.string,
|
||||
};
|
||||
|
||||
export default WysiwygWithErrors;
|
||||
|
Loading…
x
Reference in New Issue
Block a user