categories configuration
This commit is contained in:
@ -37,9 +37,8 @@
|
||||
textAlign: "center",
|
||||
textDecoration: "none",
|
||||
display: "inline-block",
|
||||
cursor: "pointer",
|
||||
borderRadius: "4px",
|
||||
fontSize: "14px",
|
||||
alignSelf: "center",
|
||||
},
|
||||
},
|
||||
value ? "Entwurf" : "Veröffentlicht"
|
||||
@ -59,15 +58,35 @@
|
||||
textAlign: "center",
|
||||
textDecoration: "none",
|
||||
display: "inline-block",
|
||||
cursor: "pointer",
|
||||
borderRadius: "4px",
|
||||
fontSize: "14px",
|
||||
alignSelf: "center",
|
||||
},
|
||||
},
|
||||
value ? "Entwurf" : "Veröffentlicht"
|
||||
)
|
||||
);
|
||||
|
||||
CMS.registerFieldPreview("categories", "style", ({ value }) =>
|
||||
h(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
backgroundColor: value.background,
|
||||
color: value.color,
|
||||
border: "none",
|
||||
padding: "2px 6px",
|
||||
textAlign: "center",
|
||||
textDecoration: "none",
|
||||
display: "inline-block",
|
||||
borderRadius: "4px",
|
||||
alignSelf: "center",
|
||||
},
|
||||
},
|
||||
"Test"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
CMS.registerPreviewTemplate(
|
||||
"post",
|
||||
({ widgetFor, entry, fields, collection }) => {
|
||||
@ -165,6 +184,51 @@
|
||||
}
|
||||
);
|
||||
|
||||
CMS.registerPreviewTemplate(
|
||||
"categories",
|
||||
({ widgetFor, entry }) => {
|
||||
return h(
|
||||
"main",
|
||||
{ className: "article-page full-width" },
|
||||
h("article", { className: "main-article", style: {margin: "16px"} },
|
||||
h("header", { className: "article-header" },
|
||||
h("div", { className: "article-details" },
|
||||
h("header", { className: "article-category" },
|
||||
h("a", { style: { "background-color": entry.data.style.background, "color": entry.data.style.color } }, entry.data.title)
|
||||
),
|
||||
h("div", { className: "article-title-wrapper" },
|
||||
h("h2", { className: "article-title" },
|
||||
h("a", {}, entry.data.title)
|
||||
),
|
||||
h("h3", { className: "article-subtitle" },
|
||||
entry.data.description
|
||||
)
|
||||
),
|
||||
h("footer", { className: "article-time" },
|
||||
h("div", {},
|
||||
h("time", { className: "article-time--published" }, ((entry.data.date != null && entry.data.date != "") ? new Intl.DateTimeFormat("de-DE", {dateStyle: "long"}).format(new Date(entry.data.date)) : ""))
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
CMS.registerEventListener({
|
||||
name: "change",
|
||||
collection: "categories",
|
||||
// file: 'global', // You can specify a file if in a file collection
|
||||
field: 'image',
|
||||
handler: ({ data, collection, field }) => {
|
||||
return {
|
||||
...data,
|
||||
image: data.image.replace("static", ""),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
{{ $sass := resources.Get "scss/style.scss" }}
|
||||
{{ $style := $sass | resources.ToCSS | minify | resources.Fingerprint "sha256" }}
|
||||
CMS.registerPreviewStyle("{{ $style.RelPermalink }}")
|
||||
|
Reference in New Issue
Block a user