From dd0fd60357e8a8dcaf3732947a35e5072eeefaf7 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sun, 30 Oct 2016 22:35:47 -0700 Subject: refactor some db code and update how status vars interpolate throughour UI code --- system/admin/handlers.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'system/admin/handlers.go') diff --git a/system/admin/handlers.go b/system/admin/handlers.go index f7460a3..dbeefd2 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -534,6 +534,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { } order := strings.ToLower(q.Get("order")) + status := q.Get("status") posts := db.ContentAll(t + "_sorted") b := &bytes.Buffer{} @@ -628,7 +629,6 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { ` if hasExt { - status := q.Get("status") if status == "" { q.Add("status", "public") } @@ -677,7 +677,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { continue } - post := adminPostListItem(p, t, "pending") + post := adminPostListItem(p, t, status) b.Write(post) } } else { @@ -692,7 +692,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { continue } - post := adminPostListItem(p, t, "") + post := adminPostListItem(p, t, status) b.Write(post) } } @@ -710,7 +710,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { continue } - post := adminPostListItem(p, t, "pending") + post := adminPostListItem(p, t, status) b.Write(post) } } else { @@ -725,7 +725,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { continue } - post := adminPostListItem(p, t, "") + post := adminPostListItem(p, t, status) b.Write(post) } } @@ -779,6 +779,12 @@ func adminPostListItem(p editor.Editable, t, status string) []byte { cid := fmt.Sprintf("%d", p.ContentID()) + if status == "public" { + status = "" + } else { + status = "_" + status + } + post := `
  • ` + p.ContentName() + ` @@ -788,7 +794,7 @@ func adminPostListItem(p editor.Editable, t, status string) []byte {
    Delete - +
  • ` -- cgit v1.2.3