From a9d794c60105032680af7895383cd8c86297479e Mon Sep 17 00:00:00 2001 From: cyril lopez Date: Wed, 28 Feb 2018 17:43:59 +0100 Subject: [PATCH 1/2] Prevent inputText breaking if placeholder empty --- .../lib/src/components/InputText/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/strapi-helper-plugin/lib/src/components/InputText/index.js b/packages/strapi-helper-plugin/lib/src/components/InputText/index.js index cb9182600d..3ee5f6f494 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputText/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputText/index.js @@ -7,8 +7,10 @@ import cn from 'classnames'; import styles from './styles.scss'; function InputText(props) { + const placeholder = isEmpty(props.placeholder) ? 'app.utils.placeholder.defaultMessage' : props.placeholder; + return ( - + {(message) => ( )} - ) + ); } InputText.defaultProps = { From 4d21ade9b5ed1826b42d4e4ca0fa8ab16a310caf Mon Sep 17 00:00:00 2001 From: cyril lopez Date: Wed, 28 Feb 2018 17:58:58 +0100 Subject: [PATCH 2/2] Prevent from displaying the media field if the upload pliugin is not installed --- .../admin/src/containers/Form/index.js | 34 ++++++++++++------- .../models/User.settings.json | 6 +--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js index e39db9d8c0..ab2f77ad28 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js @@ -14,6 +14,7 @@ import { findIndex, filter, get, + has, includes, isEmpty, isUndefined, @@ -455,18 +456,27 @@ export class Form extends React.Component { // eslint-disable-line react/prefer- } } - renderModalBodyChooseAttributes = () => ( - map(forms.attributesDisplay.items, (attribute, key) => ( - - )) - ) + renderModalBodyChooseAttributes = () => { + const attributesDisplay = forms.attributesDisplay.items; + + // Don't display the media field if the upload plugin isn't installed + if (!has(this.context.plugins.toJS(), 'upload')) { + attributesDisplay.splice(8, 1); + } + + return ( + map(attributesDisplay, (attribute, key) => ( + + )) + ); + } testContentType = (contentTypeName, cbSuccess, successData, cbFail, failData) => { // Check if the content type is in the localStorage (not saved) to prevent request error diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json index d7d33e058c..99479b1cba 100644 --- a/packages/strapi-plugin-users-permissions/models/User.settings.json +++ b/packages/strapi-plugin-users-permissions/models/User.settings.json @@ -38,10 +38,6 @@ "via": "users", "plugin": "users-permissions", "configurable": false - }, - "products": { - "collection": "product", - "via": "manager" } } -} \ No newline at end of file +}