mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 09:48:32 +02:00
improved homepage labels
This commit is contained in:
@@ -2,12 +2,14 @@ package homepage
|
||||
|
||||
type (
|
||||
HomePageConfig map[string]HomePageCategory
|
||||
HomePageCategory []HomePageItem
|
||||
HomePageCategory []*HomePageItem
|
||||
|
||||
HomePageItem struct {
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Icon string `yaml:"icon" json:"icon,omitempty"` // URL or unicodes
|
||||
Icon string `yaml:"icon" json:"icon,omitempty"`
|
||||
URL string `yaml:"url" json:"url,omitempty"` // URL or unicodes
|
||||
Category string `yaml:"category" json:"category"`
|
||||
SourceType string `yaml:"source_type" json:"source_type,omitempty"`
|
||||
Description string `yaml:"description" json:"description,omitempty"`
|
||||
WidgetConfig map[string]any `yaml:",flow" json:"widget_config,omitempty"`
|
||||
}
|
||||
@@ -17,19 +19,11 @@ func NewHomePageConfig() HomePageConfig {
|
||||
return HomePageConfig(make(map[string]HomePageCategory))
|
||||
}
|
||||
|
||||
func HomePageItemDefault() *HomePageItem {
|
||||
return &HomePageItem{
|
||||
Name: "Docker",
|
||||
Category: "Uncategorized",
|
||||
WidgetConfig: make(map[string]any),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *HomePageConfig) Clear() {
|
||||
*c = make(HomePageConfig)
|
||||
}
|
||||
|
||||
func (c HomePageConfig) Add(item HomePageItem) {
|
||||
func (c HomePageConfig) Add(item *HomePageItem) {
|
||||
if c[item.Category] == nil {
|
||||
c[item.Category] = make(HomePageCategory, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user