import { Context } from "koa"; import { CollectionItem } from "sealious"; import { tempstream } from "tempstream"; import { Posts } from "../collections/collections"; import html from "../html"; import { SealiousItemListPage, BaseListPageFields } from "@sealcode/sealgen"; export const actionName = "ListPosts"; const filterFields = {}; export default new (class ListPostsPage extends SealiousItemListPage< typeof Posts, typeof BaseListPageFields > { fields = BaseListPageFields; filterFields = filterFields; filterControls = []; async render(ctx: Context) { return html( ctx, "Posts", tempstream/* HTML */ `

Posts List

${Object.keys(Posts.fields).map( (fieldname) => `` )} ${super.render(ctx)}
id${fieldname}
` ); } async renderItem(_: Context, item: CollectionItem) { return tempstream`${item.id}${Object.keys(Posts.fields).map( (fieldname: keyof typeof Posts["fields"]) => tempstream`${item.get(fieldname)}` )}`; } })(Posts);