mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Add D&P key to all models. Change UI modal divider
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
f5f0853942
commit
4b207e6cc0
@ -6,6 +6,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
@ -14,10 +15,6 @@
|
||||
"comment": ""
|
||||
},
|
||||
"attributes": {
|
||||
"city": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"postal_coder": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -45,6 +42,10 @@
|
||||
],
|
||||
"plugin": "upload",
|
||||
"required": false
|
||||
},
|
||||
"city": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": true,
|
||||
"comment": ""
|
||||
|
||||
@ -5,11 +5,9 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"timestamps": ["created_at", "updated_at"],
|
||||
"comment": ""
|
||||
},
|
||||
"attributes": {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"name": "Homepage"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": true
|
||||
},
|
||||
@ -20,21 +21,14 @@
|
||||
"single": {
|
||||
"model": "file",
|
||||
"via": "related",
|
||||
"allowedTypes": [
|
||||
"images",
|
||||
"files",
|
||||
"videos"
|
||||
],
|
||||
"allowedTypes": ["images", "files", "videos"],
|
||||
"plugin": "upload",
|
||||
"required": false
|
||||
},
|
||||
"multiple": {
|
||||
"collection": "file",
|
||||
"via": "related",
|
||||
"allowedTypes": [
|
||||
"images",
|
||||
"videos"
|
||||
],
|
||||
"allowedTypes": ["images", "videos"],
|
||||
"plugin": "upload",
|
||||
"required": false
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": true,
|
||||
"comment": ""
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": true,
|
||||
"comment": ""
|
||||
|
||||
@ -6,11 +6,9 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"timestamps": ["created_at", "updated_at"],
|
||||
"comment": ""
|
||||
},
|
||||
"attributes": {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": ["created_at", "updated_at"],
|
||||
"comment": ""
|
||||
|
||||
@ -5,11 +5,9 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"increments": true,
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"timestamps": ["created_at", "updated_at"],
|
||||
"comment": ""
|
||||
},
|
||||
"attributes": {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"timestamps": false
|
||||
},
|
||||
"attributes": {
|
||||
|
||||
@ -5,10 +5,8 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
"updated_at"
|
||||
]
|
||||
"draftAndPublish": false,
|
||||
"timestamps": ["created_at", "updated_at"]
|
||||
},
|
||||
"attributes": {
|
||||
"username": {
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
"name": "test",
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"attributes": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
|
||||
@ -11,8 +11,9 @@ import {
|
||||
useQuery,
|
||||
InputsIndex,
|
||||
} from 'strapi-helper-plugin';
|
||||
import { Button, Label } from '@buffetjs/core';
|
||||
import { Button, Text, Padded } from '@buffetjs/core';
|
||||
import { Inputs } from '@buffetjs/custom';
|
||||
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { get, has, isEmpty, set, toLower, toString, upperFirst } from 'lodash';
|
||||
@ -1129,20 +1130,22 @@ const FormModal = () => {
|
||||
// It is the one responsible for displaying the settings label
|
||||
if (input.type === 'divider') {
|
||||
return (
|
||||
<div
|
||||
className="col-12"
|
||||
style={{
|
||||
marginBottom: '1.4rem',
|
||||
lineHeight: 'normal',
|
||||
fontWeight: 500,
|
||||
}}
|
||||
key="divider"
|
||||
>
|
||||
<Label htmlFor="divider-no-for">
|
||||
<FormattedMessage
|
||||
id={getTrad('form.attribute.item.settings.name')}
|
||||
/>
|
||||
</Label>
|
||||
<div className="col-12" key="divider">
|
||||
<Padded bottom size="smd">
|
||||
<div style={{ paddingTop: 3 }} />
|
||||
<Text
|
||||
fontSize="xs"
|
||||
color="grey"
|
||||
fontWeight="bold"
|
||||
textTransform="uppercase"
|
||||
>
|
||||
<FormattedMessage
|
||||
id={getTrad('form.attribute.item.settings.name')}
|
||||
>
|
||||
{txt => txt}
|
||||
</FormattedMessage>
|
||||
</Text>
|
||||
</Padded>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -823,6 +823,7 @@ const forms = {
|
||||
.isAllowed(getTrad('error.contentTypeName.reserved-name'), reservedNames.models)
|
||||
.required(errorsTrads.required),
|
||||
collectionName: yup.string(),
|
||||
draftAndPublish: yup.boolean(),
|
||||
kind: yup.string().oneOf(['singleType', 'collectionType']),
|
||||
});
|
||||
},
|
||||
|
||||
@ -15,6 +15,7 @@ const createSchema = (types, relations, { modelType } = {}) => {
|
||||
.min(1)
|
||||
.required('name.required'),
|
||||
description: yup.string(),
|
||||
draftAndPublish: yup.boolean(),
|
||||
connection: yup.string(),
|
||||
collectionName: yup
|
||||
.string()
|
||||
|
||||
@ -14,7 +14,7 @@ const { nameToSlug } = require('strapi-utils');
|
||||
* @param {Object} contentType
|
||||
*/
|
||||
const formatContentType = contentType => {
|
||||
const { uid, kind, modelName, plugin, connection, collectionName, info } = contentType;
|
||||
const { uid, kind, modelName, plugin, connection, collectionName, info, options } = contentType;
|
||||
|
||||
return {
|
||||
uid,
|
||||
@ -23,6 +23,7 @@ const formatContentType = contentType => {
|
||||
schema: {
|
||||
name: _.get(info, 'name') || _.upperFirst(pluralize(uid)),
|
||||
description: _.get(info, 'description', ''),
|
||||
draftAndPublish: _.get(options, 'draftAndPublish', false),
|
||||
connection,
|
||||
kind: kind || 'collectionType',
|
||||
collectionName,
|
||||
|
||||
@ -104,6 +104,8 @@ module.exports = function createComponentBuilder() {
|
||||
editContentType(infos) {
|
||||
const { uid } = infos;
|
||||
|
||||
console.log({ infos });
|
||||
|
||||
if (!this.contentTypes.has(uid)) {
|
||||
throw new Error('contentType.notFound');
|
||||
}
|
||||
@ -184,6 +186,7 @@ module.exports = function createComponentBuilder() {
|
||||
.set('kind', infos.kind || contentType.schema.kind)
|
||||
.set(['info', 'name'], infos.name)
|
||||
.set(['info', 'description'], infos.description)
|
||||
.set(['options', 'draftAndPublish'], infos.draftAndPublish)
|
||||
.setAttributes(this.convertAttributes(newAttributes));
|
||||
|
||||
return contentType;
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false,
|
||||
"timestamps": true
|
||||
},
|
||||
"attributes": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user