You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
<script>
|
|
let thePage = new PaginateTable("/api/admin/table/{{ .table }}");
|
|
|
|
$boot(async () => {
|
|
const items = await thePage.contents();
|
|
const tmpl = $id('table-row');
|
|
const rows = $id('table-items');
|
|
|
|
for(let item of items) {
|
|
console.log("ITEM", item);
|
|
$append(rows, $render(tmpl, {item}));
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<h1><a href="/admin/table/">«</a> Admin {{ .table }}</h1>
|
|
|
|
<block x-data="thePage">
|
|
<bar>
|
|
<button type="button"><a href="/admin/table/new/{{ .table }}/">New</a></button>
|
|
<button type="button">Prev</button>
|
|
<button type="button">Next</button>
|
|
<input type="text" name="search" size="40" placeholder="Search" />
|
|
</bar>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
{{ range $header := .headers }}
|
|
<th>{{ $header }}</th>
|
|
{{ end }}
|
|
</tr>
|
|
</thead>
|
|
<tbody id="table-items">
|
|
</tbody>
|
|
</table>
|
|
|
|
<template id="table-row">
|
|
<tr class="table-row">
|
|
{{ range $header := .headers }}
|
|
<td>
|
|
<a style='text-decoration: none' href='/admin/table/{{ $.table }}/${item.Id}'>
|
|
${item["{{$header}}"]}
|
|
</a>
|
|
</td>
|
|
{{ end }}
|
|
</tr>
|
|
</template>
|
|
</block>
|
|
|