mirror of
https://github.com/strapi/strapi.git
synced 2025-12-16 01:34:23 +00:00
Add ordering to displayed fields in ctm
This commit is contained in:
parent
8d176dee31
commit
6bc6862b14
@ -73,7 +73,7 @@ class InputFileWithErrors extends React.Component {
|
||||
|
||||
InputFileWithErrors.defaultProps = {
|
||||
className: '',
|
||||
customBootstrapClass: 'col-md-6',
|
||||
customBootstrapClass: 'col-md-12',
|
||||
inputDescription: '',
|
||||
inputDescriptionClassName: '',
|
||||
inputDescriptionStyle: {},
|
||||
|
||||
@ -70,6 +70,7 @@ class Edit extends React.PureComponent {
|
||||
setLayout = (props) => {
|
||||
const currentLayout = get(props.layout, [props.modelName, 'attributes']);
|
||||
const displayedFields = merge(this.getUploadRelations(props), get(currentLayout), omit(props.schema.fields, 'id'));
|
||||
|
||||
this.setState({ currentLayout, displayedFields });
|
||||
}
|
||||
|
||||
@ -125,11 +126,13 @@ class Edit extends React.PureComponent {
|
||||
|
||||
fileRelationAllowMultipleUpload = (relationName) => has(this.props.schema, ['relations', relationName, 'collection']);
|
||||
|
||||
orderAttributes = (displayedFields) => Object.keys(displayedFields).sort(name => Object.keys(this.getUploadRelations(this.props)).includes(name));
|
||||
|
||||
render(){
|
||||
return (
|
||||
<div className={styles.form}>
|
||||
<div className="row">
|
||||
{Object.keys(this.state.displayedFields).map((attr, key) => {
|
||||
{this.orderAttributes(this.state.displayedFields).map((attr, key) => {
|
||||
const details = this.state.displayedFields[attr];
|
||||
// Retrieve the input's bootstrapClass from the layout
|
||||
const layout = this.getInputLayout(attr);
|
||||
|
||||
@ -79,7 +79,7 @@ module.exports = {
|
||||
|
||||
update: async ctx => {
|
||||
const { source } = ctx.request.query;
|
||||
|
||||
console.log('hhhh', ctx.request.body);
|
||||
try {
|
||||
// Return the last one which is the current model.
|
||||
ctx.body = await strapi.plugins['content-manager'].services['contentmanager'].edit(ctx.params, ctx.request.body, source);
|
||||
|
||||
@ -87,7 +87,7 @@ function* search() {
|
||||
} : {};
|
||||
const response = yield call(request, requestURL, { method: 'GET', params });
|
||||
const entries = response.length === 0 ? [] : response.map(obj => Map(obj));
|
||||
|
||||
|
||||
yield put(onSearchSuccess(entries));
|
||||
} catch(err) {
|
||||
strapi.notification.error('notification.error');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user