blob: 138b493d686dc1c83b154e8993c03592147e121f (
plain)
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
|
package useflags
import (
"github.com/go-pg/pg/v10"
"net/http"
"soko/pkg/database"
"soko/pkg/models"
)
templ local(useflags []models.Useflag) {
<div class="container mb-5">
<div class="row">
<div class="col-12">
<div class="card border-0">
<div class="list-group">
for i, use := range useflags {
if i == 0 || use.Package != useflags[i-1].Package {
@templ.Raw("</div></div>")
<h3 class={ templ.KV("mt-4", i > 0) }>{ use.Package }</h3>
@templ.Raw(`<div class="card border-0"><div class="list-group">`)
}
<a
class="list-group-item list-group-item-action text-dark"
href={ templ.SafeURL("/useflags/" + use.Name) }
>
<h3 class="kk-search-result-header">{ use.Name }</h3>
{ use.Description }
</a>
}
</div>
</div>
</div>
</div>
</div>
}
func Local(w http.ResponseWriter, r *http.Request) {
var useflags []models.Useflag
err := database.DBCon.Model(&useflags).
Where("scope = 'local'").
Order("package", "name").
Column("package", "name", "description").
Select()
if err != nil && err != pg.ErrNoRows {
http.Error(w, http.StatusText(http.StatusInternalServerError),
http.StatusInternalServerError)
return
}
RenderPage(w, r, "Local", "Local", local(useflags))
}
|