mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-14 16:26:23 -07:00
Add board config to all templates using the standard header
Also remove commented migration lines in build.py
This commit is contained in:
parent
8719227f3d
commit
7e13a32ec3
9 changed files with 39 additions and 55 deletions
|
@ -140,11 +140,12 @@ func BuildBoardPages(board *gcsql.Board) error {
|
|||
// Render board page template to the file,
|
||||
// packaging the board/section list, threads, and board info
|
||||
if err = serverutil.MinifyTemplate(gctemplates.BoardPage, map[string]interface{}{
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"boards": gcsql.AllBoards,
|
||||
"sections": gcsql.AllSections,
|
||||
"threads": threads,
|
||||
"board": board,
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"boards": gcsql.AllBoards,
|
||||
"sections": gcsql.AllSections,
|
||||
"threads": threads,
|
||||
"board": board,
|
||||
"board_config": config.GetBoardConfig(board.Dir),
|
||||
}, boardPageFile, "text/html"); err != nil {
|
||||
return errors.New(gclog.Printf(gclog.LErrorLog,
|
||||
"Failed building /%s/: %s", board.Dir, err.Error()))
|
||||
|
@ -183,11 +184,12 @@ func BuildBoardPages(board *gcsql.Board) error {
|
|||
|
||||
// Render the boardpage template
|
||||
if err = serverutil.MinifyTemplate(gctemplates.BoardPage, map[string]interface{}{
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"boards": gcsql.AllBoards,
|
||||
"sections": gcsql.AllSections,
|
||||
"threads": pageThreads,
|
||||
"board": board,
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"boards": gcsql.AllBoards,
|
||||
"sections": gcsql.AllSections,
|
||||
"threads": pageThreads,
|
||||
"board": board,
|
||||
"board_config": config.GetBoardConfig(board.Dir),
|
||||
"posts": []interface{}{
|
||||
gcsql.Post{BoardID: board.ID},
|
||||
},
|
||||
|
@ -286,11 +288,12 @@ func BuildCatalog(boardID int) string {
|
|||
}
|
||||
|
||||
if err = serverutil.MinifyTemplate(gctemplates.Catalog, map[string]interface{}{
|
||||
"boards": gcsql.AllBoards,
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"board": board,
|
||||
"sections": gcsql.AllSections,
|
||||
"threads": threadInterfaces,
|
||||
"boards": gcsql.AllBoards,
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"board": board,
|
||||
"board_config": config.GetBoardConfig(board.Dir),
|
||||
"sections": gcsql.AllSections,
|
||||
"threads": threadInterfaces,
|
||||
}, catalogFile, "text/html"); err != nil {
|
||||
return gclog.Printf(gclog.LErrorLog,
|
||||
"Error building catalog for /%s/: %s", board.Dir, err.Error()) + "<br />"
|
||||
|
|
|
@ -70,7 +70,7 @@ func BuildBoardListJSON() error {
|
|||
defer boardListFile.Close()
|
||||
|
||||
boardsMap := map[string][]gcsql.Board{
|
||||
"boards": []gcsql.Board{},
|
||||
"boards": {},
|
||||
}
|
||||
|
||||
boardCfg := config.GetBoardConfig("")
|
||||
|
|
|
@ -61,11 +61,6 @@ func BuildThreadPages(op *gcsql.Post) error {
|
|||
criticalCfg := config.GetSystemCriticalConfig()
|
||||
os.Remove(path.Join(criticalCfg.DocumentRoot, board.Dir, "res", strconv.Itoa(op.ID)+".html"))
|
||||
|
||||
var repliesInterface []interface{}
|
||||
for _, reply := range replies {
|
||||
repliesInterface = append(repliesInterface, reply)
|
||||
}
|
||||
|
||||
threadPageFilepath := path.Join(criticalCfg.DocumentRoot, board.Dir, "res", strconv.Itoa(op.ID)+".html")
|
||||
threadPageFile, err = os.OpenFile(threadPageFilepath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0777)
|
||||
if err != nil {
|
||||
|
@ -75,12 +70,13 @@ func BuildThreadPages(op *gcsql.Post) error {
|
|||
|
||||
// render thread page
|
||||
if err = serverutil.MinifyTemplate(gctemplates.ThreadPage, map[string]interface{}{
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"boards": gcsql.AllBoards,
|
||||
"board": board,
|
||||
"sections": gcsql.AllSections,
|
||||
"posts": replies,
|
||||
"op": op,
|
||||
"webroot": criticalCfg.WebRoot,
|
||||
"boards": gcsql.AllBoards,
|
||||
"board": board,
|
||||
"board_config": config.GetBoardConfig(board.Dir),
|
||||
"sections": gcsql.AllSections,
|
||||
"posts": replies,
|
||||
"op": op,
|
||||
}, threadPageFile, "text/html"); err != nil {
|
||||
return errors.New(gclog.Printf(gclog.LErrorLog,
|
||||
"Failed building /%s/res/%d threadpage: %s", board.Dir, op.ID, err.Error()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue