From 7af5a7bb4666750e081299ef55d40653baa7027b Mon Sep 17 00:00:00 2001 From: Ruben van Erk Date: Fri, 18 Oct 2024 21:32:37 +0200 Subject: [PATCH] Add config_list.yaml schema --- README.md | 9 +++ config_list.json | 160 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 config_list.json diff --git a/README.md b/README.md index c2d8837..6df0c00 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,15 @@ https://raw.githubusercontent.com/inetis-ch/october-schemas/master/columns.json ``` [October CMS documentation](https://octobercms.com/docs/backend/lists#list-columns) +## List config `config_list.yaml` +> The list configuration is used for creating backend record list + +**config_list.yaml schema URL**: +``` +https://raw.githubusercontent.com/inetis-ch/october-schemas/master/config_list.json +``` +[October CMS documentation](https://docs.octobercms.com/3.x/extend/lists/list-controller.html) + --- ## Setup your IDE for autocomplete diff --git a/config_list.json b/config_list.json new file mode 100644 index 0000000..7c20466 --- /dev/null +++ b/config_list.json @@ -0,0 +1,160 @@ +{ + "title": "JSON schema for OctoberCMS list configuration", + "$schema": "http://json-schema.org/draft-07/schema#", + "$comment": "https://docs.octobercms.com/3.x/extend/lists/list-controller.html", + "type": "object", + "required": [ + "title", + "list", + "modelClass" + ], + "properties": { + "title": { + "type": "string", + "description": "A title for this list." + }, + "list": { + "type": [ + "array", + "string" + ], + "description": "A configuration array or reference to a list column definition file." + }, + "modelClass": { + "type": "string", + "description": "The model class name, the list data is loaded from this model." + }, + "filter": { + "type": [ + "object", + "string" + ], + "description": "Filter configuration, either as an array with the configuration or a reference to a filter configuration file." + }, + "recordUrl": { + "type": "string", + "description": "Link each list record to another page, e.g., users/update:id." + }, + "recordOnClick": { + "type": "string", + "description": "Custom JavaScript code to execute when clicking on a record." + }, + "noRecordsMessage": { + "type": "string", + "description": "Message to display when no records are found." + }, + "deleteMessage": { + "type": "string", + "description": "Message to display when records are bulk deleted." + }, + "noRecordsDeletedMessage": { + "type": "string", + "description": "Message to display when a bulk delete action is triggered, but no records were deleted." + }, + "recordsPerPage": { + "type": "integer", + "description": "Records to display per page, use 0 for no pages.", + "default": 0 + }, + "perPageOptions": { + "type": "array", + "items": { + "type": "integer" + }, + "description": "Options for number of items per page.", + "default": [ + 20, + 40, + 80, + 100, + 120 + ] + }, + "showPageNumbers": { + "type": "boolean", + "description": "Displays page numbers with pagination.", + "default": true + }, + "toolbar": { + "type": "object", + "description": "Reference to a Toolbar Widget configuration file, or an array with configuration.", + "properties": { + "buttons": { + "type": "string", + "description": "A reference to a controller partial file with the toolbar buttons. Eg: _list_toolbar.htm" + }, + "search": { + "type": [ + "object", + "string" + ], + "description": "Reference to a Search Widget configuration file, or an array with configuration.", + "properties": { + "prompt": { + "type": "string", + "description": "A placeholder to display when there is no active search, can refer to a localization string." + }, + "mode": { + "type": "string", + "description": "Defines the search strategy to either contain all words, any word or exact phrase. Supported options: all, any, exact.", + "enum": [ + "all", + "any", + "exact" + ], + "default": "all" + }, + "scope": { + "type": "string", + "description": "Specifies a query scope method defined in the list model to apply to the search query. The first argument will contain the query object (as per a regular scope method), the second will contain the search term, and the third will be an array of the columns to be searched." + }, + "searchOnEnter": { + "type": "boolean", + "description": "Setting this to true will make the search widget wait for the Enter key to be pressed before it starts searching. Default: false.", + "default": false + } + } + } + } + }, + "showSorting": { + "type": "boolean", + "description": "Displays the sorting link on each column.", + "default": true + }, + "defaultSort": { + "type": [ + "object", + "string" + ], + "description": "Sets a default sorting column and direction." + }, + "showCheckboxes": { + "type": "boolean", + "description": "Displays checkboxes next to each record.", + "default": false + }, + "showSetup": { + "type": "boolean", + "description": "Displays the list column set up button.", + "default": false + }, + "structure": { + "type": "boolean", + "description": "Enables a structured list.", + "default": false + }, + "customViewPath": { + "type": "string", + "description": "Specify a custom view path to override partials used by the list." + }, + "customPageName": { + "type": [ + "string", + "boolean" + ], + "description": "Specify a custom variable name to use in the page URL for paginated records.", + "default": "page" + } + } +} \ No newline at end of file