mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-17 10:56:24 -07:00
Add link back to staff dashboard
This commit is contained in:
parent
5e92cf764f
commit
fc47afafb5
5 changed files with 27 additions and 16 deletions
|
@ -100,16 +100,19 @@ func BuildBoardListJSON() error {
|
|||
|
||||
// BuildPageHeader is a convenience function for automatically generating the top part
|
||||
// of every normal HTML page
|
||||
func BuildPageHeader(writer io.Writer, pageTitle string) error {
|
||||
return serverutil.MinifyTemplate(gctemplates.PageHeader,
|
||||
map[string]interface{}{
|
||||
"page_title": pageTitle,
|
||||
"webroot": config.GetSystemCriticalConfig().WebRoot,
|
||||
"site_config": config.GetSiteConfig(),
|
||||
"sections": gcsql.AllSections,
|
||||
"boards": gcsql.AllBoards,
|
||||
"board_config": config.GetBoardConfig(""),
|
||||
}, writer, "text/html")
|
||||
func BuildPageHeader(writer io.Writer, pageTitle string, board string, misc map[string]interface{}) error {
|
||||
phMap := map[string]interface{}{
|
||||
"page_title": pageTitle,
|
||||
"webroot": config.GetSystemCriticalConfig().WebRoot,
|
||||
"site_config": config.GetSiteConfig(),
|
||||
"sections": gcsql.AllSections,
|
||||
"boards": gcsql.AllBoards,
|
||||
"board_config": config.GetBoardConfig(board),
|
||||
}
|
||||
for k, val := range misc {
|
||||
phMap[k] = val
|
||||
}
|
||||
return serverutil.MinifyTemplate(gctemplates.PageHeader, phMap, writer, "text/html")
|
||||
}
|
||||
|
||||
// BuildPageFooter is a convenience function for automatically generating the bottom
|
||||
|
|
|
@ -335,7 +335,7 @@ var actions = []Action{
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
post.GetURL(false)
|
||||
|
||||
staff_id_int, _ := staff_id.(int64)
|
||||
reports = append(reports, map[string]interface{}{
|
||||
"id": id,
|
||||
|
|
|
@ -69,7 +69,7 @@ func CallManageFunction(writer http.ResponseWriter, request *http.Request) {
|
|||
action := getAction(actionID, staffRank)
|
||||
if action == nil {
|
||||
if wantsJSON {
|
||||
serveError(writer, "notfound", actionID, "action not found", wantsJSON)
|
||||
serveError(writer, "notfound", actionID, "action not found", wantsJSON || (action.JSONoutput == AlwaysJSON))
|
||||
} else {
|
||||
serverutil.ServeNotFound(writer, request)
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func CallManageFunction(writer http.ResponseWriter, request *http.Request) {
|
|||
gclog.Printf(gclog.LStaffLog,
|
||||
"Rejected request to manage page %s from %s (insufficient permissions)",
|
||||
actionID, staffName)
|
||||
serveError(writer, "permission", actionID, "You do not have permission to access this page", wantsJSON || (action.JSONoutput > NoJSON))
|
||||
serveError(writer, "permission", actionID, "You do not have permission to access this page", wantsJSON || (action.JSONoutput == AlwaysJSON))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,14 @@ func CallManageFunction(writer http.ResponseWriter, request *http.Request) {
|
|||
serverutil.MinifyWriter(writer, []byte(outputJSON), "application/json")
|
||||
return
|
||||
}
|
||||
if err = building.BuildPageHeader(&managePageBuffer, action.Title); err != nil {
|
||||
|
||||
headerMap := map[string]interface{}{
|
||||
"page_type": "manage",
|
||||
}
|
||||
if action.ID != "dashboard" && action.ID != "login" && action.ID != "logout" {
|
||||
headerMap["include_dashboard_link"] = true
|
||||
}
|
||||
if err = building.BuildPageHeader(&managePageBuffer, action.Title, "", headerMap); err != nil {
|
||||
serveError(writer, "error", actionID,
|
||||
gclog.Print(gclog.LErrorLog, "Failed writing page header: ", err.Error()), false)
|
||||
return
|
||||
|
|
|
@ -51,7 +51,6 @@ func HandleReport(request *http.Request) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(isDuplicate, isBlocked)
|
||||
if isDuplicate || isBlocked {
|
||||
// post has already been reported, and for the same reason, moving on
|
||||
continue
|
||||
|
|
|
@ -22,4 +22,6 @@
|
|||
{{range $i, $board := .boards}}<a href="{{$.webroot}}{{$board.Dir}}/" class="topbar-item" title="{{$board.Title}}">/{{$board.Dir}}/</a>{{end}}
|
||||
</div>
|
||||
<div id="content">
|
||||
{{with $.page_title}}<br /><h1>{{$.page_title}}</h1>{{end}}
|
||||
{{with $.page_title }}<br /><h1>{{$.page_title}}</h1>
|
||||
{{with $.include_dashboard_link}}<a href="{{$.webroot}}manage">Return to dashboard</a><br/>{{end}}
|
||||
{{end}}
|
Loading…
Add table
Add a link
Reference in a new issue