DEVELOPMENT ENVIRONMENT

~liljamo/felu

ref: 6b83684da956b580c5c32129848a1ff66f42e0c6 felu/internal/components/adminpartials_templ.go -rw-r--r-- 2.5 KiB
6b83684dJonni Liljamo docs: add README.md 1 year, 29 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Code generated by templ@(devel) DO NOT EDIT.

package components

//lint:file-ignore SA4006 This context is only used if a nested component is present.

import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"

import "git.src.quest/~skye/felu-ddns/internal/db"
import "strconv"

func AdminPartialUsersList(users []db.User) templ.Component {
	return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
		templBuffer, templIsBuffer := w.(*bytes.Buffer)
		if !templIsBuffer {
			templBuffer = templ.GetBuffer()
			defer templ.ReleaseBuffer(templBuffer)
		}
		ctx = templ.InitializeContext(ctx)
		var_1 := templ.GetChildren(ctx)
		if var_1 == nil {
			var_1 = templ.NopComponent
		}
		ctx = templ.ClearChildren(ctx)
		_, err = templBuffer.WriteString("<table class=\"table-auto\"><thead><tr><th class=\"text-start p-2\">")
		if err != nil {
			return err
		}
		var_2 := `Id`
		_, err = templBuffer.WriteString(var_2)
		if err != nil {
			return err
		}
		_, err = templBuffer.WriteString("</th><th class=\"text-start p-2\">")
		if err != nil {
			return err
		}
		var_3 := `Email`
		_, err = templBuffer.WriteString(var_3)
		if err != nil {
			return err
		}
		_, err = templBuffer.WriteString("</th><th class=\"text-start p-2\">")
		if err != nil {
			return err
		}
		var_4 := `Is Admin`
		_, err = templBuffer.WriteString(var_4)
		if err != nil {
			return err
		}
		_, err = templBuffer.WriteString("</th></tr></thead><tbody>")
		if err != nil {
			return err
		}
		for _, user := range users {
			_, err = templBuffer.WriteString("<tr class=\"border\"><td><div class=\"p-2\">")
			if err != nil {
				return err
			}
			var var_5 string = user.Id
			_, err = templBuffer.WriteString(templ.EscapeString(var_5))
			if err != nil {
				return err
			}
			_, err = templBuffer.WriteString("</div></td><td><div class=\"p-2\">")
			if err != nil {
				return err
			}
			var var_6 string = user.Email
			_, err = templBuffer.WriteString(templ.EscapeString(var_6))
			if err != nil {
				return err
			}
			_, err = templBuffer.WriteString("</div></td><td><div class=\"p-2\">")
			if err != nil {
				return err
			}
			var var_7 string = strconv.FormatBool(user.IsAdmin)
			_, err = templBuffer.WriteString(templ.EscapeString(var_7))
			if err != nil {
				return err
			}
			_, err = templBuffer.WriteString("</div></td></tr>")
			if err != nil {
				return err
			}
		}
		_, err = templBuffer.WriteString("</tbody></table>")
		if err != nil {
			return err
		}
		if !templIsBuffer {
			_, err = templBuffer.WriteTo(w)
		}
		return err
	})
}