mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-06 11:16:44 +02:00
The template module now holds the **Template** context, this makes it possible for (render) function in the template module to access functions and share data between render functions. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8663 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Lucas <sclu1034@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
23 lines
428 B
Go
23 lines
428 B
Go
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package templates
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forgejo.org/modules/translation"
|
|
)
|
|
|
|
type Context struct {
|
|
context.Context
|
|
Locale translation.Locale
|
|
AvatarUtils *AvatarUtils
|
|
Data map[string]any
|
|
}
|
|
|
|
var _ context.Context = Context{}
|
|
|
|
func NewContext(ctx context.Context) *Context {
|
|
return &Context{Context: ctx}
|
|
}
|