DEVELOPMENT ENVIRONMENT

~liljamo/emerwen-web

ref: 797037fe5da9b632166a17b9e7f57ec2ae0d35e3 emerwen-web/internal/components/index.templ -rw-r--r-- 591 bytes
797037feJonni Liljamo feat: conform to new protocol changes a day ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package components

templ Index() {
	@Base("emerwen, counting sheep") {
		<div class="flex flex-col gap-2">
			if loggedIn(ctx) {
				@newWorker()
				<div hx-get="/partials/workers" hx-trigger="load, refresh-workers from:body" hx-target="this"></div>
			}
		</div>
	}
}

templ newWorker() {
	<details>
		<summary class="select-none">new worker</summary>
		<form class="flex flex-col p-2 gap-1" hx-post="/api/worker">
			<label>name</label>
			<input class="border" type="text" placeholder="..." name="name"/>
			<button class="border p-1" type="submit">add</button>
		</form>
	</details>
}