mirror of
https://github.com/glanceapp/glance.git
synced 2024-11-29 11:55:05 +01:00
32 lines
657 B
Go
32 lines
657 B
Go
|
package widget
|
||
|
|
||
|
import (
|
||
|
"html/template"
|
||
|
|
||
|
"github.com/glanceapp/glance/internal/assets"
|
||
|
)
|
||
|
|
||
|
type Bookmarks struct {
|
||
|
widgetBase `yaml:",inline"`
|
||
|
cachedHTML template.HTML `yaml:"-"`
|
||
|
Groups []struct {
|
||
|
Title string `yaml:"title"`
|
||
|
Color *HSLColorField `yaml:"color"`
|
||
|
Links []struct {
|
||
|
Title string `yaml:"title"`
|
||
|
URL string `yaml:"url"`
|
||
|
} `yaml:"links"`
|
||
|
} `yaml:"groups"`
|
||
|
}
|
||
|
|
||
|
func (widget *Bookmarks) Initialize() error {
|
||
|
widget.withTitle("Bookmarks").withError(nil)
|
||
|
widget.cachedHTML = widget.render(widget, assets.BookmarksTemplate)
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (widget *Bookmarks) Render() template.HTML {
|
||
|
return widget.cachedHTML
|
||
|
}
|