You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
980 B
TypeScript
39 lines
980 B
TypeScript
import { BaseContext } from "koa";
|
|
import { CollectionItem } from "sealious";
|
|
import { tempstream } from "tempstream";
|
|
import { Routes } from "../collections/collections";
|
|
import html from "../html";
|
|
import {
|
|
BaseListPageDefaultProps,
|
|
BaseListPageProps,
|
|
BaseListPagePropsShape,
|
|
SealiousItemListPage,
|
|
} from "../page/list";
|
|
import { AllQueryParams } from "../page/props-parser";
|
|
|
|
export const actionName = "ListRoutes";
|
|
|
|
export default new (class ListRoutesPage extends SealiousItemListPage<typeof Routes> {
|
|
propsParser = new AllQueryParams<BaseListPageProps>(
|
|
BaseListPagePropsShape,
|
|
BaseListPageDefaultProps
|
|
);
|
|
|
|
async render(ctx: BaseContext) {
|
|
return html(
|
|
ctx,
|
|
"Trasy",
|
|
tempstream/* HTML */ `<div>
|
|
<h2>Zapisane trasy</h2>
|
|
<ul>
|
|
${super.render(ctx)}
|
|
</ul>
|
|
</div>`
|
|
);
|
|
}
|
|
|
|
async renderItem(_: BaseContext, item: CollectionItem<typeof Routes>) {
|
|
return tempstream`<li><a href="">${item.get("name") as string}</a></li>`;
|
|
}
|
|
})(Routes);
|