From 0db409c780c7a132b52a1ede355831a3893a53c5 Mon Sep 17 00:00:00 2001 From: lexx Date: Mon, 30 Oct 2023 22:49:27 +0200 Subject: [PATCH] docs --- README.md | 5 ++ docs/Deployment.md | 0 docs/Fields.md | 138 +++++++++++++++++++++++++++++++++++++ docs/Records.md | 0 docs/Schemas.md | 85 +++++++++++++++++++++++ src/Schema/BlockSchema.php | 2 +- 6 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 docs/Deployment.md create mode 100644 docs/Records.md diff --git a/README.md b/README.md index a020d83..d39fd37 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +--- +gitea: none +include_toc: true +--- + # Lucent for Laravel ## Installation diff --git a/docs/Deployment.md b/docs/Deployment.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Fields.md b/docs/Fields.md index e69de29..a7dff50 100644 --- a/docs/Fields.md +++ b/docs/Fields.md @@ -0,0 +1,138 @@ +--- +gitea: none +include_toc: true +--- + +# Fields + +Fields are similar to a table's columns in a relational databases. + +## Available fields for Collections and Files + +### text +One-line text input + +required + +- **name**: The id of the field +- **label**: The friendly name of the field + +optional + +- **required**: Is the field required to save the record +- **nullable**: Can the field be saved as null +- **min**: Minimum characters +- **max**: Maximum characters +- **help**: Help text +- **default**: Default value when creating new record +- **readonly**: Cannot edit this value from the UI +- **optionsFrom**: Schema to choose options from +- **optionsField**: Field's value to insert +- **optionsSuggest**: Allow to insert new values +- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]` +- **group**: The group that this field belongs to. + +### textarea +textarea input + +required + +- **name**: The id of the field +- **label**: The friendly name of the field + +optional + +- **required**: Is the field required to save the record +- **nullable**: Can the field be saved as null +- **min**: Minimum characters +- **max**: Maximum characters +- **help**: Help text +- **default**: Default value when creating new record +- **readonly**: Cannot edit this value from the UI +- **group**: The group that this field belongs to. + +### slug +Slug input. Generates automatically if left empty + +required + +- **name**: The id of the field +- **label**: The friendly name of the field +- **source**: The source field from which it generates + +optional + +- **required**: Is the field required to save the record +- **nullable**: Can the field be saved as null +- **min**: Minimum characters +- **max**: Maximum characters +- **help**: Help text +- **default**: Default value when creating new record +- **readonly**: Cannot edit this value from the UI +- **group**: The group that this field belongs to. + +### rich +WYSIWYG editor + +required + +- **name**: The id of the field +- **label**: The friendly name of the field + +optional + +- **required**: Is the field required to save the record +- **nullable**: Can the field be saved as null +- **min**: Minimum characters +- **max**: Maximum characters +- **help**: Help text +- **default**: Default value when creating new record +- **readonly**: Cannot edit this value from the UI +- **group**: The group that this field belongs to. + +### number +Any numeric value + +required + +- **name**: The id of the field +- **label**: The friendly name of the field + +optional + +- **decimals**: default is 0 +- **required**: Is the field required to save the record +- **nullable**: Can the field be saved as null +- **min**: Minimum characters +- **max**: Maximum characters +- **help**: Help text +- **default**: Default value when creating new record +- **readonly**: Cannot edit this value from the UI +- **optionsFrom**: Schema to choose options from +- **optionsField**: Field's value to insert +- **optionsSuggest**: Allow to insert new values +- **group**: The group that this field belongs to. + +### checkbox +Any numeric value + +required + +- **name**: The id of the field +- **label**: The friendly name of the field + +optional + +- **required**: Is the field required to save the record +- **nullable**: Can the field be saved as null +- **help**: Help text +- **default**: Default value when creating new record +- **readonly**: Cannot edit this value from the UI +- **group**: The group that this field belongs to. + + +### block +The block editor + + +## Available fields for the Block Editor \ No newline at end of file diff --git a/docs/Records.md b/docs/Records.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Schemas.md b/docs/Schemas.md index e69de29..97b3246 100644 --- a/docs/Schemas.md +++ b/docs/Schemas.md @@ -0,0 +1,85 @@ +# Schemas + +Schemas define both the shape of your data and how the UI on the admin will behave. + +There are 3 types of schemas + +- Collections: Normal data +- Files: Images and files +- Block: Used in the block editor + + +## Collection Reference + +- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts +- **label**: The friendly name of the schema +- **type**: The type of the collection. Should be "collection" +- **visible**: An array of field id to show on the content browser _optional_ +- **groups**: A list if group ids to separate your field in different tabs _optional_ +- **fields**: The list of your fields. Look the field reference for more +- **isEntry**: If this schema is important, it will show be visible on the main the sidebar. Default: false _optional_ +- **sortBy**: The default sorting in the content browser _optional_ +- **titleTemplate**: Mustache code to customize the preview field _optional_ +- **revisions**: How many revisions are going to be kept for each record _optional_ +- **read**: Array of user groups that have read permissions _optional_ +- **write**: Array of user groups that have write permissions _optional_ + + +## Files Reference + +- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts +- **label**: The friendly name of the schema +- **type**: The type of the collection. Should be "files" +- **path**: The relative directory that these files will be stored. +- **groups**: A list if group ids to separate your field in different tabs _optional_ +- **fields**: The list of your fields. Look the field reference for more +- **isEntry**: If this schema is important, it will show be visible on the main the sidebar _optional_ +- **sortBy**: The default sorting in the content browser _optional_ +- **titleTemplate**: Mustache code to customize the preview field _optional_ +- **revisions**: How many revisions are going to be kept for each record _optional_ +- **read**: Array of user groups that have read permissions _optional_ +- **write**: Array of user groups that have write permissions _optional_ + + +## Block Reference + +- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts +- **label**: The friendly name of the schema +- **type**: The type of the collection. Should be "block" +- **fields**: The list of your fields. Look the field reference for more + + +A full Collection example without the fields: + +```json +{ + "label": "Departments", + "name": "departments", + "isEntry": true, + "type": "collection", + "visible": [ + "slug", + "cover", + "_sys.updatedAt", + "status" + ], + "groups": [ + "Extra Info", + "Metadata", + "SEO" + ], + "sortBy": "-_sys.createdAt", + "titleTemplate": "{{name}} {{slug}}", + "revisions": 15, + "read": [ + "admin", + "editors", + "reviewers" + ], + "write": [ + "admin", + "editors" + ], + "fields": [] +} +``` \ No newline at end of file diff --git a/src/Schema/BlockSchema.php b/src/Schema/BlockSchema.php index cf83693..d9c1592 100644 --- a/src/Schema/BlockSchema.php +++ b/src/Schema/BlockSchema.php @@ -4,7 +4,7 @@ namespace Lucent\Schema; use Lucent\Primitive\Collection; -class BlockSchema implements Schema +class BlockSchema implements Schemafilesc { public Type $type = Type::BLOCK;