diff --git a/views/categories.go b/views/categories.go index 3207822..f377a73 100644 --- a/views/categories.go +++ b/views/categories.go @@ -64,11 +64,13 @@ func localizedCatTemplateAsString(meta Meta, name string, datum ...interface{}) func categoryCard(meta Meta, hyphaName string) string { var buf strings.Builder err := localizedCatTemplates(meta).ExecuteTemplate(&buf, "category card", struct { - HyphaName string - Categories []string + HyphaName string + Categories []string + GivenPermissionToModify bool }{ hyphaName, categories.WithHypha(hyphaName), + meta.U.CanProceed("add-to-category"), }) if err != nil { log.Println(err) @@ -79,11 +81,13 @@ func categoryCard(meta Meta, hyphaName string) string { func CategoryPage(meta Meta, catName string) { var buf strings.Builder err := localizedCatTemplates(meta).ExecuteTemplate(&buf, "category page", struct { - CatName string - Hyphae []string + CatName string + Hyphae []string + GivenPermissionToModify bool }{ catName, categories.Contents(catName), + meta.U.CanProceed("add-to-category"), }) if err != nil { log.Println(err) diff --git a/views/categories.html b/views/categories.html index b869731..895e073 100644 --- a/views/categories.html +++ b/views/categories.html @@ -2,6 +2,7 @@ {{define "category card"}} {{$hyphaName := .HyphaName}} +{{$givenPermission := .GivenPermissionToModify}} {{end}} @@ -44,6 +49,7 @@ {{beautifulName .}} {{end}} + {{if .GivenPermissionToModify}}