A small project that collects various nice things to get started with Go Web Development.
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.
 
 
 
 
 

39 lines
1.1 KiB

<!-- HAS_ALPINE -->
<script>
$boot(async () => {
let item = await GetJson('/api/admin/table/{{ .table }}/{{ .id }}');
let data = [];
for(let key of Object.keys(item)) {
data.push({key, value: item[key]});
}
$render_data('data-template', 'data-form', data);
});
</script>
<h1><a href="/admin/table/{{ .table }}/">&laquo;</a>Admin {{ .table }}</h1>
<block>
<form method="POST" action="/api/admin/table/{{ .table }}/{{ .id }}">
<card>
<top><h1>{{ .table }} : {{ .id }}</h1></top>
<middle id="data-form">
<template id="data-template">
<div>
<label for="${item.key}">${item.key}</label>
<input name="${item.key}" value="${item.value}" />
</div>
</template>
</middle>
<bottom>
<button type="button"><a href="/admin/table/{{ .table }}/">Back</a></button>
<button class="hover:btn-alert" type="button" @click.prevent="ConfirmDelete('{{ .table }}', item.id)">Delete</button>
<button class="hover:btn-hover" type="submit">Update</button>
</bottom>
</card>
</form>
</block>