tangled
alpha
login
or
join now
veryroundbird.house
/
core
forked from
tangled.org/core
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
improve settings page a bit
oppi.li
1 year ago
a23c12c7
53feba3a
+81
-71
6 changed files
expand all
collapse all
unified
split
appview
pages
funcmap.go
pages.go
templates
repo
log.html
settings
keys.html
settings.html
input.css
+1
-1
appview/pages/funcmap.go
···
93
93
"sequence": func(n int) []struct{} {
94
94
return make([]struct{}, n)
95
95
},
96
96
-
"subslice": func(slice interface{}, start, end int) interface{} {
96
96
+
"subslice": func(slice any, start, end int) any {
97
97
v := reflect.ValueOf(slice)
98
98
if v.Kind() != reflect.Slice && v.Kind() != reflect.Array {
99
99
return nil
+1
-1
appview/pages/pages.go
···
106
106
}
107
107
108
108
func (p *Pages) Settings(w io.Writer, params SettingsParams) error {
109
109
-
return p.execute("settings/keys", w, params)
109
109
+
return p.execute("settings", w, params)
110
110
}
111
111
112
112
type KnotsParams struct {
+5
-3
appview/pages/templates/repo/log.html
···
5
5
{{ $commit := index .Commits 0 }}
6
6
{{ $messageParts := splitN $commit.Message "\n\n" 2 }}
7
7
<div>
8
8
+
<a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}">
8
9
<p class="pb-5">{{ index $messageParts 0 }}</p>
9
10
{{ if gt (len $messageParts) 1 }}
10
10
-
<p class="mt-1 text-sm cursor-text pb-5">
11
11
-
{{ nl2br (unwrapText (index $messageParts 1)) }}
12
12
-
</p>
11
11
+
<p class="mt-1 text-sm cursor-text pb-5">
12
12
+
{{ nl2br (unwrapText (index $messageParts 1)) }}
13
13
+
</p>
13
14
{{ end }}
15
15
+
</a>
14
16
</div>
15
17
16
18
<div class="text-sm text-gray-500">
+72
appview/pages/templates/settings.html
···
1
1
+
{{ define "title" }}settings{{ end }}
2
2
+
3
3
+
{{ define "content" }}
4
4
+
<div class="p-6">
5
5
+
<p class="text-xl font-bold">Settings</p>
6
6
+
</div>
7
7
+
<div class="flex flex-col">
8
8
+
{{ block "profile" . }} {{ end }}
9
9
+
{{ block "keys" . }} {{ end }}
10
10
+
{{ block "knots" . }} {{ end }}
11
11
+
</div>
12
12
+
{{ end }}
13
13
+
14
14
+
{{ define "profile" }}
15
15
+
<header class="text-sm font-bold py-2 px-6 uppercase">profile</header>
16
16
+
<section class="rounded bg-white drop-shadow-sm px-6 py-4 mb-6 w-fit">
17
17
+
<dl class="grid grid-cols-[auto_1fr] gap-x-4">
18
18
+
{{ if .LoggedInUser.Handle }}
19
19
+
<dt class="font-bold">handle</dt>
20
20
+
<dd>@{{ .LoggedInUser.Handle }}</dd>
21
21
+
{{ end }}
22
22
+
<dt class="font-bold">did</dt>
23
23
+
<dd>{{ .LoggedInUser.Did }}</dd>
24
24
+
<dt class="font-bold">pds</dt>
25
25
+
<dd>{{ .LoggedInUser.Pds }}</dd>
26
26
+
</dl>
27
27
+
</section>
28
28
+
{{ end }}
29
29
+
30
30
+
{{ define "keys" }}
31
31
+
<header class="text-sm font-bold py-2 px-6 uppercase">ssh keys</header>
32
32
+
<section class="rounded bg-white drop-shadow-sm px-6 py-4 mb-6 w-fit">
33
33
+
<div id="key-list" class="flex flex-col gap-6 mb-8">
34
34
+
{{ range .PubKeys }}
35
35
+
<div>
36
36
+
<div class="inline-flex items-center gap-4">
37
37
+
<i class="w-3 h-3" data-lucide="key"></i>
38
38
+
<p class="font-bold">{{ .Name }} </p>
39
39
+
<p class="text-sm text-gray-500">added {{ .Created | timeFmt }}</p>
40
40
+
</div>
41
41
+
<code class="block text-sm break-all text-gray-500">{{ .Key }}</code>
42
42
+
</div>
43
43
+
{{ end }}
44
44
+
</div>
45
45
+
<hr class="mb-4" />
46
46
+
<p class="mb-2">add an ssh key</p>
47
47
+
<form
48
48
+
hx-put="/settings/keys"
49
49
+
hx-swap="none"
50
50
+
class="max-w-2xl mb-8 space-y-4"
51
51
+
>
52
52
+
<input
53
53
+
type="text"
54
54
+
id="name"
55
55
+
name="name"
56
56
+
placeholder="key name"
57
57
+
required
58
58
+
class="w-full"/>
59
59
+
60
60
+
<input
61
61
+
id="key"
62
62
+
name="key"
63
63
+
placeholder="ssh-rsa AAAAAA..."
64
64
+
required
65
65
+
class="w-full"/>
66
66
+
67
67
+
<button class="btn w-full" type="submit">add key</button>
68
68
+
69
69
+
<div id="settings-keys" class="error"></div>
70
70
+
</form>
71
71
+
</section>
72
72
+
{{ end }}
-64
appview/pages/templates/settings/keys.html
···
1
1
-
{{ define "title" }}settings{{ end }}
2
2
-
3
3
-
{{ define "content" }}
4
4
-
<h1>settings</h1>
5
5
-
6
6
-
<section class="mb-8">
7
7
-
<h2 class="text-xl mb-4">profile</h2>
8
8
-
<dl class="grid grid-cols-[auto_1fr] gap-x-4">
9
9
-
<dt>handle</dt>
10
10
-
<dd>{{ .LoggedInUser.Handle }}</dd>
11
11
-
<dt>did</dt>
12
12
-
<dd>{{ .LoggedInUser.Did }}</dd>
13
13
-
<dt>pds</dt>
14
14
-
<dd>{{ .LoggedInUser.Pds }}</dd>
15
15
-
</dl>
16
16
-
</section>
17
17
-
18
18
-
<section>
19
19
-
<h2 class="text-xl mb-4">ssh keys</h2>
20
20
-
<form
21
21
-
hx-put="/settings/keys"
22
22
-
hx-swap="none"
23
23
-
class="max-w-2xl space-y-4 mb-8"
24
24
-
>
25
25
-
<div>
26
26
-
<label for="name" class="block mb-1">key name</label>
27
27
-
<input
28
28
-
type="text"
29
29
-
id="name"
30
30
-
name="name"
31
31
-
required
32
32
-
class="w-full"
33
33
-
/>
34
34
-
</div>
35
35
-
36
36
-
<div>
37
37
-
<label for="key" class="block mb-1">pub key</label>
38
38
-
<textarea
39
39
-
id="key"
40
40
-
name="key"
41
41
-
placeholder="ssh-rsa AAAAAA..."
42
42
-
required
43
43
-
class="w-full h-24"
44
44
-
></textarea>
45
45
-
</div>
46
46
-
47
47
-
<button class="btn" type="submit">add key</button>
48
48
-
49
49
-
<div id="settings-keys" class="error"></div>
50
50
-
</form>
51
51
-
52
52
-
<h3 class="text-lg mb-2">existing keys</h3>
53
53
-
<ul id="key-list" class="space-y-4">
54
54
-
{{ range .PubKeys }}
55
55
-
<li class="p-4 bg-gray-50 rounded">
56
56
-
<h4 class="font-bold mb-2">{{ .Name }}</h4>
57
57
-
<code class="block text-sm break-all">{{ .Key }}</code>
58
58
-
</li>
59
59
-
{{ else }}
60
60
-
<p class="text-gray-600">no ssh keys added yet</p>
61
61
-
{{ end }}
62
62
-
</ul>
63
63
-
</section>
64
64
-
{{ end }}
+2
-2
input.css
···
123
123
@apply block text-sm text-black;
124
124
}
125
125
input {
126
126
-
@apply bg-white border border-black rounded-sm focus:ring-black p-2;
126
126
+
@apply bg-white border border-gray-400 rounded-sm focus:ring-black p-2;
127
127
}
128
128
textarea {
129
129
-
@apply bg-white border border-black rounded-sm focus:ring-black p-2;
129
129
+
@apply bg-white border border-gray-400 rounded-sm focus:ring-black p-2;
130
130
}
131
131
details summary::-webkit-details-marker {
132
132
display: none;