package leaguesview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/baseview" import "git.haelnorr.com/h/oslstats/internal/contexts" import "git.haelnorr.com/h/oslstats/internal/permissions" import "fmt" templ ListPage(leagues []*db.League) { @baseview.Layout("Leagues") {
@LeaguesList(leagues)
} } templ LeaguesList(leagues []*db.League) { {{ permCache := contexts.Permissions(ctx) canAddLeague := permCache.HasPermission(permissions.LeaguesCreate) }}
Leagues if canAddLeague { Add league }
if len(leagues) == 0 {

No leagues found

} else {
for _, l := range leagues {

{ l.Name }

{ l.ShortName }
if l.Description != "" {

{ l.Description }

}
}
}
}