Merge pull request #717 from strapi/fix-ctb

Fix ctb
This commit is contained in:
Jim LAURIE 2018-03-05 15:36:06 +01:00 committed by GitHub
commit 4bca88c070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 14 deletions

View File

@ -7,8 +7,10 @@ import cn from 'classnames';
import styles from './styles.scss'; import styles from './styles.scss';
function InputText(props) { function InputText(props) {
const placeholder = isEmpty(props.placeholder) ? 'app.utils.placeholder.defaultMessage' : props.placeholder;
return ( return (
<FormattedMessage id={props.placeholder} defaultMessage={props.placeholder}> <FormattedMessage id={placeholder} defaultMessage={placeholder}>
{(message) => ( {(message) => (
<input <input
autoFocus={props.autoFocus} autoFocus={props.autoFocus}
@ -32,7 +34,7 @@ function InputText(props) {
/> />
)} )}
</FormattedMessage> </FormattedMessage>
) );
} }
InputText.defaultProps = { InputText.defaultProps = {

View File

@ -14,6 +14,7 @@ import {
findIndex, findIndex,
filter, filter,
get, get,
has,
includes, includes,
isEmpty, isEmpty,
isUndefined, isUndefined,
@ -455,8 +456,16 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
} }
} }
renderModalBodyChooseAttributes = () => ( renderModalBodyChooseAttributes = () => {
map(forms.attributesDisplay.items, (attribute, key) => ( 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) => (
<AttributeCard <AttributeCard
key={key} key={key}
attribute={attribute} attribute={attribute}
@ -466,7 +475,8 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
tabIndex={key} tabIndex={key}
/> />
)) ))
) );
}
testContentType = (contentTypeName, cbSuccess, successData, cbFail, failData) => { testContentType = (contentTypeName, cbSuccess, successData, cbFail, failData) => {
// Check if the content type is in the localStorage (not saved) to prevent request error // Check if the content type is in the localStorage (not saved) to prevent request error