Merge branch 'plugin/content-type-builder-dev' of github.com:strapi/strapi into plugin/content-type-builder-dev

This commit is contained in:
Aurelsicoko 2017-09-21 15:02:13 +02:00
commit 2e534cd64d
12 changed files with 28 additions and 16 deletions

View File

@ -101,11 +101,11 @@ class Input extends React.Component { // eslint-disable-line react/prefer-statel
}
handleChangeCheckbox = (e) => {
handleChangeCheckbox = () => {
const target = {
type: e.target.type,
type: 'checkbox',
value: !this.props.value,
name: e.target.name,
name: this.props.name,
};
this.props.handleChange({ target });
@ -130,15 +130,15 @@ class Input extends React.Component { // eslint-disable-line react/prefer-statel
renderInputCheckbox = (requiredClass, inputDescription) => {
const title = !isEmpty(this.props.title) ? <div className={styles.inputTitle}><FormattedMessage id={this.props.title} /></div> : '';
const spacer = !inputDescription ? <div /> : <div style={{ marginBottom: '.5rem'}}></div>;
return (
<div className={`${styles.inputCheckbox} col-md-12 ${requiredClass}`}>
<div className="form-check">
{title}
<FormattedMessage id={this.props.label}>
{(message) => (
<label className={`${styles.checkboxLabel} form-check-label`} htmlFor={this.props.label}>
<input className="form-check-input" type="checkbox" defaultChecked={this.props.value} onChange={this.handleChangeCheckbox} name={this.props.name} />
<label className={`${styles.checkboxLabel} form-check-label`} htmlFor={this.props.label} onClick={this.handleChangeCheckbox} style={{ cursor: 'pointer' }}>
<input className="form-check-input" type="checkbox" checked={this.props.value} name={this.props.name} />
{message}
</label>
)}

View File

@ -97,6 +97,7 @@
color: #9EA7B8;
font-family: Lato;
font-size: 1.2rem;
font-weight: 400;
}
}
@ -109,6 +110,7 @@
color: #9EA7B8;
font-family: Lato;
font-size: 1.2rem;
font-weight: 400;
}
}
@ -119,6 +121,7 @@
color: #9EA7B8;
font-family: Lato;
font-size: 1.2rem;
font-weight: 400;
}
}

View File

@ -12,11 +12,11 @@ import Input from 'components/Input';
import styles from './styles.scss';
class InputCheckboxWithNestedInputs extends React.Component { // eslint-disable-line react/prefer-stateless-function
handleChange = (e) => {
handleChange = () => {
const target = {
type: e.target.type,
type: 'checkbox',
value: !this.props.value[this.props.data.name.split('.')[1]],
name: e.target.name,
name: this.props.data.name,
};
this.props.handleChange({ target });
}
@ -61,8 +61,8 @@ class InputCheckboxWithNestedInputs extends React.Component { // eslint-disable-
{title}
<FormattedMessage id={this.props.data.label}>
{(message) => (
<label className={`${styles.checkboxLabel} form-check-label`} htmlFor={this.props.data.label}>
<input className="form-check-input" type="checkbox" defaultChecked={this.props.value[this.props.data.name.split('.')[1]]} onChange={this.handleChange} name={this.props.data.name} />
<label className={`${styles.checkboxLabel} form-check-label`} htmlFor={this.props.data.label} onClick={this.handleChange} style={{ cursor: 'pointer' }}>
<input className="form-check-input" type="checkbox" checked={this.props.value[this.props.data.name.split('.')[1]]} name={this.props.data.name} />
{message}
</label>
)}

View File

@ -42,7 +42,7 @@ li:not(:first-child) {
color: #2D3138 !important;
> div {
> i {
color: #2D3138;
color: #2D3138 !important
}
}
}

View File

@ -22,7 +22,7 @@ class PopUpHeaderNavLink extends React.Component { // eslint-disable-line react/
const activeClass = includes(this.props.routePath, this.props.name) ? styles.popUpHeaderNavLink : '';
return (
<div className={activeClass} onClick={this.goTo}>
<div className={activeClass} onClick={this.goTo} style={{ cursor: 'pointer' }}>
<FormattedMessage id={this.props.message} />
</div>
);

View File

@ -41,7 +41,7 @@
.input {
> div {
> label {
font-weight: 600;
font-weight: 500;
}
}
}

View File

@ -6,7 +6,7 @@ import { modelsFetchSucceeded } from './actions';
export function* deleteContentType(action) {
try {
if (action.sendRequest) {
const requestUrl = `content-type-builder/models/${action.itemToDelete}`;
const requestUrl = `/content-type-builder/models/${action.itemToDelete}`;
yield call(request, requestUrl, { method: 'DELETE' });
}

View File

@ -151,6 +151,7 @@ export function setAttributeForm(hash) {
nature: 'oneToOne',
required: false,
unique: false,
dominant: false,
}),
});
const attribute = includes(hash, 'attributerelation') ? attributeRelation : data.attribute;
@ -248,6 +249,7 @@ function setAttributeFormData(hash) {
params: Map({
type,
required: false,
unique: false,
maxLength: false,
minLength: false,
min: false,

View File

@ -498,7 +498,7 @@
"type": "checkbox",
"value": false,
"validations": {},
"inputDescription": "content-type-builder.orm.attribute.item.uniqueField.description"
"inputDescription": "content-type-builder.form.attribute.item.uniqueField.description"
},
{
"label": "content-type-builder.form.attribute.item.customColumnName",

View File

@ -381,6 +381,11 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
if (includes(this.props.hash.split('::')[1], 'attribute')) {
this.props.changeInputAttribute(target.name, value);
if (target.name === 'params.nature' && target.value === "manyToMany") {
this.props.changeInputAttribute('params.dominant', true);
}
} else {
this.props.changeInput(target.name, value, includes(this.props.hash, 'edit'));
}

View File

@ -9,6 +9,7 @@ export default function setParallelAttribute(newAttribute) {
parallelAttribute.params.key = newAttribute.name;
parallelAttribute.params.columnName = newAttribute.params.targetColumnName;
parallelAttribute.params.targetColumnName = newAttribute.params.columnName;
parallelAttribute.params.dominant = false;
return parallelAttribute;
}
return;

View File

@ -174,6 +174,7 @@ function setParallelAttribute(data) {
parallelAttribute.name = data.params.key;
parallelAttribute.params.columnName = data.params.targetColumnName;
parallelAttribute.params.targetColumnName = data.params.columnName;
parallelAttribute.params.dominant = false;
return parallelAttribute;
}