mirror of
https://github.com/yv1ing/MollyBlog.git
synced 2025-09-16 14:53:45 +08:00
new: Added new tab pages and related modules
This commit is contained in:
@@ -20,9 +20,14 @@ type MApp struct {
|
||||
lute *lute.Lute
|
||||
engine *gin.Engine
|
||||
|
||||
Posts []*model.MPost
|
||||
TaggedPosts []*model.MPost
|
||||
CategorizedPosts []*model.MPost
|
||||
Posts []*model.MPost
|
||||
|
||||
Tags map[string]string
|
||||
TagsCount map[string]int
|
||||
Categories map[string]string
|
||||
CategoriesCount map[string]int
|
||||
TaggedPosts map[string][]*model.MPost
|
||||
CategorizedPosts map[string][]*model.MPost
|
||||
|
||||
SrcFiles []model.MFileInfo
|
||||
}
|
||||
@@ -56,7 +61,34 @@ func NewMApp(cfg *config.MConfig) *MApp {
|
||||
Port: cfg.Port,
|
||||
Config: cfg,
|
||||
|
||||
Tags: make(map[string]string),
|
||||
TagsCount: make(map[string]int),
|
||||
|
||||
Categories: make(map[string]string),
|
||||
CategoriesCount: make(map[string]int),
|
||||
|
||||
TaggedPosts: make(map[string][]*model.MPost),
|
||||
CategorizedPosts: make(map[string][]*model.MPost),
|
||||
|
||||
lute: lute.New(),
|
||||
engine: engine,
|
||||
}
|
||||
}
|
||||
|
||||
// resetStorage before each update, delete the cache
|
||||
func (ma *MApp) resetStorage() {
|
||||
ma.Posts = nil
|
||||
ma.Tags = nil
|
||||
ma.Categories = nil
|
||||
ma.CategoriesCount = nil
|
||||
ma.TaggedPosts = nil
|
||||
ma.CategorizedPosts = nil
|
||||
ma.SrcFiles = nil
|
||||
|
||||
ma.Tags = make(map[string]string)
|
||||
ma.TagsCount = make(map[string]int)
|
||||
ma.Categories = make(map[string]string)
|
||||
ma.CategoriesCount = make(map[string]int)
|
||||
ma.TaggedPosts = make(map[string][]*model.MPost)
|
||||
ma.CategorizedPosts = make(map[string][]*model.MPost)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user