gcg-website/static/admin/config/collections/widgets.js

104 lines
1.9 KiB
JavaScript
Raw Normal View History

2023-05-29 16:22:34 +02:00
import { DataObject } from "../props.js";
2023-05-11 06:44:30 +02:00
const EnableBoolean = {
2023-05-29 16:22:34 +02:00
name: "enable",
label: "Aktivieren",
widget: "boolean",
required: false,
};
const DisableBoolean = {
name: "disable",
label: "Deaktivieren",
widget: "boolean",
required: false,
2023-05-11 06:44:30 +02:00
};
const DraftBoolean = {
2023-05-29 16:22:34 +02:00
name: "draft",
label: "Entwurf",
widget: "boolean",
default: false,
required: false,
};
2023-05-11 06:44:30 +02:00
const Title = (optional = false) => ({
2023-05-29 16:22:34 +02:00
name: "title",
label: "Titel",
widget: "string",
required: !optional,
2023-05-11 06:44:30 +02:00
});
const DescriptionText = {
2023-05-29 16:22:34 +02:00
name: "description",
label: "Beschreibung",
widget: "text",
required: false,
};
const IconList = {
name: "icon",
label: "Symbol",
widget: "string",
required: false,
2024-01-20 20:09:43 +01:00
hint: "Liste unter https://assets.cantorgymnasium.de/fonts/mdi/v7/preview.html. Das `mdi` am Anfang ist wegzulassen.",
2023-05-11 06:44:30 +02:00
};
2023-05-29 16:22:34 +02:00
const PreviewNumber = {
name: "number",
label: "Anzahl",
hint: "Anzahl der Elemente, die auf der Startseite angezeigt werden sollen.",
widget: "number",
value_type: "int",
min: 0,
step: 1,
required: true,
};
const ButtonObject = {
name: "button",
label: "Button",
...DataObject,
fields: [
EnableBoolean,
{
name: "label",
label: "Aufschrift",
widget: "string",
required: false,
},
{
name: "link",
label: "Link",
widget: "string",
required: false,
},
],
};
2023-10-01 15:24:00 +02:00
const AuthorRelation = {
name: "author",
label: "Autor(en)",
hint: "Verwaltet im Autoren-Bereich. Mehrere Autoren werden in alphabetischer Reihenfolge aufgelistet.",
widget: "relation",
collection: "author",
value_field: "{{slug}}",
search_fields: ["title"],
display_fields: ["{{title}}"],
multiple: true,
required: true,
options_length: 10000,
};
2023-05-29 16:22:34 +02:00
export {
EnableBoolean,
DisableBoolean,
DraftBoolean,
Title,
DescriptionText,
IconList,
PreviewNumber,
ButtonObject,
2023-10-01 15:24:00 +02:00
AuthorRelation,
2023-05-29 16:22:34 +02:00
};