Add todo widget
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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("Todo").withError(nil)
|
||||
|
||||
widget.cachedHTML = widget.renderTemplate(widget, todoWidgetTemplate)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (widget *todoWidget) Render() template.HTML {
|
||||
return widget.cachedHTML
|
||||
}
|
||||
Reference in New Issue
Block a user