Static CMS v2.0 (#226)
- [x] Update auf Static CMS v2.0 - [x] aktualisierte Shortcodes (schließt #225) - [x] aktualisierte Previews (schließt #181) - Ordnerunterstützung - [x] vervollständigte Seiten - [x] Aufräumarbeiten Reviewed-on: https://git.cantorgymnasium.de/gcg/gcg-website/pulls/226
This commit is contained in:
5
static/admin/previews/field-previews/body-preview.js
Normal file
5
static/admin/previews/field-previews/body-preview.js
Normal file
@ -0,0 +1,5 @@
|
||||
import { truncate } from "./components/index.js";
|
||||
|
||||
const BodyPreview = ({ value }) => h("p", {}, truncate(value ?? "", 50));
|
||||
|
||||
export default BodyPreview;
|
6
static/admin/previews/field-previews/boolean-preview.js
Normal file
6
static/admin/previews/field-previews/boolean-preview.js
Normal file
@ -0,0 +1,6 @@
|
||||
const BooleanPreview = ({ value }) =>
|
||||
h("i", {
|
||||
className: value ? "mdi mdi-check" : "mdi mdi-close",
|
||||
});
|
||||
|
||||
export default BooleanPreview;
|
3
static/admin/previews/field-previews/components/index.js
Normal file
3
static/admin/previews/field-previews/components/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import truncate from "./truncate.js";
|
||||
|
||||
export { truncate };
|
@ -0,0 +1,9 @@
|
||||
function truncate(str, num) {
|
||||
if (str.length > num) {
|
||||
return str.slice(0, num) + "...";
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
export default truncate;
|
3
static/admin/previews/field-previews/count-preview.js
Normal file
3
static/admin/previews/field-previews/count-preview.js
Normal file
@ -0,0 +1,3 @@
|
||||
const CountPreview = ({ value }) => (value ? value.length : 0);
|
||||
|
||||
export default CountPreview;
|
11
static/admin/previews/field-previews/date-preview.js
Normal file
11
static/admin/previews/field-previews/date-preview.js
Normal file
@ -0,0 +1,11 @@
|
||||
const DatePreview = ({ value }) =>
|
||||
h(
|
||||
"p",
|
||||
{},
|
||||
new Intl.DateTimeFormat("de-DE", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour12: false,
|
||||
}).format(new Date(value))
|
||||
);
|
21
static/admin/previews/field-previews/draft-preview.js
Normal file
21
static/admin/previews/field-previews/draft-preview.js
Normal file
@ -0,0 +1,21 @@
|
||||
const DraftPreview = ({ value }) =>
|
||||
h(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
backgroundColor: value === true ? "rgb(37 99 235)" : "rgb(22 163 74)",
|
||||
color: "white",
|
||||
border: "none",
|
||||
padding: "2px 6px",
|
||||
textAlign: "center",
|
||||
textDecoration: "none",
|
||||
display: "inline-block",
|
||||
cursor: "pointer",
|
||||
borderRadius: "4px",
|
||||
fontSize: "14px",
|
||||
},
|
||||
},
|
||||
value ? "Entwurf" : "Veröffentlicht"
|
||||
);
|
||||
|
||||
export default DraftPreview;
|
13
static/admin/previews/field-previews/index.js
Normal file
13
static/admin/previews/field-previews/index.js
Normal file
@ -0,0 +1,13 @@
|
||||
import BooleanPreview from "./boolean-preview.js";
|
||||
import DraftPreview from "./draft-preview.js";
|
||||
import CountPreview from "./count-preview.js";
|
||||
import BodyPreview from "./body-preview.js";
|
||||
import DraftPreview from "./draft-preview.js";
|
||||
|
||||
export {
|
||||
BooleanPreview,
|
||||
DraftPreview,
|
||||
CountPreview,
|
||||
BodyPreview,
|
||||
DraftPreview,
|
||||
};
|
Reference in New Issue
Block a user