blob: 0289dbb4594ffdbe6e1a8c7dd0d154ac0e17f82c (
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
|
package useflags
import (
"github.com/go-pg/pg/v10"
"net/http"
"soko/pkg/database"
"soko/pkg/models"
)
templ global(useflags []models.Useflag) {
<div class="container mb-5">
<div class="row">
<div class="col-12">
<h3><span class="text-capitalize">Global</span> USE flags</h3>
<div class="card border-0">
<div class="list-group">
for _, use := range useflags {
<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 Global(w http.ResponseWriter, r *http.Request) {
var useflags []models.Useflag
err := database.DBCon.Model(&useflags).
Where("scope = 'global'").
Order("name").
Column("name", "description").
Select()
if err != nil && err != pg.ErrNoRows {
http.Error(w, http.StatusText(http.StatusInternalServerError),
http.StatusInternalServerError)
return
}
RenderPage(w, r, "Global", "Global", global(useflags))
}
|