Documentation
¶
Overview ¶
templ: version: v0.3.1020
templ: version: v0.3.1020
Index ¶
- func FormatTimeSince(ctx context.Context, t time.Time, diffFrom time.Time) string
- func TimeSinceColumn[T attrs.Definer](label any, field string, hoverFormat ...string) list.ListColumn[T]
- type ListAction
- type ListActionsColumn
- func (l *ListActionsColumn[T]) Attributes(r *http.Request, defs attrs.Definitions, row T, colIndex, colCount int) map[string]any
- func (l *ListActionsColumn[T]) Component(r *http.Request, defs attrs.Definitions, row T) templ.Component
- func (l *ListActionsColumn[T]) FieldName() string
- func (l *ListActionsColumn[T]) Header(r *http.Request) templ.Component
- type SortableColumnBuilder
- type TimeInformation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatTimeSince ¶
func TimeSinceColumn ¶
Types ¶
type ListAction ¶
type ListAction[T attrs.Definer] struct { Classname string Show func(r *http.Request, defs attrs.Definitions, row T) bool Text func(r *http.Request, defs attrs.Definitions, row T) string URL func(r *http.Request, defs attrs.Definitions, row T) string Attrs func(r *http.Request, defs attrs.Definitions, row T) templ.Attributes }
func (*ListAction[T]) Component ¶
func (l *ListAction[T]) Component(r *http.Request, defs attrs.Definitions, row T) templ.Component
func (*ListAction[T]) GetAttrs ¶
func (l *ListAction[T]) GetAttrs(r *http.Request, defs attrs.Definitions, row T) templ.Attributes
func (*ListAction[T]) IsShown ¶
func (l *ListAction[T]) IsShown(r *http.Request, defs attrs.Definitions, row T) bool
type ListActionsColumn ¶
type ListActionsColumn[T attrs.Definer] struct { Heading func(c context.Context) string Actions []*ListAction[T] }
func (*ListActionsColumn[T]) Attributes ¶
func (l *ListActionsColumn[T]) Attributes(r *http.Request, defs attrs.Definitions, row T, colIndex, colCount int) map[string]any
func (*ListActionsColumn[T]) Component ¶
func (l *ListActionsColumn[T]) Component(r *http.Request, defs attrs.Definitions, row T) templ.Component
func (*ListActionsColumn[T]) FieldName ¶
func (l *ListActionsColumn[T]) FieldName() string
type SortableColumnBuilder ¶
type SortableColumnBuilder[T attrs.Definer] struct { // if this is false, the builder will not add sorting capabilities // this might spare you some if else statements. CanSort bool // contains filtered or unexported fields }
func NewSortableColumnBuilder ¶
func NewSortableColumnBuilder[T attrs.Definer](model T, isSortField ...func(f attrs.FieldDefinition) bool) *SortableColumnBuilder[T]
func (*SortableColumnBuilder[T]) AddColumn ¶
func (b *SortableColumnBuilder[T]) AddColumn(column any) list.ListColumn[T]
func (*SortableColumnBuilder[T]) IsSortable ¶
func (b *SortableColumnBuilder[T]) IsSortable(field string) bool
type TimeInformation ¶
type TimeInformation struct {
Source time.Time
Years int
Months int
Days int
Hours int
Minutes int
Seconds int
Future bool
}
func FormatTimeDifference ¶
func FormatTimeDifference(ctx context.Context, t time.Time, diffFrom time.Time) ([]string, TimeInformation)
FormatTimeAgo formats the time difference nicely, e.g. "1 year, 2 months, 3 weeks ago"
func GetTimeDiffInformation ¶
func GetTimeDiffInformation(t time.Time, diffFrom time.Time) (info TimeInformation)
Click to show internal directories.
Click to hide internal directories.