Files
glance/internal/glance/widget-todo.go
2025-05-13 17:10:28 +01:00

25 lines
509 B
Go

package glance
import (
"html/template"
)
var todoWidgetTemplate = mustParseTemplate("todo.html", "widget-base.html")
type todoWidget struct {
widgetBase `yaml:",inline"`
cachedHTML template.HTML `yaml:"-"`
TodoID string `yaml:"id"`
}
func (widget *todoWidget) initialize() error {
widget.withTitle("To-do").withError(nil)
widget.cachedHTML = widget.renderTemplate(widget, todoWidgetTemplate)
return nil
}
func (widget *todoWidget) Render() template.HTML {
return widget.cachedHTML
}