Archived
1
0

fix boards.html

This commit is contained in:
Jeff Becker 2017-04-03 21:35:09 -04:00
parent 279ca91043
commit e8fa40c0ca
2 changed files with 36 additions and 42 deletions

View File

@ -99,7 +99,7 @@ func (self *nullHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if strings.HasPrefix(file, "boards.html") {
template.genFrontPage(10, self.prefix, self.name, ioutil.Discard, w, self.database)
template.genBoardList(self.prefix, self.name, w, self.database)
return
}

View File

@ -441,9 +441,7 @@ func (self *templateEngine) genGraphs(prefix string, wr io.Writer, db Database)
}
// generate front page and board list
func (self *templateEngine) genFrontPage(top_count int, prefix, frontend_name string, indexwr, boardswr io.Writer, db Database) {
/*
func (self *templateEngine) genBoardList(prefix, name string, wr io.Writer, db Database) {
// the graph for the front page
var frontpage_graph boardPageRows
@ -463,21 +461,21 @@ func (self *templateEngine) genFrontPage(top_count int, prefix, frontend_name st
Board: group,
})
}
var posts_graph postsGraph
posts := db.GetLastDaysPosts(10)
if posts == nil {
// wtf?
} else {
for _, entry := range posts {
posts_graph = append(posts_graph, postsGraphRow{
day: entry.Time(),
Num: entry.Count(),
})
param := map[string]interface{}{
"prefix": prefix,
"frontend": name,
}
sort.Sort(frontpage_graph)
param["graph"] = frontpage_graph
_, err := io.WriteString(wr, self.renderTemplate("boardlist.mustache", param))
if err != nil {
log.Println("error writing board list page", err)
}
}
*/
// generate front page
func (self *templateEngine) genFrontPage(top_count int, prefix, frontend_name string, indexwr, boardswr io.Writer, db Database) {
models := db.GetLastPostedPostModels(prefix, 20)
wr := indexwr
@ -488,7 +486,7 @@ func (self *templateEngine) genFrontPage(top_count int, prefix, frontend_name st
/*
sort.Sort(posts_graph)
param["postsgraph"] = self.renderTemplate("posts_graph.mustache", map[string]interface{}{"graph": posts_graph})
sort.Sort(frontpage_graph)
if len(frontpage_graph) > top_count {
param["boardgraph"] = frontpage_graph[:top_count]
} else {
@ -507,11 +505,7 @@ func (self *templateEngine) genFrontPage(top_count int, prefix, frontend_name st
}
/*
wr = boardswr
param["graph"] = frontpage_graph
_, err = io.WriteString(wr, self.renderTemplate("boardlist.mustache", param))
if err != nil {
log.Println("error writing board list page", err)
}
*/
}