diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js index 3f573bc6f0..cb09c4ea2a 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Edit/index.js @@ -14,15 +14,12 @@ import { isFunction, upperFirst, } from 'lodash'; - // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src import Input from 'components/InputsIndex'; - import InputJSONWithErrors from 'components/InputJSONWithErrors'; import WysiwygWithErrors from 'components/WysiwygWithErrors'; - import styles from './styles.scss'; const getInputType = (type = '') => { @@ -115,41 +112,49 @@ class Edit extends React.PureComponent { orderAttributes = () => get(this.props.schema, ['editDisplay', 'fields'], []); + renderAttr = (attr, key) => { + if (attr.includes('__col-md')) { + const className = attr.split('__')[1]; + + return
; + } + + const details = get(this.props.schema, ['editDisplay', 'availableFields', attr]); + // Retrieve the input's bootstrapClass from the layout + const layout = this.getInputLayout(attr); + const appearance = get(layout, 'appearance'); + const type = !isEmpty(appearance) ? appearance.toLowerCase() : get(layout, 'type', getInputType(details.type)); + const inputDescription = get(details, 'description', null); + + return ( + + ); + } + render(){ return (
- {this.orderAttributes().map((attr, key) => { - const details = get(this.props.schema, ['editDisplay', 'availableFields', attr]); - // Retrieve the input's bootstrapClass from the layout - const layout = this.getInputLayout(attr); - const appearance = get(layout, 'appearance'); - const type = !isEmpty(appearance) ? appearance.toLowerCase() : get(layout, 'type', getInputType(details.type)); - const inputDescription = get(details, 'description', null); - - return ( - - ); - })} + {this.orderAttributes().map(this.renderAttr)}
); diff --git a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js index fe5263464b..5af179c08f 100644 --- a/packages/strapi-plugin-content-manager/config/functions/bootstrap.js +++ b/packages/strapi-plugin-content-manager/config/functions/bootstrap.js @@ -16,9 +16,8 @@ module.exports = async cb => { 'associations' ]); - const tempLayout = Object.keys(strapi.plugins).reduce((acc, current) => { + const pluginsLayout = Object.keys(strapi.plugins).reduce((acc, current) => { const models = _.get(strapi.plugins, [current, 'config', 'layout'], {}); - Object.keys(models).forEach(model => { const layout = _.get(strapi.plugins, [current, 'config', 'layout', model], {}); acc[model] = layout; @@ -27,6 +26,13 @@ module.exports = async cb => { return acc; }, {}); + const tempLayout = Object.keys(strapi.models) + .filter(m => m !== 'core_store') + .reduce((acc, current) => { + acc[current] = { attributes: {} }; + + return acc; + }, pluginsLayout); const models = _.mapValues(strapi.models, pickData); delete models['core_store'];